From 8cecb3c285d69567c98cb3b26c8b933526caa22d Mon Sep 17 00:00:00 2001 From: Sarah Morgan Date: Wed, 21 Feb 2024 15:15:29 -0700 Subject: [PATCH] Update dbt docs for v0.7.7 (#393) Update dbt docs --- docs/catalog.json | 2 +- docs/index.html | 24 ++++++++++++------------ docs/manifest.json | 2 +- docs/run_results.json | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/catalog.json b/docs/catalog.json index 88e8c9552..e7edcd832 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.7.8", "generated_at": "2024-02-20T20:47:58.554147Z", "invocation_id": "de423a96-1d69-4b7f-8c18-885e2c4bbec4", "env": {}}, "nodes": {"model.the_tuva_project.emergency_department__int_first_claim_values": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_FIRST_CLAIM_VALUES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_START": {"type": "DATE", "index": 2, "name": "CLAIM_START", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 4, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 5, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 6, "name": "ADMIT_TYPE_CODE", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 7, "name": "FACILITY_NPI", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 8, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 9, "name": "APR_DRG_CODE", "comment": null}, "CLAIM_ROW": {"type": "NUMBER", "index": 10, "name": "CLAIM_ROW", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__int_first_claim_values"}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_LINE_NUMBERS", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers"}, "model.the_tuva_project.cms_hcc__int_hcc_hierarchy": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_HCC_HIERARCHY", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_APR_DRG_VOTING", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__outpatient_psychiatric_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_PSYCHIATRIC_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.quality_measures__int_nqf0034_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_NUMERATOR", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.core__stg_clinical_location": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_LOCATION", "database": "RAW", "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.financial_pmpm__pmpm_prep": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "PMPM_PREP", "database": "RAW", "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_VISIT_PAID": {"type": "NUMBER", "index": 8, "name": "OFFICE_VISIT_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 9, "name": "ANCILLARY_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 10, "name": "PHARMACY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 11, "name": "OTHER_PAID", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 12, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 13, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_PAID": {"type": "NUMBER", "index": 14, "name": "AMBULATORY_SURGERY_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 15, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 16, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 17, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 18, "name": "HOME_HEALTH_PAID", "comment": null}, "HOSPICE_PAID": {"type": "NUMBER", "index": 19, "name": "HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 20, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 21, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 22, "name": "LAB_PAID", "comment": null}, "OFFICE_VISIT_PAID_2": {"type": "NUMBER", "index": 23, "name": "OFFICE_VISIT_PAID_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 24, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 25, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 26, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 27, "name": "SKILLED_NURSING_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 28, "name": "URGENT_CARE_PAID", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 29, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 30, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED": {"type": "NUMBER", "index": 31, "name": "OFFICE_VISIT_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 32, "name": "ANCILLARY_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 33, "name": "PHARMACY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 34, "name": "OTHER_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 35, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 36, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_ALLOWED": {"type": "NUMBER", "index": 37, "name": "AMBULATORY_SURGERY_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 38, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 39, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 40, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 41, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "HOSPICE_ALLOWED": {"type": "NUMBER", "index": 42, "name": "HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 43, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 44, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 45, "name": "LAB_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED_2": {"type": "NUMBER", "index": 46, "name": "OFFICE_VISIT_ALLOWED_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 47, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 48, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 49, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 50, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 51, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 52, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 53, "name": "MEDICAL_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 54, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 55, "name": "MEDICAL_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 56, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__skilled_nursing_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_SKILLED_NURSING_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__skilled_nursing_professional"}, "seed.the_tuva_project.cms_hcc__disease_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISEASE_INTERACTION_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 16384, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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"}, "seed.the_tuva_project.quality_measures__value_sets": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_VALUE_SET_CODES", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 49152, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4518, "include": true, "description": "An approximate count of rows in this table"}, "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.core__stg_clinical_procedure": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_PROCEDURE", "database": "RAW", "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.hcc_suspecting__list": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "LIST", "database": "RAW", "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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__urgent_care_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_URGENT_CARE_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.readmissions__acute_diagnosis_icd_10_cm": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ACUTE_DIAGNOSIS_ICD_10_CM", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 183808, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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_exclude_palliative": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_PALLIATIVE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_palliative"}, "model.the_tuva_project.core__pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PHARMACY_CLAIM", "database": "RAW", "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": "NUMBER", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 17, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 19, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 21, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__provider": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PROVIDER", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 250535936, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 8131408, "include": true, "description": "An approximate count of rows in this table"}, "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.service_category__dq_multiple_service_categories_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_DQ_MULTIPLE_SERVICE_CATEGORIES_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DISTINCT_SERVICE_CATEGORY_COUNT": {"type": "NUMBER", "index": 2, "name": "DISTINCT_SERVICE_CATEGORY_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__dq_multiple_service_categories_institutional"}, "model.the_tuva_project.readmissions__encounter_data_quality": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_DATA_QUALITY", "database": "RAW", "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.normalized_input__int_discharge_disposition_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DISCHARGE_DISPOSITION_VOTING", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__dq_multiple_service_categories_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_DQ_MULTIPLE_SERVICE_CATEGORIES_PROFESSIONAL", "database": "RAW", "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}, "DISTINCT_SERVICE_CATEGORY_COUNT": {"type": "NUMBER", "index": 3, "name": "DISTINCT_SERVICE_CATEGORY_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__dq_multiple_service_categories_professional"}, "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": "RAW", "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_BILLING_NPI": {"type": "TEXT", "index": 6, "name": "NORMALIZED_BILLING_NPI", "comment": null}, "NORMALIZED_FACILITY_NPI": {"type": "TEXT", "index": 7, "name": "NORMALIZED_FACILITY_NPI", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__claims_preprocessing_pharmacy_header_fail_details": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_PHARMACY_HEADER_FAIL_DETAILS", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details"}, "seed.the_tuva_project.readmissions__acute_diagnosis_ccs": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ACUTE_DIAGNOSIS_CCS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "seed.the_tuva_project.terminology__icd_9_cm": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_9_CM", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 390144, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.financial_pmpm__service_category_1_allowed_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_1_ALLOWED_PIVOT", "database": "RAW", "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_VISIT_ALLOWED": {"type": "NUMBER", "index": 8, "name": "OFFICE_VISIT_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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__office_visit_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OFFICE_VISIT_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_visit_professional"}, "model.the_tuva_project.insights__trend_sum_amount_by_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "TREND_SUM_AMOUNT_BY_CLAIM_TYPE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 3, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_PAID_AMOUNT_CHANGE": {"type": "NUMBER", "index": 4, "name": "TOTAL_PAID_AMOUNT_CHANGE", "comment": null}, "TOTAL_PAID_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 5, "name": "TOTAL_PAID_AMOUNT_PERCENT_CHANGE", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 6, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT_CHANGE": {"type": "NUMBER", "index": 7, "name": "TOTAL_ALLOWED_AMOUNT_CHANGE", "comment": null}, "TOTAL_ALLOWED_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 8, "name": "TOTAL_ALLOWED_AMOUNT_PERCENT_CHANGE", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 9, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT_CHANGE": {"type": "NUMBER", "index": 10, "name": "TOTAL_CHARGE_AMOUNT_CHANGE", "comment": null}, "TOTAL_CHARGE_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 11, "name": "TOTAL_CHARGE_AMOUNT_PERCENT_CHANGE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_claim_type"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1313792, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1313792, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "seed.the_tuva_project.service_category__service_categories": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_VALUE_SET_SERVICE_CATEGORIES", "database": "RAW", "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}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.data_quality__claims_preprocessing_medical_claim_denominators": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_DENOMINATORS", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_DENOMINATOR_NAME": {"type": "TEXT", "index": 1, "name": "TEST_DENOMINATOR_NAME", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators"}, "seed.input_layer.eligibility_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "ELIGIBILITY_SEED", "database": "RAW", "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}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 4, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 5, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 6, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 7, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 8, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 11, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 12, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 13, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 14, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 16, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 17, "name": "LAST_NAME", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 18, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 19, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 20, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 21, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 22, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 23, "name": "DATA_SOURCE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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__claims_preprocessing_institutional_header_fail_details": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_INSTITUTIONAL_HEADER_FAIL_DETAILS", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details"}, "model.the_tuva_project.readmissions__index_admission": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_INDEX_ADMISSION", "database": "RAW", "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.quality_measures__int_nqf2372__frailty": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372__FRAILTY", "database": "RAW", "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}, "EXCLUSION_DATE": {"type": "DATE", "index": 4, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 5, "name": "EXCLUSION_REASON", "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.quality_measures__int_nqf2372__frailty"}, "model.the_tuva_project.hcc_suspecting__summary": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "SUMMARY", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_place_of_service_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PLACE_OF_SERVICE_NORMALIZE", "database": "RAW", "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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__lab_result": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "LAB_RESULT", "database": "RAW", "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}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.ccsr__long_condition_category": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "LONG_CONDITION_CATEGORY", "database": "RAW", "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": "BOOLEAN", "index": 13, "name": "IS_IP_DEFAULT_CATEGORY", "comment": null}, "IS_OP_DEFAULT_CATEGORY": {"type": "BOOLEAN", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.acute_inpatient__last_claim_values": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_LAST_CLAIM_VALUES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_START": {"type": "DATE", "index": 2, "name": "CLAIM_START", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 3, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "CLAIM_ROW": {"type": "NUMBER", "index": 4, "name": "CLAIM_ROW", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__last_claim_values"}, "model.the_tuva_project.cms_hcc__patient_risk_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "PATIENT_RISK_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.quality_measures__int_nqf2372_exclude_hospice": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_HOSPICE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_hospice"}, "model.the_tuva_project.cms_hcc__int_eligible_conditions": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_ELIGIBLE_CONDITIONS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.quality_measures__int_nqf2372_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_NUMERATOR", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.readmissions__encounter_with_ccs": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_WITH_CCS", "database": "RAW", "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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "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.service_category__dialysis_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DIALYSIS_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.quality_measures__int_nqf2372_exclude_institutional": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_INSTITUTIONAL", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_institutional"}, "model.the_tuva_project.insights__sum_amount_by_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "SUM_AMOUNT_BY_CLAIM_TYPE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_TYPE": {"type": "TEXT", "index": 1, "name": "CLAIM_TYPE", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 2, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 3, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 4, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:43UTC", "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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__sum_amount_by_claim_type"}, "model.the_tuva_project.core__practitioner": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PRACTITIONER", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__claims_preprocessing_medical_claim_inst_missing_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_INST_MISSING_VALUES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values"}, "model.the_tuva_project.readmissions__index_discharge_requirement": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_INDEX_DISCHARGE_REQUIREMENT", "database": "RAW", "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.acute_inpatient__data_quality_summary": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_DATA_QUALITY_SUMMARY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"FIELD": {"type": "TEXT", "index": 1, "name": "FIELD", "comment": null}, "TOTAL_COUNT": {"type": "NUMBER", "index": 2, "name": "TOTAL_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 29, "include": true, "description": "An approximate count of rows in this table"}, "has_stats": {"id": "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__data_quality_summary"}, "seed.the_tuva_project.terminology__discharge_disposition": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "DISCHARGE_DISPOSITION", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.readmissions__specialty_cohort": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_SPECIALTY_COHORT", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 8192, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.service_category__urgent_care_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_URGENT_CARE_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__inpatient_psychiatric_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_PSYCHIATRIC_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.quality_measures__int_nqf2372_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUSIONS", "database": "RAW", "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}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 9, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_nqf0034_exclude_dementia": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_DEMENTIA", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_dementia"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_medical_claim_invalid_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_INVALID_NPI", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_NAME": {"type": "TEXT", "index": 1, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 2, "name": "PIPELINE_TEST", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 3, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 5, "name": "TEST_CATEGORY", "comment": null}, "GRAIN": {"type": "TEXT", "index": 6, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 7, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "FILLED_ROW_COUNT": {"type": "NUMBER", "index": 9, "name": "FILLED_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi"}, "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_RESULT_STAGE_MEDICAL_CLAIM", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 2, "name": "GRAIN", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 3, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 4, "name": "TEST_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}, "FAILURES": {"type": "NUMBER", "index": 7, "name": "FAILURES", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim"}, "model.the_tuva_project.ccsr__procedure_category_map": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "PROCEDURE_CATEGORY_MAP", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1553408, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:42UTC", "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"}, "has_stats": {"id": "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__claims_preprocessing_medical_claim_dates": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_DATES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.readmissions__readmission_summary": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "READMISSION_SUMMARY", "database": "RAW", "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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__dq_input_layer_results": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_DQ_INPUT_LAYER_RESULTS", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DQ_PROBLEM": {"type": "TEXT", "index": 1, "name": "DQ_PROBLEM", "comment": null}, "DISTINCT_CLAIMS": {"type": "NUMBER", "index": 2, "name": "DISTINCT_CLAIMS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__dq_input_layer_results"}, "model.the_tuva_project.acute_inpatient__professional_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_PROFESSIONAL_ENCOUNTER_ID", "database": "RAW", "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}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "START_DATE": {"type": "DATE", "index": 4, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 5, "name": "END_DATE", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_ID", "comment": null}, "ORPHAN_CLAIM_FLAG": {"type": "NUMBER", "index": 7, "name": "ORPHAN_CLAIM_FLAG", "comment": null}, "ENCOUNTER_COUNT": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__professional_encounter_id"}, "model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ENCOUNTER_DATA_FOR_MEDICAL_CLAIMS", "database": "RAW", "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}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 7, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 8, "name": "ENCOUNTER_END_DATE", "comment": null}, "ENCOUNTER_ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 9, "name": "ENCOUNTER_ADMIT_SOURCE_CODE", "comment": null}, "ENCOUNTER_ADMIT_TYPE_CODE": {"type": "TEXT", "index": 10, "name": "ENCOUNTER_ADMIT_TYPE_CODE", "comment": null}, "ENCOUNTER_DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 11, "name": "ENCOUNTER_DISCHARGE_DISPOSITION_CODE", "comment": null}, "ORPHAN_CLAIM_FLAG": {"type": "NUMBER", "index": 12, "name": "ORPHAN_CLAIM_FLAG", "comment": null}, "ENCOUNTER_COUNT": {"type": "NUMBER", "index": 13, "name": "ENCOUNTER_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "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.acute_inpatient__encounter_data_for_medical_claims"}, "model.the_tuva_project.service_category__acute_inpatient_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1899008, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.financial_pmpm__patient_spend_with_service_categories": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_PATIENT_SPEND_WITH_SERVICE_CATEGORIES", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.quality_measures__int_nqf0034_exclude_advanced_illness": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_ADVANCED_ILLNESS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_advanced_illness"}, "model.the_tuva_project.emergency_department__int_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_ENCOUNTER_ID", "database": "RAW", "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}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_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.emergency_department__int_encounter_id"}, "model.the_tuva_project.cms_hcc__int_demographic_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DEMOGRAPHIC_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__race": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "RACE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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_nqf0034_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_LONG", "database": "RAW", "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}, "EXCLUSION_DATE": {"type": "DATE", "index": 6, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 7, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 8, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 10, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 11, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 12, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 13, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__ms_drg": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MS_DRG", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 16896, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "seed.the_tuva_project.terminology__claim_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "CLAIM_TYPE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_TYPE": {"type": "TEXT", "index": 1, "name": "CLAIM_TYPE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 35840, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.service_category__ambulatory_surgery_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_AMBULATORY_SURGERY_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_bill_type_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_BILL_TYPE_FINAL", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__medicare_dual_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MEDICARE_DUAL_ELIGIBILITY", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.insights__orphan_claim_by_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "ORPHAN_CLAIM_BY_CLAIM_TYPE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_CATEGORY": {"type": "TEXT", "index": 1, "name": "CLAIM_CATEGORY", "comment": null}, "DISTINCT_CLAIM_COUNT": {"type": "NUMBER", "index": 2, "name": "DISTINCT_CLAIM_COUNT", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__orphan_claim_by_claim_type"}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_DETAIL_STAGE_ELIGIBILITY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "FOREIGN_KEY": {"type": "TEXT", "index": 4, "name": "FOREIGN_KEY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"}, "model.the_tuva_project.service_category__emergency_department_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__combined_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_COMBINED_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__claims_preprocessing_pharmacy_claim_duplicates": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_PHARMACY_CLAIM_DUPLICATES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates"}, "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_ENCOUNTER_START_AND_END_DATES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 2, "name": "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}, "DETERMINED_ENCOUNTER_START_DATE": {"type": "DATE", "index": 5, "name": "DETERMINED_ENCOUNTER_START_DATE", "comment": null}, "DETERMINED_ENCOUNTER_END_DATE": {"type": "DATE", "index": 6, "name": "DETERMINED_ENCOUNTER_END_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__int_encounter_start_and_end_dates"}, "model.the_tuva_project.service_category__lab_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_LAB_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.readmissions__encounter_augmented": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "ENCOUNTER_AUGMENTED", "database": "RAW", "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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__outpatient_rehab_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_REHAB_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__outpatient_hospital_or_clinic_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_HOSPITAL_OR_CLINIC_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "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": "RAW", "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": "NUMBER", "index": 5, "name": "CMS_HCC_V28", "comment": null}, "CMS_HCC_V28_FLAG": {"type": "TEXT", "index": 6, "name": "CMS_HCC_V28_FLAG", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 465920, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.service_category__service_category_grouper": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY_GROUPER", "database": "RAW", "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}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_nqf0034_exclude_hospice_palliative": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_HOSPICE_PALLIATIVE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_hospice_palliative"}, "model.the_tuva_project.acute_inpatient__claims_with_encounter_data": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_CLAIMS_WITH_ENCOUNTER_DATA", "database": "RAW", "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}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_ID", "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}, "ENCOUNTER_ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "ENCOUNTER_ADMIT_SOURCE_CODE", "comment": null}, "ENCOUNTER_ADMIT_TYPE_CODE": {"type": "TEXT", "index": 9, "name": "ENCOUNTER_ADMIT_TYPE_CODE", "comment": null}, "ENCOUNTER_DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 10, "name": "ENCOUNTER_DISCHARGE_DISPOSITION_CODE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__claims_with_encounter_data"}, "seed.the_tuva_project.readmissions__surgery_gynecology_cohort": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_SURGERY_GYNECOLOGY_COHORT", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 28672, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.terminology__code_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "CODE_TYPE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE_TYPE": {"type": "TEXT", "index": 1, "name": "CODE_TYPE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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__code_type"}, "seed.the_tuva_project.cms_hcc__disease_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISEASE_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 24576, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.core__stg_clinical_condition": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_CONDITION", "database": "RAW", "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"}, "seed.the_tuva_project.terminology__revenue_center": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "REVENUE_CENTER", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 8704, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.financial_pmpm__pmpm_payer_plan": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "PMPM_PAYER_PLAN", "database": "RAW", "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_VISIT_PAID": {"type": "NUMBER", "index": 10, "name": "OFFICE_VISIT_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 11, "name": "ANCILLARY_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 12, "name": "PHARMACY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 13, "name": "OTHER_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_PAID": {"type": "NUMBER", "index": 16, "name": "AMBULATORY_SURGERY_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}, "HOSPICE_PAID": {"type": "NUMBER", "index": 21, "name": "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}, "OFFICE_VISIT_PAID_2": {"type": "NUMBER", "index": 25, "name": "OFFICE_VISIT_PAID_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 26, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 27, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 28, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 29, "name": "SKILLED_NURSING_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 30, "name": "URGENT_CARE_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 31, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 32, "name": "MEDICAL_ALLOWED", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 33, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 34, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED": {"type": "NUMBER", "index": 35, "name": "OFFICE_VISIT_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 36, "name": "ANCILLARY_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 37, "name": "PHARMACY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 38, "name": "OTHER_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 39, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 40, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_ALLOWED": {"type": "NUMBER", "index": 41, "name": "AMBULATORY_SURGERY_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 42, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 43, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 44, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 45, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "HOSPICE_ALLOWED": {"type": "NUMBER", "index": 46, "name": "HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 47, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 48, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 49, "name": "LAB_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED_2": {"type": "NUMBER", "index": 50, "name": "OFFICE_VISIT_ALLOWED_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 51, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 52, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 53, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 54, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 55, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 56, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__admit_source": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ADMIT_SOURCE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.service_category__combined_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_COMBINED_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_RESULT_STAGE_ELIGIBILITY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 2, "name": "GRAIN", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 3, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 4, "name": "TEST_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}, "FAILURES": {"type": "NUMBER", "index": 7, "name": "FAILURES", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility"}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_MASTECTOMY", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_ms_drg_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MS_DRG_FINAL", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.acute_inpatient__institutional_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL_CLAIMS", "database": "RAW", "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}, "CLAIM_START_DATE": {"type": "DATE", "index": 3, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 4, "name": "CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 5, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 6, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 9, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 10, "name": "FACILITY_NPI", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 11, "name": "CLAIM_TYPE", "comment": null}, "START_DATE": {"type": "DATE", "index": 12, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 13, "name": "END_DATE", "comment": null}, "DATE_USED_AS_START_DATE": {"type": "TEXT", "index": 14, "name": "DATE_USED_AS_START_DATE", "comment": null}, "DATE_USED_AS_END_DATE": {"type": "TEXT", "index": 15, "name": "DATE_USED_AS_END_DATE", "comment": null}, "DQ_PROBLEM": {"type": "NUMBER", "index": 16, "name": "DQ_PROBLEM", "comment": null}, "DQ_INSIGHT": {"type": "NUMBER", "index": 17, "name": "DQ_INSIGHT", "comment": null}, "START_DATE_NOT_DETERMINED": {"type": "NUMBER", "index": 18, "name": "START_DATE_NOT_DETERMINED", "comment": null}, "END_DATE_NOT_DETERMINED": {"type": "NUMBER", "index": 19, "name": "END_DATE_NOT_DETERMINED", "comment": null}, "START_DATE_AFTER_END_DATE": {"type": "NUMBER", "index": 20, "name": "START_DATE_AFTER_END_DATE", "comment": null}, "PATIENT_ID_NOT_UNIQUE": {"type": "NUMBER", "index": 21, "name": "PATIENT_ID_NOT_UNIQUE", "comment": null}, "PATIENT_ID_MISSING": {"type": "NUMBER", "index": 22, "name": "PATIENT_ID_MISSING", "comment": null}, "CLAIM_START_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 23, "name": "CLAIM_START_DATE_NOT_UNIQUE", "comment": null}, "CLAIM_START_DATE_MISSING": {"type": "NUMBER", "index": 24, "name": "CLAIM_START_DATE_MISSING", "comment": null}, "CLAIM_END_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 25, "name": "CLAIM_END_DATE_NOT_UNIQUE", "comment": null}, "CLAIM_END_DATE_MISSING": {"type": "NUMBER", "index": 26, "name": "CLAIM_END_DATE_MISSING", "comment": null}, "CLAIM_START_DATE_AFTER_CLAIM_END_DATE": {"type": "NUMBER", "index": 27, "name": "CLAIM_START_DATE_AFTER_CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 28, "name": "ADMISSION_DATE_NOT_UNIQUE", "comment": null}, "ADMISSION_DATE_MISSING": {"type": "NUMBER", "index": 29, "name": "ADMISSION_DATE_MISSING", "comment": null}, "DISCHARGE_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 30, "name": "DISCHARGE_DATE_NOT_UNIQUE", "comment": null}, "DISCHARGE_DATE_MISSING": {"type": "NUMBER", "index": 31, "name": "DISCHARGE_DATE_MISSING", "comment": null}, "ADMISSION_DATE_AFTER_DISCHARGE_DATE": {"type": "NUMBER", "index": 32, "name": "ADMISSION_DATE_AFTER_DISCHARGE_DATE", "comment": null}, "ADMIT_TYPE_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 33, "name": "ADMIT_TYPE_CODE_NOT_UNIQUE", "comment": null}, "ADMIT_TYPE_CODE_MISSING": {"type": "NUMBER", "index": 34, "name": "ADMIT_TYPE_CODE_MISSING", "comment": null}, "ADMIT_SOURCE_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 35, "name": "ADMIT_SOURCE_CODE_NOT_UNIQUE", "comment": null}, "ADMIT_SOURCE_CODE_MISSING": {"type": "NUMBER", "index": 36, "name": "ADMIT_SOURCE_CODE_MISSING", "comment": null}, "DISCHARGE_DISPOSITION_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 37, "name": "DISCHARGE_DISPOSITION_CODE_NOT_UNIQUE", "comment": null}, "DISCHARGE_DISPOSITION_CODE_MISSING": {"type": "NUMBER", "index": 38, "name": "DISCHARGE_DISPOSITION_CODE_MISSING", "comment": null}, "FACILITY_NPI_NOT_UNIQUE": {"type": "NUMBER", "index": 39, "name": "FACILITY_NPI_NOT_UNIQUE", "comment": null}, "FACILITY_NPI_MISSING": {"type": "NUMBER", "index": 40, "name": "FACILITY_NPI_MISSING", "comment": null}, "CLAIM_TYPE_NOT_UNIQUE": {"type": "NUMBER", "index": 41, "name": "CLAIM_TYPE_NOT_UNIQUE", "comment": null}, "CLAIM_TYPE_MISSING": {"type": "NUMBER", "index": 42, "name": "CLAIM_TYPE_MISSING", "comment": null}, "CLAIM_TYPE_NOT_INSTITUTIONAL": {"type": "NUMBER", "index": 43, "name": "CLAIM_TYPE_NOT_INSTITUTIONAL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 44, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 45, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__institutional_claims"}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_DATES_INST", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst"}, "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": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIMS_PREPROCESSING_SUMMARY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 2, "name": "TEST_CATEGORY", "comment": null}, "COUNTS": {"type": "NUMBER", "index": 3, "name": "COUNTS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:42UTC", "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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_summary"}, "model.the_tuva_project.core__stg_claims_location": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_LOCATION", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.acute_inpatient__encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_ENCOUNTER_ID", "database": "RAW", "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}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_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.acute_inpatient__encounter_id"}, "model.the_tuva_project.cms_hcc__int_members": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_MEMBERS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_medical_claim_plausibility": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_PLAUSIBILITY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_NAME": {"type": "TEXT", "index": 1, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 2, "name": "PIPELINE_TEST", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 3, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 5, "name": "TEST_CATEGORY", "comment": null}, "GRAIN": {"type": "TEXT", "index": 6, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 7, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "COUNTS": {"type": "NUMBER", "index": 9, "name": "COUNTS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility"}, "model.the_tuva_project.service_category__acute_inpatient_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.core__stg_clinical_practitioner": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_PRACTITIONER", "database": "RAW", "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.ccsr__prccsr_v2023_1_cleaned_map": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "_VALUE_SET_PRCCSR_V2023_1_CLEANED_MAP", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1539584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.quality_measures__int_nqf0034_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_DENOMINATOR", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.cms_hcc__int_enrollment_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_ENROLLMENT_INTERACTION_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__dialysis_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DIALYSIS_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_procedure_code_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_CODE_NORMALIZE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.quality_measures__measures": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_VALUE_SET_MEASURES", "database": "RAW", "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": "NUMBER", "index": 4, "name": "VERSION", "comment": null}, "STEWARD": {"type": "TEXT", "index": 5, "name": "STEWARD", "comment": null}, "COMPATIBLE_MEASURE": {"type": "TEXT", "index": 6, "name": "COMPATIBLE_MEASURE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.quality_measures__int_nqf0034_exclude_colectomy_cancer": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_COLECTOMY_CANCER", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.emergency_department__int_institutional_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_INSTITUTIONAL_CLAIMS", "database": "RAW", "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}, "CLAIM_START_DATE": {"type": "DATE", "index": 3, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 4, "name": "CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 5, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 6, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 9, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 10, "name": "FACILITY_NPI", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 11, "name": "CLAIM_TYPE", "comment": null}, "START_DATE": {"type": "DATE", "index": 12, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 13, "name": "END_DATE", "comment": null}, "DATE_USED_AS_START_DATE": {"type": "TEXT", "index": 14, "name": "DATE_USED_AS_START_DATE", "comment": null}, "DATE_USED_AS_END_DATE": {"type": "TEXT", "index": 15, "name": "DATE_USED_AS_END_DATE", "comment": null}, "DQ_PROBLEM": {"type": "NUMBER", "index": 16, "name": "DQ_PROBLEM", "comment": null}, "DQ_INSIGHT": {"type": "NUMBER", "index": 17, "name": "DQ_INSIGHT", "comment": null}, "START_DATE_NOT_DETERMINED": {"type": "NUMBER", "index": 18, "name": "START_DATE_NOT_DETERMINED", "comment": null}, "END_DATE_NOT_DETERMINED": {"type": "NUMBER", "index": 19, "name": "END_DATE_NOT_DETERMINED", "comment": null}, "START_DATE_AFTER_END_DATE": {"type": "NUMBER", "index": 20, "name": "START_DATE_AFTER_END_DATE", "comment": null}, "PATIENT_ID_NOT_UNIQUE": {"type": "NUMBER", "index": 21, "name": "PATIENT_ID_NOT_UNIQUE", "comment": null}, "PATIENT_ID_MISSING": {"type": "NUMBER", "index": 22, "name": "PATIENT_ID_MISSING", "comment": null}, "CLAIM_START_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 23, "name": "CLAIM_START_DATE_NOT_UNIQUE", "comment": null}, "CLAIM_START_DATE_MISSING": {"type": "NUMBER", "index": 24, "name": "CLAIM_START_DATE_MISSING", "comment": null}, "CLAIM_END_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 25, "name": "CLAIM_END_DATE_NOT_UNIQUE", "comment": null}, "CLAIM_END_DATE_MISSING": {"type": "NUMBER", "index": 26, "name": "CLAIM_END_DATE_MISSING", "comment": null}, "CLAIM_START_DATE_AFTER_CLAIM_END_DATE": {"type": "NUMBER", "index": 27, "name": "CLAIM_START_DATE_AFTER_CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 28, "name": "ADMISSION_DATE_NOT_UNIQUE", "comment": null}, "ADMISSION_DATE_MISSING": {"type": "NUMBER", "index": 29, "name": "ADMISSION_DATE_MISSING", "comment": null}, "DISCHARGE_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 30, "name": "DISCHARGE_DATE_NOT_UNIQUE", "comment": null}, "DISCHARGE_DATE_MISSING": {"type": "NUMBER", "index": 31, "name": "DISCHARGE_DATE_MISSING", "comment": null}, "ADMISSION_DATE_AFTER_DISCHARGE_DATE": {"type": "NUMBER", "index": 32, "name": "ADMISSION_DATE_AFTER_DISCHARGE_DATE", "comment": null}, "ADMIT_TYPE_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 33, "name": "ADMIT_TYPE_CODE_NOT_UNIQUE", "comment": null}, "ADMIT_TYPE_CODE_MISSING": {"type": "NUMBER", "index": 34, "name": "ADMIT_TYPE_CODE_MISSING", "comment": null}, "ADMIT_SOURCE_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 35, "name": "ADMIT_SOURCE_CODE_NOT_UNIQUE", "comment": null}, "ADMIT_SOURCE_CODE_MISSING": {"type": "NUMBER", "index": 36, "name": "ADMIT_SOURCE_CODE_MISSING", "comment": null}, "DISCHARGE_DISPOSITION_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 37, "name": "DISCHARGE_DISPOSITION_CODE_NOT_UNIQUE", "comment": null}, "DISCHARGE_DISPOSITION_CODE_MISSING": {"type": "NUMBER", "index": 38, "name": "DISCHARGE_DISPOSITION_CODE_MISSING", "comment": null}, "FACILITY_NPI_NOT_UNIQUE": {"type": "NUMBER", "index": 39, "name": "FACILITY_NPI_NOT_UNIQUE", "comment": null}, "FACILITY_NPI_MISSING": {"type": "NUMBER", "index": 40, "name": "FACILITY_NPI_MISSING", "comment": null}, "CLAIM_TYPE_NOT_UNIQUE": {"type": "NUMBER", "index": 41, "name": "CLAIM_TYPE_NOT_UNIQUE", "comment": null}, "CLAIM_TYPE_MISSING": {"type": "NUMBER", "index": 42, "name": "CLAIM_TYPE_MISSING", "comment": null}, "CLAIM_TYPE_NOT_INSTITUTIONAL": {"type": "NUMBER", "index": 43, "name": "CLAIM_TYPE_NOT_INSTITUTIONAL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 44, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 45, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__int_institutional_claims"}, "model.the_tuva_project.quality_measures__summary_wide": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "SUMMARY_WIDE", "database": "RAW", "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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.data_quality__test_catalog": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_TEST_CATALOG", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 2, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 3, "name": "TEST_NAME", "comment": null}, "TEST_FIELD": {"type": "TEXT", "index": 4, "name": "TEST_FIELD", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 7168, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 297, "include": true, "description": "An approximate count of rows in this table"}, "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__test_catalog"}, "model.the_tuva_project.data_quality__claims_preprocessing_use_case": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIMS_PREPROCESSING_USE_CASE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"USE_CASE": {"type": "TEXT", "index": 1, "name": "USE_CASE", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 2, "name": "SOURCE_TABLE", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 3, "name": "TEST_NAME", "comment": null}, "FAILURES": {"type": "NUMBER", "index": 4, "name": "FAILURES", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 5, "name": "DENOMINATOR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_use_case"}, "model.the_tuva_project.ed_classification__summary": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "SUMMARY", "database": "RAW", "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": "NUMBER", "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_NPI": {"type": "TEXT", "index": 12, "name": "FACILITY_NPI", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__other_provider_taxonomy": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "OTHER_PROVIDER_TAXONOMY", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 68820480, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 9488588, "include": true, "description": "An approximate count of rows in this table"}, "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.ccsr__singular_condition_category": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "SINGULAR_CONDITION_CATEGORY", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_test_detail": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIMS_PREPROCESSING_TEST_DETAIL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 2, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 3, "name": "TEST_NAME", "comment": null}, "GRAIN": {"type": "TEXT", "index": 4, "name": "GRAIN", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}, "FOREIGN_KEY": {"type": "TEXT", "index": 7, "name": "FOREIGN_KEY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.cms_hcc__patient_risk_scores": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "PATIENT_RISK_SCORES", "database": "RAW", "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_YEAR": {"type": "NUMBER", "index": 7, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.chronic_conditions__tuva_chronic_conditions_wide": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "TUVA_CHRONIC_CONDITIONS_WIDE", "database": "RAW", "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}, "ALCOHOL": {"type": "NUMBER", "index": 3, "name": "ALCOHOL", "comment": null}, "ALZHEIMERS_DISEASE": {"type": "NUMBER", "index": 4, "name": "ALZHEIMERS_DISEASE", "comment": null}, "AMYOTROPHIC_LATERAL_SCLEROSIS": {"type": "NUMBER", "index": 5, "name": "AMYOTROPHIC_LATERAL_SCLEROSIS", "comment": null}, "ANXIETY": {"type": "NUMBER", "index": 6, "name": "ANXIETY", "comment": null}, "ASTHMA": {"type": "NUMBER", "index": 7, "name": "ASTHMA", "comment": null}, "ATHEROSCLEROSIS": {"type": "NUMBER", "index": 8, "name": "ATHEROSCLEROSIS", "comment": null}, "ATRIAL_FIBRILLATION": {"type": "NUMBER", "index": 9, "name": "ATRIAL_FIBRILLATION", "comment": null}, "ATTENTION_DEFICIT_HYPERACTIVITY_DISORDER": {"type": "NUMBER", "index": 10, "name": "ATTENTION_DEFICIT_HYPERACTIVITY_DISORDER", "comment": null}, "BIPOLAR": {"type": "NUMBER", "index": 11, "name": "BIPOLAR", "comment": null}, "BREAST_CANCER": {"type": "NUMBER", "index": 12, "name": "BREAST_CANCER", "comment": null}, "CHRONIC_KIDNEY_DISEASE": {"type": "NUMBER", "index": 13, "name": "CHRONIC_KIDNEY_DISEASE", "comment": null}, "CHRONIC_OBSTRUCTIVE_PULMONARY_DISEASE": {"type": "NUMBER", "index": 14, "name": "CHRONIC_OBSTRUCTIVE_PULMONARY_DISEASE", "comment": null}, "COCAINE": {"type": "NUMBER", "index": 15, "name": "COCAINE", "comment": null}, "COLORECTAL_CANCER": {"type": "NUMBER", "index": 16, "name": "COLORECTAL_CANCER", "comment": null}, "CROHNS_DISEASE": {"type": "NUMBER", "index": 17, "name": "CROHNS_DISEASE", "comment": null}, "CYSTIC_FIBROSIS": {"type": "NUMBER", "index": 18, "name": "CYSTIC_FIBROSIS", "comment": null}, "DEMENTIA": {"type": "NUMBER", "index": 19, "name": "DEMENTIA", "comment": null}, "DEPRESSION": {"type": "NUMBER", "index": 20, "name": "DEPRESSION", "comment": null}, "HEART_FAILURE": {"type": "NUMBER", "index": 21, "name": "HEART_FAILURE", "comment": null}, "HYPERLIPIDEMIA": {"type": "NUMBER", "index": 22, "name": "HYPERLIPIDEMIA", "comment": null}, "HYPERTENSION": {"type": "NUMBER", "index": 23, "name": "HYPERTENSION", "comment": null}, "LUNG_CANCER": {"type": "NUMBER", "index": 24, "name": "LUNG_CANCER", "comment": null}, "LUPUS": {"type": "NUMBER", "index": 25, "name": "LUPUS", "comment": null}, "METABOLIC_SYNDROME": {"type": "NUMBER", "index": 26, "name": "METABOLIC_SYNDROME", "comment": null}, "MULTIPLE_SCLEROSIS": {"type": "NUMBER", "index": 27, "name": "MULTIPLE_SCLEROSIS", "comment": null}, "MUSCULAR_DYSTROPHY": {"type": "NUMBER", "index": 28, "name": "MUSCULAR_DYSTROPHY", "comment": null}, "OBESITY": {"type": "NUMBER", "index": 29, "name": "OBESITY", "comment": null}, "OBSESSIVE_COMPULSIVE_DISORDER": {"type": "NUMBER", "index": 30, "name": "OBSESSIVE_COMPULSIVE_DISORDER", "comment": null}, "OPIOID": {"type": "NUMBER", "index": 31, "name": "OPIOID", "comment": null}, "PARKINSONS_DISEASE": {"type": "NUMBER", "index": 32, "name": "PARKINSONS_DISEASE", "comment": null}, "PERSONALITY_DISORDER": {"type": "NUMBER", "index": 33, "name": "PERSONALITY_DISORDER", "comment": null}, "POST_TRAUMATIC_STRESS_DISORDER": {"type": "NUMBER", "index": 34, "name": "POST_TRAUMATIC_STRESS_DISORDER", "comment": null}, "RHEUMATOID_ARTHRITIS": {"type": "NUMBER", "index": 35, "name": "RHEUMATOID_ARTHRITIS", "comment": null}, "SCHIZOPHRENIA": {"type": "NUMBER", "index": 36, "name": "SCHIZOPHRENIA", "comment": null}, "STROKE": {"type": "NUMBER", "index": 37, "name": "STROKE", "comment": null}, "TOBACCO": {"type": "NUMBER", "index": 38, "name": "TOBACCO", "comment": null}, "TYPE_1_DIABETES": {"type": "NUMBER", "index": 39, "name": "TYPE_1_DIABETES", "comment": null}, "TYPE_2_DIABETES": {"type": "NUMBER", "index": 40, "name": "TYPE_2_DIABETES", "comment": null}, "ULCERATIVE_COLITIS": {"type": "NUMBER", "index": 41, "name": "ULCERATIVE_COLITIS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.financial_pmpm__service_category_2_allowed_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_2_ALLOWED_PIVOT", "database": "RAW", "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_ALLOWED": {"type": "NUMBER", "index": 8, "name": "AMBULATORY_SURGERY_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}, "HOSPICE_ALLOWED": {"type": "NUMBER", "index": 13, "name": "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}, "OFFICE_VISIT_ALLOWED": {"type": "NUMBER", "index": 17, "name": "OFFICE_VISIT_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 18, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 19, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 20, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 21, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 22, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 23, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.readmissions__readmission_crude": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_READMISSION_CRUDE", "database": "RAW", "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.hcc_suspecting__int_patient_hcc_history": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_PATIENT_HCC_HISTORY", "database": "RAW", "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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__outpatient_psychiatric_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_PSYCHIATRIC_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.financial_pmpm__service_category_2_paid_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_2_PAID_PIVOT", "database": "RAW", "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_PAID": {"type": "NUMBER", "index": 8, "name": "AMBULATORY_SURGERY_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}, "HOSPICE_PAID": {"type": "NUMBER", "index": 13, "name": "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}, "OFFICE_VISIT_PAID": {"type": "NUMBER", "index": 17, "name": "OFFICE_VISIT_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 18, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 19, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 20, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 21, "name": "SKILLED_NURSING_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 22, "name": "URGENT_CARE_PAID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 23, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__claims_preprocessing_medical_claim_prof_missing_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_PROF_MISSING_VALUES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values"}, "model.the_tuva_project.quality_measures__int_nqf2372_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_LONG", "database": "RAW", "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}, "EXCLUSION_DATE": {"type": "DATE", "index": 6, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 7, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 8, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 10, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 11, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 12, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 13, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.chronic_conditions__cms_chronic_conditions_all": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_INT_CMS_CHRONIC_CONDITION_ALL", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.insights__trend_count_claim_by_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "TREND_COUNT_CLAIM_BY_CLAIM_TYPE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "DISTINCT_CLAIM_COUNT": {"type": "NUMBER", "index": 3, "name": "DISTINCT_CLAIM_COUNT", "comment": null}, "DISTINCT_CLAIM_COUNT_CHANGE": {"type": "NUMBER", "index": 4, "name": "DISTINCT_CLAIM_COUNT_CHANGE", "comment": null}, "DISTINCT_CLAIM_PERCENTAGE_CHANGE": {"type": "NUMBER", "index": 5, "name": "DISTINCT_CLAIM_PERCENTAGE_CHANGE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_claim_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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.hcc_suspecting__int_all_conditions": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_ALL_CONDITIONS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.cms_hcc__disease_hierarchy": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISEASE_HIERARCHY", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.quality_measures__int_nqf2372_exclude_dementia": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_DEMENTIA", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_dementia"}, "model.the_tuva_project.insights__trend_sum_amount_by_service_category": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "TREND_SUM_AMOUNT_BY_SERVICE_CATEGORY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "SERVICE_CATEGORY_TYPE": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_TYPE", "comment": null}, "SERVICE_CATEGORY": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 4, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_PAID_AMOUNT_CHANGE": {"type": "NUMBER", "index": 5, "name": "TOTAL_PAID_AMOUNT_CHANGE", "comment": null}, "TOTAL_PAID_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 6, "name": "TOTAL_PAID_AMOUNT_PERCENT_CHANGE", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 7, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT_CHANGE": {"type": "NUMBER", "index": 8, "name": "TOTAL_ALLOWED_AMOUNT_CHANGE", "comment": null}, "TOTAL_ALLOWED_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 9, "name": "TOTAL_ALLOWED_AMOUNT_PERCENT_CHANGE", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 10, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT_CHANGE": {"type": "NUMBER", "index": 11, "name": "TOTAL_CHARGE_AMOUNT_CHANGE", "comment": null}, "TOTAL_CHARGE_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 12, "name": "TOTAL_CHARGE_AMOUNT_PERCENT_CHANGE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_service_category"}, "seed.the_tuva_project.terminology__hcpcs_level_2": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "HCPCS_LEVEL_2", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 368640, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 7501, "include": true, "description": "An approximate count of rows in this table"}, "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.core__stg_claims_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_ELIGIBILITY", "database": "RAW", "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}, "BIRTH_DATE": {"type": "DATE", "index": 3, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 4, "name": "DEATH_DATE", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 5, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 6, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 7, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 8, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 9, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 10, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 11, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 12, "name": "MEDICARE_STATUS_CODE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 13, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_undetermined_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_UNDETERMINED_CLAIM_TYPE", "database": "RAW", "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}, "BILLING_NPI": {"type": "TEXT", "index": 30, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 31, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 32, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 33, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 34, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 35, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 36, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 37, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 39, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 40, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 41, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 91, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 92, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 117, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 118, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 142, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 143, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__icd_9_pcs": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_9_PCS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 105984, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.data_quality__claims_preprocessing_claim_type_unmapped": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_CLAIM_TYPE_UNMAPPED", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1416192, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "seed.the_tuva_project.terminology__encounter_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ENCOUNTER_TYPE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_TYPE": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_TYPE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.emergency_department__int_professional_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_PROFESSIONAL_ENCOUNTER_ID", "database": "RAW", "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}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "START_DATE": {"type": "DATE", "index": 4, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 5, "name": "END_DATE", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_ID", "comment": null}, "ORPHAN_CLAIM_FLAG": {"type": "NUMBER", "index": 7, "name": "ORPHAN_CLAIM_FLAG", "comment": null}, "ENCOUNTER_COUNT": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__int_professional_encounter_id"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__loinc_deprecated_mapping": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "LOINC_DEPRECATED_MAPPING", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 97280, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "seed.input_layer.lab_result_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "LAB_RESULT_SEED", "database": "RAW", "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}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.readmissions__planned_encounter": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_PLANNED_ENCOUNTER", "database": "RAW", "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"}, "seed.the_tuva_project.cms_hcc__cpt_hcpcs": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_CPT_HCPCS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 94208, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.readmissions__index_time_requirement": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_INDEX_TIME_REQUIREMENT", "database": "RAW", "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__encounter": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER", "database": "RAW", "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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "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.ccsr__long_procedure_category": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "LONG_PROCEDURE_CATEGORY", "database": "RAW", "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}, "NORMALIZED_CODE": {"type": "TEXT", "index": 3, "name": "NORMALIZED_CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "CODE_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 5, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 6, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CLINICAL_DOMAIN": {"type": "TEXT", "index": 8, "name": "CLINICAL_DOMAIN", "comment": null}, "PRCCSR_VERSION": {"type": "TEXT", "index": 9, "name": "PRCCSR_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_ms_drg_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MS_DRG_VOTING", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_hcc_count_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_HCC_COUNT_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.insights__trend_count_claim_by_service_category": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "TREND_COUNT_CLAIM_BY_SERVICE_CATEGORY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "SERVICE_CATEGORY": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY", "comment": null}, "DISTINCT_CLAIM_COUNT": {"type": "NUMBER", "index": 3, "name": "DISTINCT_CLAIM_COUNT", "comment": null}, "DISTINCT_CLAIM_COUNT_CHANGE": {"type": "NUMBER", "index": 4, "name": "DISTINCT_CLAIM_COUNT_CHANGE", "comment": null}, "DISTINCT_CLAIM_PERCENTAGE_CHANGE": {"type": "NUMBER", "index": 5, "name": "DISTINCT_CLAIM_PERCENTAGE_CHANGE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_service_category"}, "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_EXCLUSION_CCS_DIAGNOSIS_CATEGORY", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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__claims_preprocessing_pharmacy_claim_line_numbers": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_PHARMACY_CLAIM_LINE_NUMBERS", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers"}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_DUPLICATES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates"}, "model.the_tuva_project.emergency_department__int_last_claim_values": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_LAST_CLAIM_VALUES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_START": {"type": "DATE", "index": 2, "name": "CLAIM_START", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 3, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "CLAIM_ROW": {"type": "NUMBER", "index": 4, "name": "CLAIM_ROW", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__int_last_claim_values"}, "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_ELIGIBILITY_PLAUSIBILITY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_NAME": {"type": "TEXT", "index": 1, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 2, "name": "PIPELINE_TEST", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 3, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 5, "name": "TEST_CATEGORY", "comment": null}, "GRAIN": {"type": "TEXT", "index": 6, "name": "GRAIN", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 7, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility"}, "model.the_tuva_project.core__stg_claims_condition": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_CONDITION", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_medical_claim_date_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MEDICAL_CLAIM_DATE_NORMALIZE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__claims_preprocessing_medical_claim_invalid_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_INVALID_VALUES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_NAME": {"type": "TEXT", "index": 1, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 2, "name": "PIPELINE_TEST", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 3, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 5, "name": "TEST_CATEGORY", "comment": null}, "GRAIN": {"type": "TEXT", "index": 6, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 7, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "FILLED_ROW_COUNT": {"type": "NUMBER", "index": 9, "name": "FILLED_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values"}, "model.the_tuva_project.medical_claim_expanded": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_EXPANDED", "name": "MEDICAL_CLAIM_EXPANDED", "database": "RAW", "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}, "BILLING_NPI": {"type": "TEXT", "index": 30, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 31, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 32, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 33, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 34, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 35, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 36, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 37, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 39, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 40, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 41, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 91, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 92, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 117, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 118, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 142, "name": "DATA_SOURCE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.input_layer.pharmacy_claim_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "PHARMACY_CLAIM_SEED", "database": "RAW", "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}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 17, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 19, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.chronic_conditions__cms_chronic_conditions_wide": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "CMS_CHRONIC_CONDITIONS_WIDE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__emergency_department_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.core__stg_claims_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_MEDICAL_CLAIM", "database": "RAW", "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": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 5, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 6, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 7, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 8, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 13, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 14, "name": "DISCHARGE_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 15, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 16, "name": "SERVICE_CATEGORY_2", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 17, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 18, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 19, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 21, "name": "BILL_TYPE_CODE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 23, "name": "APR_DRG_CODE", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 24, "name": "REVENUE_CENTER_CODE", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 25, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 26, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 27, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 28, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 29, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 30, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 31, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 32, "name": "RENDERING_NPI", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 33, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 34, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 35, "name": "PAID_DATE", "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}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 39, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 40, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 41, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 42, "name": "TOTAL_COST_AMOUNT", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__lab_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_LAB_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.input_layer.medical_claim_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "MEDICAL_CLAIM_SEED", "database": "RAW", "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}, "BILLING_NPI": {"type": "TEXT", "index": 30, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 31, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 32, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 33, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 34, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 35, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 36, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 37, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 39, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 40, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 41, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 91, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 92, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 117, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 118, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 142, "name": "DATA_SOURCE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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__admit_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ADMIT_TYPE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.core__stg_clinical_patient": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_PATIENT", "database": "RAW", "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}, "ADDRESS": {"type": "TEXT", "index": 9, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 10, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 11, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 12, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 13, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 14, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 15, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 17, "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"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.service_category__hospice_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_HOSPICE_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__hospice_institutional"}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_DETAIL_STAGE_MEDICAL_CLAIM", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "FOREIGN_KEY": {"type": "TEXT", "index": 4, "name": "FOREIGN_KEY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"}, "seed.the_tuva_project.terminology__ethnicity": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ETHNICITY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 89088, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.chronic_conditions__tuva_chronic_conditions_long": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "TUVA_CHRONIC_CONDITIONS_LONG", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CONDITION_FAMILY": {"type": "TEXT", "index": 2, "name": "CONDITION_FAMILY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 3, "name": "CONDITION", "comment": null}, "FIRST_DIAGNOSIS_DATE": {"type": "DATE", "index": 4, "name": "FIRST_DIAGNOSIS_DATE", "comment": null}, "LAST_DIAGNOSIS_DATE": {"type": "DATE", "index": 5, "name": "LAST_DIAGNOSIS_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_revenue_center_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_REVENUE_CENTER_NORMALIZE", "database": "RAW", "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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.acute_inpatient__encounter_start_and_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_ENCOUNTER_START_AND_END_DATES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 2, "name": "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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_start_and_end_dates"}, "model.the_tuva_project.core__eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "ELIGIBILITY", "database": "RAW", "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}, "BIRTH_DATE": {"type": "DATE", "index": 3, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 4, "name": "DEATH_DATE", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 5, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 6, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 7, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 8, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 9, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 10, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 11, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 12, "name": "MEDICARE_STATUS_CODE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 13, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__hospice_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_HOSPICE_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__hospice_professional"}, "seed.the_tuva_project.terminology__icd_10_cm": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_10_CM", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1063936, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 74044, "include": true, "description": "An approximate count of rows in this table"}, "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"}, "seed.the_tuva_project.terminology__ansi_fips_state": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ANSI_FIPS_STATE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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__ansi_fips_state"}, "model.the_tuva_project.core__observation": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "OBSERVATION", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.core__stg_claims_encounter": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_ENCOUNTER", "database": "RAW", "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}, "FACILITY_NPI": {"type": "TEXT", "index": 14, "name": "FACILITY_NPI", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 15, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 16, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 18, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 26, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.quality_measures__concepts": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_VALUE_SET_CONCEPTS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.hcc_suspecting__int_prep_conditions": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_PREP_CONDITIONS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.cms_hcc__enrollment_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_ENROLLMENT_INTERACTION_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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"}, "seed.the_tuva_project.terminology__ndc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "NDC", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 7451136, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 823967, "include": true, "description": "An approximate count of rows in this table"}, "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"}, "seed.the_tuva_project.terminology__present_on_admission": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PRESENT_ON_ADMISSION", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.acute_inpatient__institutional_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL_ENCOUNTER_ID", "database": "RAW", "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}, "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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "comment": null}, "ROW_NUM": {"type": "NUMBER", "index": 7, "name": "ROW_NUM", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 8, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 9, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 10, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "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.acute_inpatient__institutional_encounter_id"}, "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_PHARMACY_CLAIM_MISSING_VALUES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values"}, "model.the_tuva_project.financial_pmpm__member_months": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "MEMBER_MONTHS", "database": "RAW", "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}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__member_months"}, "model.the_tuva_project.core__stg_claims_procedure": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PROCEDURE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.quality_measures__summary_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "SUMMARY_LONG", "database": "RAW", "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}, "PERFORMANCE_FLAG": {"type": "NUMBER", "index": 6, "name": "PERFORMANCE_FLAG", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__bill_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "BILL_TYPE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 22016, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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_observation": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_OBSERVATION", "database": "RAW", "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__duplicate_bill_types": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DUPLICATE_BILL_TYPES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CNT": {"type": "NUMBER", "index": 2, "name": "CNT", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__duplicate_bill_types"}, "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_CLAIM_TYPE_MAPPING_FAILURES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures"}, "model.the_tuva_project.cms_hcc__int_disease_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DISEASE_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__adjustment_rates": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_ADJUSTMENT_RATES", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.ed_classification__int_filter_encounter_with_classification": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_INT_FILTER_ENCOUNTER_WITH_CLASSIFICATION", "database": "RAW", "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_NPI": {"type": "TEXT", "index": 5, "name": "FACILITY_NPI", "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": "FLOAT", "index": 12, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "FLOAT", "index": 13, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "FLOAT", "index": 14, "name": "EPCT", "comment": null}, "NONER": {"type": "FLOAT", "index": 15, "name": "NONER", "comment": null}, "INJURY": {"type": "NUMBER", "index": 16, "name": "INJURY", "comment": null}, "PSYCH": {"type": "NUMBER", "index": 17, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "NUMBER", "index": 18, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "NUMBER", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.core__stg_claims_practitioner": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PRACTITIONER", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.core__medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "MEDICAL_CLAIM", "database": "RAW", "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": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 5, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 6, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 7, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 8, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 13, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 14, "name": "DISCHARGE_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 15, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 16, "name": "SERVICE_CATEGORY_2", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 17, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 18, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 19, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 21, "name": "BILL_TYPE_CODE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 23, "name": "APR_DRG_CODE", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 24, "name": "REVENUE_CENTER_CODE", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 25, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 26, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 27, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 28, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 29, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 30, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 31, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 32, "name": "RENDERING_NPI", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 33, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 34, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 35, "name": "PAID_DATE", "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}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 39, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 40, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 41, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 42, "name": "TOTAL_COST_AMOUNT", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.core__stg_clinical_encounter": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_ENCOUNTER", "database": "RAW", "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}, "FACILITY_NPI": {"type": "TEXT", "index": 14, "name": "FACILITY_NPI", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 15, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 16, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 18, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 26, "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.cms_hcc__int_hcc_mapping": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_HCC_MAPPING", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_medical_date_aggregation": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MEDICAL_DATE_AGGREGATION", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__claims_preprocessing_test_result": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIMS_PREPROCESSING_TEST_RESULT", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 2, "name": "GRAIN", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 3, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 4, "name": "TEST_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}, "FAILURES": {"type": "NUMBER", "index": 7, "name": "FAILURES", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result"}, "model.the_tuva_project.core__patient": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PATIENT", "database": "RAW", "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}, "ADDRESS": {"type": "TEXT", "index": 9, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 10, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 11, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 12, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 13, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 14, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 15, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.terminology__gender": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "GENDER", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"GENDER": {"type": "TEXT", "index": 1, "name": "GENDER", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.normalized_input__int_present_on_admit_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PRESENT_ON_ADMIT_FINAL", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__medicare_orec": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MEDICARE_OREC", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 34304, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "seed.the_tuva_project.ed_classification__johnston_icd9": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_JOHNSTON_ICD9", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD9": {"type": "TEXT", "index": 1, "name": "ICD9", "comment": null}, "EDCNNPA": {"type": "FLOAT", "index": 2, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "FLOAT", "index": 3, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "FLOAT", "index": 4, "name": "EPCT", "comment": null}, "NONER": {"type": "FLOAT", "index": 5, "name": "NONER", "comment": null}, "INJURY": {"type": "NUMBER", "index": 6, "name": "INJURY", "comment": null}, "PSYCH": {"type": "NUMBER", "index": 7, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "NUMBER", "index": 8, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "NUMBER", "index": 9, "name": "DRUG", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 57344, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.quality_measures__int_nqf2372_exclude_advanced_illness": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_ADVANCED_ILLNESS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_advanced_illness"}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_DETAIL_STAGE_PHARMACY_CLAIM", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "FOREIGN_KEY": {"type": "TEXT", "index": 4, "name": "FOREIGN_KEY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"}, "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_INSTITUTIONAL_SNP", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_institutional_snp"}, "model.the_tuva_project.service_category__home_health_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_HOME_HEALTH_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_eligibility_invalid_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_ELIGIBILITY_INVALID_VALUES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_NAME": {"type": "TEXT", "index": 1, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 2, "name": "PIPELINE_TEST", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 3, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 5, "name": "TEST_CATEGORY", "comment": null}, "GRAIN": {"type": "TEXT", "index": 6, "name": "GRAIN", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 7, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "GENDER": {"type": "TEXT", "index": 9, "name": "GENDER", "comment": null}, "FILLED_ROW_COUNT": {"type": "NUMBER", "index": 10, "name": "FILLED_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"}, "model.the_tuva_project.readmissions__encounter_overlap": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_OVERLAP", "database": "RAW", "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.insights__count_claim_by_service_category": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "COUNT_CLAIM_BY_SERVICE_CATEGORY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SERVICE_CATEGORY_TYPE": {"type": "TEXT", "index": 1, "name": "SERVICE_CATEGORY_TYPE", "comment": null}, "SERVICE_CATEGORY": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY", "comment": null}, "DISTINCT_CLAIM_COUNT": {"type": "NUMBER", "index": 3, "name": "DISTINCT_CLAIM_COUNT", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__count_claim_by_service_category"}, "model.the_tuva_project.ccsr__dx_vertical_pivot": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "DX_VERTICAL_PIVOT", "database": "RAW", "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": "BOOLEAN", "index": 7, "name": "IS_IP_DEFAULT_CATEGORY", "comment": null}, "IS_OP_DEFAULT_CATEGORY": {"type": "BOOLEAN", "index": 8, "name": "IS_OP_DEFAULT_CATEGORY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2389504, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:42UTC", "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"}, "has_stats": {"id": "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.core__encounter": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "ENCOUNTER", "database": "RAW", "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}, "FACILITY_NPI": {"type": "TEXT", "index": 14, "name": "FACILITY_NPI", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 15, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 16, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 18, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 26, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__rxnorm_to_atc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "RXNORM_TO_ATC", "database": "RAW", "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_NAME": {"type": "TEXT", "index": 3, "name": "ATC_1_NAME", "comment": null}, "ATC_2_NAME": {"type": "TEXT", "index": 4, "name": "ATC_2_NAME", "comment": null}, "ATC_3_NAME": {"type": "TEXT", "index": 5, "name": "ATC_3_NAME", "comment": null}, "ATC_4_NAME": {"type": "TEXT", "index": 6, "name": "ATC_4_NAME", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 949248, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 23989, "include": true, "description": "An approximate count of rows in this table"}, "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"}, "seed.the_tuva_project.terminology__fips_county": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "FIPS_COUNTY", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 31232, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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__fips_county"}, "model.the_tuva_project.service_category__dq_input_layer_tests": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_DQ_INPUT_LAYER_TESTS", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DQ_PROBLEM": {"type": "TEXT", "index": 2, "name": "DQ_PROBLEM", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__dq_input_layer_tests"}, "model.the_tuva_project.readmissions__encounter_specialty_cohort": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_SPECIALTY_COHORT", "database": "RAW", "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.core__stg_clinical_lab_result": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_LAB_RESULT", "database": "RAW", "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}, "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.financial_pmpm__service_category_1_paid_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_1_PAID_PIVOT", "database": "RAW", "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_VISIT_PAID": {"type": "NUMBER", "index": 8, "name": "OFFICE_VISIT_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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_admit_source_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ADMIT_SOURCE_VOTING", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.ed_classification__int_map_primary_dx": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_INT_BY_PROVIDER_PARENT_ORGANIZATION", "database": "RAW", "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_NPI": {"type": "TEXT", "index": 5, "name": "FACILITY_NPI", "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": "FLOAT", "index": 12, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "FLOAT", "index": 13, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "FLOAT", "index": 14, "name": "EPCT", "comment": null}, "NONER": {"type": "FLOAT", "index": 15, "name": "NONER", "comment": null}, "INJURY": {"type": "NUMBER", "index": 16, "name": "INJURY", "comment": null}, "PSYCH": {"type": "NUMBER", "index": 17, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "NUMBER", "index": 18, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "NUMBER", "index": 19, "name": "DRUG", "comment": null}, "ED_CLASSIFICATION_CAPTURE": {"type": "NUMBER", "index": 20, "name": "ED_CLASSIFICATION_CAPTURE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.normalized_input__int_diagnosis_code_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DIAGNOSIS_CODE_VOTING", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.core__condition": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "CONDITION", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_long": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "CMS_CHRONIC_CONDITIONS_LONG", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.acute_inpatient__summary": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ACUTE_INPATIENT_SUMMARY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "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_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 5, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 6, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 7, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 8, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 11, "name": "FACILITY_NPI", "comment": null}, "PROVIDER_FIRST_NAME": {"type": "TEXT", "index": 12, "name": "PROVIDER_FIRST_NAME", "comment": null}, "PROVIDER_LAST_NAME": {"type": "TEXT", "index": 13, "name": "PROVIDER_LAST_NAME", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 14, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 16, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 17, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 19, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 21, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 23, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "FLOAT", "index": 25, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "FLOAT", "index": 26, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "FLOAT", "index": 27, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 28, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 29, "name": "MORTALITY_FLAG", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__summary"}, "model.the_tuva_project.insights__count_claim_by_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "COUNT_CLAIM_BY_CLAIM_TYPE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_TYPE": {"type": "TEXT", "index": 1, "name": "CLAIM_TYPE", "comment": null}, "DISTINCT_CLAIM_COUNT": {"type": "NUMBER", "index": 2, "name": "DISTINCT_CLAIM_COUNT", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:43UTC", "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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__count_claim_by_claim_type"}, "model.the_tuva_project.normalized_input__pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "NORMALIZED_INPUT_PHARMACY_CLAIM", "database": "RAW", "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": "NUMBER", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 17, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 19, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 21, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__medicare_status": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MEDICARE_STATUS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "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": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "NUMBER", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 147456, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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"}, "model.the_tuva_project.cms_hcc__int_disease_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DISEASE_INTERACTION_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__ssa_fips_state": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "SSA_FIPS_STATE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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__ssa_fips_state"}, "model.the_tuva_project.normalized_input__eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "NORMALIZED_INPUT_ELIGIBILITY", "database": "RAW", "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}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 4, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 5, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 6, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 7, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 8, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 11, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 12, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 13, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 14, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 16, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 17, "name": "LAST_NAME", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 18, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 19, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 20, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 21, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 22, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 23, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 24, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__inpatient_rehab_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_REHAB_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.quality_measures__int_nqf0034__frailty": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034__FRAILTY", "database": "RAW", "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}, "CONCEPT_NAME": {"type": "TEXT", "index": 3, "name": "CONCEPT_NAME", "comment": null}}, "stats": {"has_stats": {"id": "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__frailty"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.financial_pmpm__pmpm_payer": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "PMPM_PAYER", "database": "RAW", "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_VISIT_PAID": {"type": "NUMBER", "index": 9, "name": "OFFICE_VISIT_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 10, "name": "ANCILLARY_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 11, "name": "PHARMACY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 12, "name": "OTHER_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_PAID": {"type": "NUMBER", "index": 15, "name": "AMBULATORY_SURGERY_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}, "HOSPICE_PAID": {"type": "NUMBER", "index": 20, "name": "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}, "OFFICE_VISIT_PAID_2": {"type": "NUMBER", "index": 24, "name": "OFFICE_VISIT_PAID_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 25, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 26, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 27, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 28, "name": "SKILLED_NURSING_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 29, "name": "URGENT_CARE_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 30, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 31, "name": "MEDICAL_ALLOWED", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 32, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 33, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED": {"type": "NUMBER", "index": 34, "name": "OFFICE_VISIT_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 35, "name": "ANCILLARY_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 36, "name": "PHARMACY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 37, "name": "OTHER_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 38, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 39, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_ALLOWED": {"type": "NUMBER", "index": 40, "name": "AMBULATORY_SURGERY_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 41, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 42, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 43, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 44, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "HOSPICE_ALLOWED": {"type": "NUMBER", "index": 45, "name": "HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 46, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 47, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 48, "name": "LAB_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED_2": {"type": "NUMBER", "index": 49, "name": "OFFICE_VISIT_ALLOWED_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 50, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 51, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 52, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 53, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 54, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 55, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_present_on_admit_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PRESENT_ON_ADMIT_NORMALIZE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__home_health_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_HOME_HEALTH_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__place_of_service": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PLACE_OF_SERVICE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.quality_measures__int_nqf0034__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034__PERFORMANCE_PERIOD", "database": "RAW", "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__claims_preprocessing_professional_header_fail_details": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_PROFESSIONAL_HEADER_FAIL_DETAILS", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_INT_CMS_CHRONIC_CONDITION_OUD", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__loinc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "LOINC", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 4118528, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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__claims_preprocessing_test_result_stage_pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_RESULT_STAGE_PHARMACY_CLAIM", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 2, "name": "GRAIN", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 3, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 4, "name": "TEST_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}, "FAILURES": {"type": "NUMBER", "index": 7, "name": "FAILURES", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim"}, "model.the_tuva_project.core__stg_claims_pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PHARMACY_CLAIM", "database": "RAW", "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": "NUMBER", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 17, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 19, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 21, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_eligibility_missing_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_ELIGIBILITY_MISSING_VALUES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values"}, "seed.the_tuva_project.terminology__apr_drg": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "APR_DRG", "database": "RAW", "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_CDOE": {"type": "NUMBER", "index": 3, "name": "MDC_CDOE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "APR_DRG_DESCRIPTION", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 8704, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.normalized_input__int_discharge_disposition_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DISCHARGE_DISPOSITION_FINAL", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.cms_hcc__demographic_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DEMOGRAPHIC_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 13312, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.service_category__dme_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DME_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.ed_classification__johnston_icd10": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_JOHNSTON_ICD10", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD10": {"type": "TEXT", "index": 1, "name": "ICD10", "comment": null}, "EDCNNPA": {"type": "FLOAT", "index": 2, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "FLOAT", "index": 3, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "FLOAT", "index": 4, "name": "EPCT", "comment": null}, "NONER": {"type": "FLOAT", "index": 5, "name": "NONER", "comment": null}, "INJURY": {"type": "NUMBER", "index": 6, "name": "INJURY", "comment": null}, "PSYCH": {"type": "NUMBER", "index": 7, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "NUMBER", "index": 8, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "NUMBER", "index": 9, "name": "DRUG", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 350208, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.normalized_input__int_present_on_admit_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PRESENT_ON_ADMIT_VOTING", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_diagnosis_code_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DIAGNOSIS_CODE_FINAL", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__payer_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PAYER_TYPE", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PAYER_TYPE": {"type": "TEXT", "index": 1, "name": "PAYER_TYPE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.normalized_input__medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "NORMALIZED_INPUT_MEDICAL_CLAIM", "database": "RAW", "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": "TEXT", "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}, "BILLING_NPI": {"type": "TEXT", "index": 30, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 31, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 32, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 36, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 37, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 38, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 39, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 40, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 41, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 91, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 92, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 117, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 118, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 142, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 143, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_eligibility_dates_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ELIGIBILITY_DATES_NORMALIZE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.core__stg_claims_patient": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PATIENT", "database": "RAW", "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}, "ADDRESS": {"type": "TEXT", "index": 9, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 10, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 11, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 12, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 13, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 14, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 15, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.ed_classification__categories": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_CATEGORIES", "database": "RAW", "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": "NUMBER", "index": 3, "name": "CLASSIFICATION_ORDER", "comment": null}, "CLASSIFICATION_COLUMN": {"type": "TEXT", "index": 4, "name": "CLASSIFICATION_COLUMN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.core__location": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "LOCATION", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.insights__sum_amount_by_service_category": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "SUM_AMOUNT_BY_SERVICE_CATEGORY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SERVICE_CATEGORY_TYPE": {"type": "TEXT", "index": 1, "name": "SERVICE_CATEGORY_TYPE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 3, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 4, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 5, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__sum_amount_by_service_category"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.cms_hcc__int_disabled_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DISABLED_INTERACTION_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__calendar": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "CALENDAR", "database": "RAW", "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}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 882176, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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__calendar"}, "model.the_tuva_project.emergency_department__int_institutional_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_INSTITUTIONAL_ENCOUNTER_ID", "database": "RAW", "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}, "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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "comment": null}, "ROW_NUM": {"type": "NUMBER", "index": 7, "name": "ROW_NUM", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 8, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 9, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 10, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "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.emergency_department__int_institutional_encounter_id"}, "model.the_tuva_project.acute_inpatient__first_claim_values": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_FIRST_CLAIM_VALUES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_START": {"type": "DATE", "index": 2, "name": "CLAIM_START", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 4, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 5, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 6, "name": "ADMIT_TYPE_CODE", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 7, "name": "FACILITY_NPI", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 8, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 9, "name": "APR_DRG_CODE", "comment": null}, "CLAIM_ROW": {"type": "NUMBER", "index": 10, "name": "CLAIM_ROW", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__first_claim_values"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_nqf2372_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_DENOMINATOR", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_bill_type_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_BILL_TYPE_VOTING", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__procedure_ccs": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_PROCEDURE_CCS", "database": "RAW", "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.core__medication": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "MEDICATION", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.service_category__skilled_nursing_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_SKILLED_NURSING_INSTITUTIONAL", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__skilled_nursing_institutional"}, "model.the_tuva_project.core__procedure": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PROCEDURE", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_eligibility_denominators": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_ELIGIBILITY_DENOMINATORS", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_DENOMINATOR_NAME": {"type": "TEXT", "index": 1, "name": "TEST_DENOMINATOR_NAME", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.quality_measures__summary_counts": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "SUMMARY_COUNTS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__icd_10_pcs": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_10_PCS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 1001472, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.insights__count_claim_by_date_column": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "COUNT_CLAIM_BY_DATE_COLUMN", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "NUMBER", "index": 1, "name": "YEAR_MONTH", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 2, "name": "MEMBER_MONTHS", "comment": null}, "CLAIM_START_DATE": {"type": "NUMBER", "index": 3, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "NUMBER", "index": 4, "name": "CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "NUMBER", "index": 5, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "NUMBER", "index": 6, "name": "DISCHARGE_DATE", "comment": null}, "MEDICAL_PAID_DATE": {"type": "NUMBER", "index": 7, "name": "MEDICAL_PAID_DATE", "comment": null}, "DISPENSING_DATE": {"type": "NUMBER", "index": 8, "name": "DISPENSING_DATE", "comment": null}, "PHARMACY_PAID_DATE": {"type": "NUMBER", "index": 9, "name": "PHARMACY_PAID_DATE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__count_claim_by_date_column"}, "model.the_tuva_project.quality_measures__int_nqf0034_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUSIONS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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_nqf2372__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372__PERFORMANCE_PERIOD", "database": "RAW", "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.hcc_suspecting__hcc_descriptions": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_VALUE_SET_HCC_DESCRIPTIONS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 4608, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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"}, "seed.the_tuva_project.terminology__snomed_icd_10_map": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "SNOMED_ICD_10_MAP", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 11658240, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:42UTC", "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"}, "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"}, "seed.the_tuva_project.terminology__mdc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MDC", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 20:41UTC", "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"}, "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.cms_hcc__disabled_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISABLED_INTERACTION_FACTORS", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.core__stg_clinical_medication": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_MEDICATION", "database": "RAW", "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.emergency_department__summary": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "EMERGENCY_DEPARTMENT_SUMMARY", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "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_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 5, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 6, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 7, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 8, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 11, "name": "FACILITY_NPI", "comment": null}, "PROVIDER_FIRST_NAME": {"type": "TEXT", "index": 12, "name": "PROVIDER_FIRST_NAME", "comment": null}, "PROVIDER_LAST_NAME": {"type": "TEXT", "index": 13, "name": "PROVIDER_LAST_NAME", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 14, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 16, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 17, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 19, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 21, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 23, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "FLOAT", "index": 25, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "FLOAT", "index": 26, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "FLOAT", "index": 27, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 28, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 29, "name": "MORTALITY_FLAG", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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__summary"}, "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_ELIGIBILITY_DUPLICATES", "database": "RAW", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates"}, "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": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "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.service_category__ambulance_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_AMBULANCE_PROFESSIONAL", "database": "RAW", "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_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.normalized_input__int_procedure_date_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_DATE_FINAL", "database": "RAW", "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": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-20 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"}, "has_stats": {"id": "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.readmissions__exclusion": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_EXCLUSION", "database": "RAW", "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.input_layer.encounter": {"metadata": {"type": "VIEW", "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}, "FACILITY_NPI": {"type": "TEXT", "index": 14, "name": "FACILITY_NPI", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 15, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 16, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 18, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}}, "stats": {"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.encounter"}, "model.input_layer.observation": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.observation"}, "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}}, "stats": {"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.lab_result": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.lab_result"}, "model.input_layer.practitioner": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.practitioner"}, "model.input_layer.location": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.location"}, "model.input_layer.pharmacy_claim": {"metadata": {"type": "VIEW", "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}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 17, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 19, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}}, "stats": {"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.pharmacy_claim"}, "model.input_layer.patient": {"metadata": {"type": "VIEW", "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}, "ADDRESS": {"type": "TEXT", "index": 9, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 10, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 11, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 12, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 13, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 14, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 15, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}}, "stats": {"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.patient"}, "model.input_layer.condition": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.condition"}, "model.input_layer.eligibility": {"metadata": {"type": "VIEW", "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}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 4, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 5, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 6, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 7, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 8, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 11, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 12, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 13, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 14, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 16, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 17, "name": "LAST_NAME", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 18, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 19, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 20, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 21, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 22, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 23, "name": "DATA_SOURCE", "comment": null}}, "stats": {"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.eligibility"}, "model.input_layer.medical_claim": {"metadata": {"type": "VIEW", "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}, "BILLING_NPI": {"type": "TEXT", "index": 30, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 31, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 32, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 33, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 34, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 35, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 36, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 37, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 39, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 40, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 41, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 91, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 92, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 117, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 118, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 142, "name": "DATA_SOURCE", "comment": null}}, "stats": {"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.medical_claim"}, "model.input_layer.procedure": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.procedure"}}, "sources": {}, "errors": null} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.4.9", "generated_at": "2024-02-21T19:58:42.961806Z", "invocation_id": "3b251ac3-6e0f-4d2f-8097-c3e7333acc05", "env": {}}, "nodes": {"model.input_layer.observation": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.observation"}, "model.input_layer.eligibility": {"metadata": {"type": "VIEW", "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}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 4, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 5, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 6, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 7, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 8, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 11, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 12, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 13, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 14, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 16, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 17, "name": "LAST_NAME", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 18, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 19, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 20, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 21, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 22, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 23, "name": "DATA_SOURCE", "comment": null}}, "stats": {"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.eligibility"}, "model.input_layer.practitioner": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.practitioner"}, "model.input_layer.procedure": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.procedure"}, "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}}, "stats": {"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.medical_claim": {"metadata": {"type": "VIEW", "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}, "BILLING_NPI": {"type": "TEXT", "index": 30, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 31, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 32, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 33, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 34, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 35, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 36, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 37, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 39, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 40, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 41, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 91, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 92, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 117, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 118, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 142, "name": "DATA_SOURCE", "comment": null}}, "stats": {"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.medical_claim"}, "model.input_layer.patient": {"metadata": {"type": "VIEW", "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}, "ADDRESS": {"type": "TEXT", "index": 9, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 10, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 11, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 12, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 13, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 14, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 15, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}}, "stats": {"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.patient"}, "model.input_layer.condition": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.condition"}, "model.input_layer.location": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.location"}, "model.input_layer.lab_result": {"metadata": {"type": "VIEW", "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}}, "stats": {"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.lab_result"}, "model.input_layer.pharmacy_claim": {"metadata": {"type": "VIEW", "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}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 17, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 19, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}}, "stats": {"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.pharmacy_claim"}, "model.input_layer.encounter": {"metadata": {"type": "VIEW", "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}, "FACILITY_NPI": {"type": "TEXT", "index": 14, "name": "FACILITY_NPI", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 15, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 16, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 18, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}}, "stats": {"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.encounter"}, "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_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_test_result_stage_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_RESULT_STAGE_MEDICAL_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 2, "name": "GRAIN", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 3, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 4, "name": "TEST_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}, "FAILURES": {"type": "NUMBER", "index": 7, "name": "FAILURES", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim"}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_INVALID_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_NAME": {"type": "TEXT", "index": 1, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 2, "name": "PIPELINE_TEST", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 3, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 5, "name": "TEST_CATEGORY", "comment": null}, "GRAIN": {"type": "TEXT", "index": 6, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 7, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "FILLED_ROW_COUNT": {"type": "NUMBER", "index": 9, "name": "FILLED_ROW_COUNT", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 276.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8192.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.acute_inpatient__first_claim_values": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_FIRST_CLAIM_VALUES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_START": {"type": "DATE", "index": 2, "name": "CLAIM_START", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 4, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 5, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 6, "name": "ADMIT_TYPE_CODE", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 7, "name": "FACILITY_NPI", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 8, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 9, "name": "APR_DRG_CODE", "comment": null}, "CLAIM_ROW": {"type": "NUMBER", "index": 10, "name": "CLAIM_ROW", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__first_claim_values"}, "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_ENCOUNTER_START_AND_END_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 2, "name": "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}, "DETERMINED_ENCOUNTER_START_DATE": {"type": "DATE", "index": 5, "name": "DETERMINED_ENCOUNTER_START_DATE", "comment": null}, "DETERMINED_ENCOUNTER_END_DATE": {"type": "DATE", "index": 6, "name": "DETERMINED_ENCOUNTER_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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__int_encounter_start_and_end_dates"}, "model.the_tuva_project.insights__orphan_claim_by_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "ORPHAN_CLAIM_BY_CLAIM_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_CATEGORY": {"type": "TEXT", "index": 1, "name": "CLAIM_CATEGORY", "comment": null}, "DISTINCT_CLAIM_COUNT": {"type": "NUMBER", "index": 2, "name": "DISTINCT_CLAIM_COUNT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__orphan_claim_by_claim_type"}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_DETAIL_STAGE_ELIGIBILITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "FOREIGN_KEY": {"type": "TEXT", "index": 4, "name": "FOREIGN_KEY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"}, "model.the_tuva_project.emergency_department__int_first_claim_values": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_FIRST_CLAIM_VALUES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_START": {"type": "DATE", "index": 2, "name": "CLAIM_START", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 4, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 5, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 6, "name": "ADMIT_TYPE_CODE", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 7, "name": "FACILITY_NPI", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 8, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 9, "name": "APR_DRG_CODE", "comment": null}, "CLAIM_ROW": {"type": "NUMBER", "index": 10, "name": "CLAIM_ROW", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__int_first_claim_values"}, "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"}, "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}, "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}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 9, "name": "EXCLUSION_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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.quality_measures__int_nqf2372_exclude_palliative": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_palliative"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 812.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 16896.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 8131408.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 251492864.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 8.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1583.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 35840.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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__claims_preprocessing_pharmacy_claim_duplicates": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_PHARMACY_CLAIM_DUPLICATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 12333.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 183808.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.service_category__acute_inpatient_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 11.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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.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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 256479.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 11658240.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.data_quality__claims_preprocessing_medical_claim_dates": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 44.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 81597.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1553408.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 40.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.acute_inpatient__data_quality_summary": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_DATA_QUALITY_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"FIELD": {"type": "TEXT", "index": 1, "name": "FIELD", "comment": null}, "TOTAL_COUNT": {"type": "NUMBER", "index": 2, "name": "TOTAL_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": 29.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__data_quality_summary"}, "model.the_tuva_project.service_category__dq_multiple_service_categories_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_DQ_MULTIPLE_SERVICE_CATEGORIES_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}, "DISTINCT_SERVICE_CATEGORY_COUNT": {"type": "NUMBER", "index": 3, "name": "DISTINCT_SERVICE_CATEGORY_COUNT", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__dq_multiple_service_categories_professional"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 25.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.emergency_department__summary": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "EMERGENCY_DEPARTMENT_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "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_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 5, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 6, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 7, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 8, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 11, "name": "FACILITY_NPI", "comment": null}, "PROVIDER_FIRST_NAME": {"type": "TEXT", "index": 12, "name": "PROVIDER_FIRST_NAME", "comment": null}, "PROVIDER_LAST_NAME": {"type": "TEXT", "index": 13, "name": "PROVIDER_LAST_NAME", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 14, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 16, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 17, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 19, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 21, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 23, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "FLOAT", "index": 25, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "FLOAT", "index": 26, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "FLOAT", "index": 27, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 28, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 29, "name": "MORTALITY_FLAG", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__summary"}, "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_exclude_hospice_palliative"}, "model.the_tuva_project.quality_measures__int_nqf0059_exclude_institutional_snp": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_exclude_institutional_snp"}, "model.the_tuva_project.emergency_department__int_last_claim_values": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_LAST_CLAIM_VALUES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_START": {"type": "DATE", "index": 2, "name": "CLAIM_START", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 3, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "CLAIM_ROW": {"type": "NUMBER", "index": 4, "name": "CLAIM_ROW", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__int_last_claim_values"}, "model.the_tuva_project.service_category__dq_input_layer_results": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_DQ_INPUT_LAYER_RESULTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DQ_PROBLEM": {"type": "TEXT", "index": 1, "name": "DQ_PROBLEM", "comment": null}, "DISTINCT_CLAIMS": {"type": "NUMBER", "index": 2, "name": "DISTINCT_CLAIMS", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__dq_input_layer_results"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_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.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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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.quality_measures__int_nqf2372_exclude_advanced_illness": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_advanced_illness"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.core__medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "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}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 5, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 6, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 7, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 8, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 13, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 14, "name": "DISCHARGE_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 15, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 16, "name": "SERVICE_CATEGORY_2", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 17, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 18, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 19, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 21, "name": "BILL_TYPE_CODE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 23, "name": "APR_DRG_CODE", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 24, "name": "REVENUE_CENTER_CODE", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 25, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 26, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 27, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 28, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 29, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 30, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 31, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 32, "name": "RENDERING_NPI", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 33, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 34, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 35, "name": "PAID_DATE", "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}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 39, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 40, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 41, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 42, "name": "TOTAL_COST_AMOUNT", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 80493.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1416192.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.core__stg_claims_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_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}, "BIRTH_DATE": {"type": "DATE", "index": 3, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 4, "name": "DEATH_DATE", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 5, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 6, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 7, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 8, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 9, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 10, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 11, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 12, "name": "MEDICARE_STATUS_CODE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 13, "name": "DATA_SOURCE", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__claims_preprocessing_pharmacy_header_fail_details": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_PHARMACY_HEADER_FAIL_DETAILS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details"}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_HOSPICE", "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_hospice"}, "seed.the_tuva_project.service_category__service_categories": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_VALUE_SET_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}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 18.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 101632.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4118528.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4613.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 97280.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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_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"}, "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_CDOE": {"type": "NUMBER", "index": 3, "name": "MDC_CDOE", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8704.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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_NAME": {"type": "TEXT", "index": 3, "name": "ATC_1_NAME", "comment": null}, "ATC_2_NAME": {"type": "TEXT", "index": 4, "name": "ATC_2_NAME", "comment": null}, "ATC_3_NAME": {"type": "TEXT", "index": 5, "name": "ATC_3_NAME", "comment": null}, "ATC_4_NAME": {"type": "TEXT", "index": 6, "name": "ATC_4_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 23989.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 949248.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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__claims_preprocessing_professional_header_fail_details": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_PROFESSIONAL_HEADER_FAIL_DETAILS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details"}, "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.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": "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}, "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.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": "BOOLEAN", "index": 7, "name": "IS_IP_DEFAULT_CATEGORY", "comment": null}, "IS_OP_DEFAULT_CATEGORY": {"type": "BOOLEAN", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2384896.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.service_category__dq_multiple_service_categories_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_DQ_MULTIPLE_SERVICE_CATEGORIES_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DISTINCT_SERVICE_CATEGORY_COUNT": {"type": "NUMBER", "index": 2, "name": "DISTINCT_SERVICE_CATEGORY_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": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__dq_multiple_service_categories_institutional"}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIMS_PREPROCESSING_TEST_DETAIL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 2, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 3, "name": "TEST_NAME", "comment": null}, "GRAIN": {"type": "TEXT", "index": 4, "name": "GRAIN", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}, "FOREIGN_KEY": {"type": "TEXT", "index": 7, "name": "FOREIGN_KEY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"}, "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_BILLING_NPI": {"type": "TEXT", "index": 6, "name": "NORMALIZED_BILLING_NPI", "comment": null}, "NORMALIZED_FACILITY_NPI": {"type": "TEXT", "index": 7, "name": "NORMALIZED_FACILITY_NPI", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.core__pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "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_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": "NUMBER", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 17, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 19, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 21, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_nqf0059__frailty": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059__FRAILTY", "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}, "EXCLUSION_DATE": {"type": "DATE", "index": 4, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 5, "name": "EXCLUSION_REASON", "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.quality_measures__int_nqf0059__frailty"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.quality_measures__int_nqf0034_exclude_advanced_illness": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_advanced_illness"}, "model.the_tuva_project.emergency_department__int_institutional_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_INSTITUTIONAL_ENCOUNTER_ID", "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}, "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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "comment": null}, "ROW_NUM": {"type": "NUMBER", "index": 7, "name": "ROW_NUM", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 8, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 9, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 10, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "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.emergency_department__int_institutional_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_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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 74549.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1899008.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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__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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.acute_inpatient__encounter_data_for_medical_claims": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ENCOUNTER_DATA_FOR_MEDICAL_CLAIMS", "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}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 7, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 8, "name": "ENCOUNTER_END_DATE", "comment": null}, "ENCOUNTER_ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 9, "name": "ENCOUNTER_ADMIT_SOURCE_CODE", "comment": null}, "ENCOUNTER_ADMIT_TYPE_CODE": {"type": "TEXT", "index": 10, "name": "ENCOUNTER_ADMIT_TYPE_CODE", "comment": null}, "ENCOUNTER_DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 11, "name": "ENCOUNTER_DISCHARGE_DISPOSITION_CODE", "comment": null}, "ORPHAN_CLAIM_FLAG": {"type": "NUMBER", "index": 12, "name": "ORPHAN_CLAIM_FLAG", "comment": null}, "ENCOUNTER_COUNT": {"type": "NUMBER", "index": 13, "name": "ENCOUNTER_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "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.acute_inpatient__encounter_data_for_medical_claims"}, "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}, "EXCLUSION_DATE": {"type": "DATE", "index": 6, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 7, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 8, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 10, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 11, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 12, "name": "MEASURE_VERSION", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__fips_county": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3232.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 31232.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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__fips_county"}, "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_NPI": {"type": "TEXT", "index": 5, "name": "FACILITY_NPI", "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": "FLOAT", "index": 12, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "FLOAT", "index": 13, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "FLOAT", "index": 14, "name": "EPCT", "comment": null}, "NONER": {"type": "FLOAT", "index": 15, "name": "NONER", "comment": null}, "INJURY": {"type": "NUMBER", "index": 16, "name": "INJURY", "comment": null}, "PSYCH": {"type": "NUMBER", "index": 17, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "NUMBER", "index": 18, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "NUMBER", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.service_category__hospice_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__hospice_professional"}, "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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 22.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "PERFORMANCE_FLAG": {"type": "NUMBER", "index": 6, "name": "PERFORMANCE_FLAG", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": "NUMBER", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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"}, "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_CLAIM_TYPE_MAPPING_FAILURES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 848.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 13312.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "NUMERATOR_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 115.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4608.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.financial_pmpm__member_months": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "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}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__member_months"}, "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_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": "NUMBER", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 17, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 19, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 21, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.insights__trend_count_claim_by_service_category": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "TREND_COUNT_CLAIM_BY_SERVICE_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "SERVICE_CATEGORY": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY", "comment": null}, "DISTINCT_CLAIM_COUNT": {"type": "NUMBER", "index": 3, "name": "DISTINCT_CLAIM_COUNT", "comment": null}, "DISTINCT_CLAIM_COUNT_CHANGE": {"type": "NUMBER", "index": 4, "name": "DISTINCT_CLAIM_COUNT_CHANGE", "comment": null}, "DISTINCT_CLAIM_PERCENTAGE_CHANGE": {"type": "NUMBER", "index": 5, "name": "DISTINCT_CLAIM_PERCENTAGE_CHANGE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_service_category"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 823967.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 7451136.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 73.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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__claims_preprocessing_test_result": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIMS_PREPROCESSING_TEST_RESULT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 2, "name": "GRAIN", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 3, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 4, "name": "TEST_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}, "FAILURES": {"type": "NUMBER", "index": 7, "name": "FAILURES", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result"}, "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}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 74044.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1063936.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "seed.the_tuva_project.terminology__ansi_fips_state": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 55.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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__ansi_fips_state"}, "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_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}, "FACILITY_NPI": {"type": "TEXT", "index": 14, "name": "FACILITY_NPI", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 15, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 16, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 18, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 26, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": "FLOAT", "index": 2, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "FLOAT", "index": 3, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "FLOAT", "index": 4, "name": "EPCT", "comment": null}, "NONER": {"type": "FLOAT", "index": 5, "name": "NONER", "comment": null}, "INJURY": {"type": "NUMBER", "index": 6, "name": "INJURY", "comment": null}, "PSYCH": {"type": "NUMBER", "index": 7, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "NUMBER", "index": 8, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "NUMBER", "index": 9, "name": "DRUG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 47132.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 350208.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.insights__sum_amount_by_service_category": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "SUM_AMOUNT_BY_SERVICE_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SERVICE_CATEGORY_TYPE": {"type": "TEXT", "index": 1, "name": "SERVICE_CATEGORY_TYPE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 3, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 4, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 5, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__sum_amount_by_service_category"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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__claims_preprocessing_eligibility_duplicates": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_ELIGIBILITY_DUPLICATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates"}, "model.the_tuva_project.service_category__duplicate_bill_types": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DUPLICATE_BILL_TYPES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CNT": {"type": "NUMBER", "index": 2, "name": "CNT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__duplicate_bill_types"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_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": "TEXT", "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}, "BILLING_NPI": {"type": "TEXT", "index": 30, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 31, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 32, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 36, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 37, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 38, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 39, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 40, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 41, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 91, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 92, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 117, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 118, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 142, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 143, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.acute_inpatient__encounter_start_and_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_ENCOUNTER_START_AND_END_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 2, "name": "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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_start_and_end_dates"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "ADDRESS": {"type": "TEXT", "index": 9, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 10, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 11, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 12, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 13, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 14, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 15, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 17, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 11687.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 89088.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1701.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 22016.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 6.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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.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}, "ADDRESS": {"type": "TEXT", "index": 9, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 10, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 11, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 12, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 13, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 14, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 15, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.terminology__calendar": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "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}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 80000.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 882176.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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__calendar"}, "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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.quality_measures__int_nqf0059_exclude_advanced_illness": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_exclude_advanced_illness"}, "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": "NUMBER", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 147456.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 14.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.acute_inpatient__institutional_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL_ENCOUNTER_ID", "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}, "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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "comment": null}, "ROW_NUM": {"type": "NUMBER", "index": 7, "name": "ROW_NUM", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 8, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 9, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 10, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "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.acute_inpatient__institutional_encounter_id"}, "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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "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__claims_preprocessing_medical_claim_inst_missing_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_INST_MISSING_VALUES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values"}, "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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__claims_preprocessing_eligibility_denominators": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_ELIGIBILITY_DENOMINATORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_DENOMINATOR_NAME": {"type": "TEXT", "index": 1, "name": "TEST_DENOMINATOR_NAME", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators"}, "model.the_tuva_project.service_category__skilled_nursing_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_SKILLED_NURSING_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__skilled_nursing_institutional"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.insights__sum_amount_by_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "SUM_AMOUNT_BY_CLAIM_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_TYPE": {"type": "TEXT", "index": 1, "name": "CLAIM_TYPE", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 2, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 3, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 4, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__sum_amount_by_claim_type"}, "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}, "ADDRESS": {"type": "TEXT", "index": 9, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 10, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 11, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 12, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 13, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 14, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 15, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 98.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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.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}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 4, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 5, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 6, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 7, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 8, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 11, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 12, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 13, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 14, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 16, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 17, "name": "LAST_NAME", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 18, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 19, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 20, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 21, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 22, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 23, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 24, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.service_category__hospice_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_HOSPICE_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__hospice_institutional"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2521.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 34304.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 3, "name": "NORMALIZED_CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "CODE_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 5, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 6, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CLINICAL_DOMAIN": {"type": "TEXT", "index": 8, "name": "CLINICAL_DOMAIN", "comment": null}, "PRCCSR_VERSION": {"type": "TEXT", "index": 9, "name": "PRCCSR_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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__claims_preprocessing_test_detail_stage_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_DETAIL_STAGE_MEDICAL_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "FOREIGN_KEY": {"type": "TEXT", "index": 4, "name": "FOREIGN_KEY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"}, "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_dementia"}, "model.the_tuva_project.core__eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "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}, "BIRTH_DATE": {"type": "DATE", "index": 3, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 4, "name": "DEATH_DATE", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 5, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 6, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 7, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 8, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 9, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 10, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 11, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 12, "name": "MEDICARE_STATUS_CODE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 13, "name": "DATA_SOURCE", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_FAMILY": {"type": "TEXT", "index": 2, "name": "CONDITION_FAMILY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 3, "name": "CONDITION", "comment": null}, "FIRST_DIAGNOSIS_DATE": {"type": "DATE", "index": 4, "name": "FIRST_DIAGNOSIS_DATE", "comment": null}, "LAST_DIAGNOSIS_DATE": {"type": "DATE", "index": 5, "name": "LAST_DIAGNOSIS_DATE", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 5.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "seed.the_tuva_project.terminology__ssa_fips_state": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 78.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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__ssa_fips_state"}, "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_NPI": {"type": "TEXT", "index": 5, "name": "FACILITY_NPI", "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": "FLOAT", "index": 12, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "FLOAT", "index": 13, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "FLOAT", "index": 14, "name": "EPCT", "comment": null}, "NONER": {"type": "FLOAT", "index": 15, "name": "NONER", "comment": null}, "INJURY": {"type": "NUMBER", "index": 16, "name": "INJURY", "comment": null}, "PSYCH": {"type": "NUMBER", "index": 17, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "NUMBER", "index": 18, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "NUMBER", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "BILLING_NPI": {"type": "TEXT", "index": 30, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 31, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 32, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 33, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 34, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 35, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 36, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 37, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 39, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 40, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 41, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 91, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 92, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 117, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 118, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 142, "name": "DATA_SOURCE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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_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}, "FACILITY_NPI": {"type": "TEXT", "index": 14, "name": "FACILITY_NPI", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 15, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 16, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 18, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 26, "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.data_quality__claims_preprocessing_pharmacy_claim_missing_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_PHARMACY_CLAIM_MISSING_VALUES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 5.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.data_quality__claims_preprocessing_eligibility_invalid_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_ELIGIBILITY_INVALID_VALUES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_NAME": {"type": "TEXT", "index": 1, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 2, "name": "PIPELINE_TEST", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 3, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 5, "name": "TEST_CATEGORY", "comment": null}, "GRAIN": {"type": "TEXT", "index": 6, "name": "GRAIN", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 7, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "GENDER": {"type": "TEXT", "index": 9, "name": "GENDER", "comment": null}, "FILLED_ROW_COUNT": {"type": "NUMBER", "index": 10, "name": "FILLED_ROW_COUNT", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": "FLOAT", "index": 2, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "FLOAT", "index": 3, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "FLOAT", "index": 4, "name": "EPCT", "comment": null}, "NONER": {"type": "FLOAT", "index": 5, "name": "NONER", "comment": null}, "INJURY": {"type": "NUMBER", "index": 6, "name": "INJURY", "comment": null}, "PSYCH": {"type": "NUMBER", "index": 7, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "NUMBER", "index": 8, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "NUMBER", "index": 9, "name": "DRUG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 7443.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 57344.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.core__stg_claims_pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_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_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": "NUMBER", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 17, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 19, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 21, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_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}, "FACILITY_NPI": {"type": "TEXT", "index": 14, "name": "FACILITY_NPI", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 15, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 16, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 18, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 26, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_DETAIL_STAGE_PHARMACY_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "FOREIGN_KEY": {"type": "TEXT", "index": 4, "name": "FOREIGN_KEY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"}, "model.the_tuva_project.data_quality__claims_preprocessing_use_case": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIMS_PREPROCESSING_USE_CASE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"USE_CASE": {"type": "TEXT", "index": 1, "name": "USE_CASE", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 2, "name": "SOURCE_TABLE", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 3, "name": "TEST_NAME", "comment": null}, "FAILURES": {"type": "NUMBER", "index": 4, "name": "FAILURES", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 5, "name": "DENOMINATOR", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_use_case"}, "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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.service_category__dq_input_layer_tests": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_DQ_INPUT_LAYER_TESTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DQ_PROBLEM": {"type": "TEXT", "index": 2, "name": "DQ_PROBLEM", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__dq_input_layer_tests"}, "model.the_tuva_project.insights__count_claim_by_service_category": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "COUNT_CLAIM_BY_SERVICE_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SERVICE_CATEGORY_TYPE": {"type": "TEXT", "index": 1, "name": "SERVICE_CATEGORY_TYPE", "comment": null}, "SERVICE_CATEGORY": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY", "comment": null}, "DISTINCT_CLAIM_COUNT": {"type": "NUMBER", "index": 3, "name": "DISTINCT_CLAIM_COUNT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__count_claim_by_service_category"}, "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_RESULT_STAGE_PHARMACY_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 2, "name": "GRAIN", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 3, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 4, "name": "TEST_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}, "FAILURES": {"type": "NUMBER", "index": 7, "name": "FAILURES", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim"}, "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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.acute_inpatient__claims_with_encounter_data": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_CLAIMS_WITH_ENCOUNTER_DATA", "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}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_ID", "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}, "ENCOUNTER_ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "ENCOUNTER_ADMIT_SOURCE_CODE", "comment": null}, "ENCOUNTER_ADMIT_TYPE_CODE": {"type": "TEXT", "index": 9, "name": "ENCOUNTER_ADMIT_TYPE_CODE", "comment": null}, "ENCOUNTER_DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 10, "name": "ENCOUNTER_DISCHARGE_DISPOSITION_CODE", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__claims_with_encounter_data"}, "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_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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_ALLOWED": {"type": "NUMBER", "index": 8, "name": "AMBULATORY_SURGERY_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}, "HOSPICE_ALLOWED": {"type": "NUMBER", "index": 13, "name": "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}, "OFFICE_VISIT_ALLOWED": {"type": "NUMBER", "index": 17, "name": "OFFICE_VISIT_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 18, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 19, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 20, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 21, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 22, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 23, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "ACUTE_MYOCARDIAL_INFARCTION": {"type": "NUMBER", "index": 2, "name": "ACUTE_MYOCARDIAL_INFARCTION", "comment": null}, "ALCOHOL": {"type": "NUMBER", "index": 3, "name": "ALCOHOL", "comment": null}, "ALZHEIMERS_DISEASE": {"type": "NUMBER", "index": 4, "name": "ALZHEIMERS_DISEASE", "comment": null}, "AMYOTROPHIC_LATERAL_SCLEROSIS": {"type": "NUMBER", "index": 5, "name": "AMYOTROPHIC_LATERAL_SCLEROSIS", "comment": null}, "ANXIETY": {"type": "NUMBER", "index": 6, "name": "ANXIETY", "comment": null}, "ASTHMA": {"type": "NUMBER", "index": 7, "name": "ASTHMA", "comment": null}, "ATHEROSCLEROSIS": {"type": "NUMBER", "index": 8, "name": "ATHEROSCLEROSIS", "comment": null}, "ATRIAL_FIBRILLATION": {"type": "NUMBER", "index": 9, "name": "ATRIAL_FIBRILLATION", "comment": null}, "ATTENTION_DEFICIT_HYPERACTIVITY_DISORDER": {"type": "NUMBER", "index": 10, "name": "ATTENTION_DEFICIT_HYPERACTIVITY_DISORDER", "comment": null}, "BIPOLAR": {"type": "NUMBER", "index": 11, "name": "BIPOLAR", "comment": null}, "BREAST_CANCER": {"type": "NUMBER", "index": 12, "name": "BREAST_CANCER", "comment": null}, "CHRONIC_KIDNEY_DISEASE": {"type": "NUMBER", "index": 13, "name": "CHRONIC_KIDNEY_DISEASE", "comment": null}, "CHRONIC_OBSTRUCTIVE_PULMONARY_DISEASE": {"type": "NUMBER", "index": 14, "name": "CHRONIC_OBSTRUCTIVE_PULMONARY_DISEASE", "comment": null}, "COCAINE": {"type": "NUMBER", "index": 15, "name": "COCAINE", "comment": null}, "COLORECTAL_CANCER": {"type": "NUMBER", "index": 16, "name": "COLORECTAL_CANCER", "comment": null}, "CROHNS_DISEASE": {"type": "NUMBER", "index": 17, "name": "CROHNS_DISEASE", "comment": null}, "CYSTIC_FIBROSIS": {"type": "NUMBER", "index": 18, "name": "CYSTIC_FIBROSIS", "comment": null}, "DEMENTIA": {"type": "NUMBER", "index": 19, "name": "DEMENTIA", "comment": null}, "DEPRESSION": {"type": "NUMBER", "index": 20, "name": "DEPRESSION", "comment": null}, "HEART_FAILURE": {"type": "NUMBER", "index": 21, "name": "HEART_FAILURE", "comment": null}, "HYPERLIPIDEMIA": {"type": "NUMBER", "index": 22, "name": "HYPERLIPIDEMIA", "comment": null}, "HYPERTENSION": {"type": "NUMBER", "index": 23, "name": "HYPERTENSION", "comment": null}, "LUNG_CANCER": {"type": "NUMBER", "index": 24, "name": "LUNG_CANCER", "comment": null}, "LUPUS": {"type": "NUMBER", "index": 25, "name": "LUPUS", "comment": null}, "METABOLIC_SYNDROME": {"type": "NUMBER", "index": 26, "name": "METABOLIC_SYNDROME", "comment": null}, "MULTIPLE_SCLEROSIS": {"type": "NUMBER", "index": 27, "name": "MULTIPLE_SCLEROSIS", "comment": null}, "MUSCULAR_DYSTROPHY": {"type": "NUMBER", "index": 28, "name": "MUSCULAR_DYSTROPHY", "comment": null}, "OBESITY": {"type": "NUMBER", "index": 29, "name": "OBESITY", "comment": null}, "OBSESSIVE_COMPULSIVE_DISORDER": {"type": "NUMBER", "index": 30, "name": "OBSESSIVE_COMPULSIVE_DISORDER", "comment": null}, "OPIOID": {"type": "NUMBER", "index": 31, "name": "OPIOID", "comment": null}, "PARKINSONS_DISEASE": {"type": "NUMBER", "index": 32, "name": "PARKINSONS_DISEASE", "comment": null}, "PERSONALITY_DISORDER": {"type": "NUMBER", "index": 33, "name": "PERSONALITY_DISORDER", "comment": null}, "POST_TRAUMATIC_STRESS_DISORDER": {"type": "NUMBER", "index": 34, "name": "POST_TRAUMATIC_STRESS_DISORDER", "comment": null}, "RHEUMATOID_ARTHRITIS": {"type": "NUMBER", "index": 35, "name": "RHEUMATOID_ARTHRITIS", "comment": null}, "SCHIZOPHRENIA": {"type": "NUMBER", "index": 36, "name": "SCHIZOPHRENIA", "comment": null}, "STROKE": {"type": "NUMBER", "index": 37, "name": "STROKE", "comment": null}, "TOBACCO": {"type": "NUMBER", "index": 38, "name": "TOBACCO", "comment": null}, "TYPE_1_DIABETES": {"type": "NUMBER", "index": 39, "name": "TYPE_1_DIABETES", "comment": null}, "TYPE_2_DIABETES": {"type": "NUMBER", "index": 40, "name": "TYPE_2_DIABETES", "comment": null}, "ULCERATIVE_COLITIS": {"type": "NUMBER", "index": 41, "name": "ULCERATIVE_COLITIS", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1676.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 28672.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 65.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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__code_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "CODE_TYPE", "database": "DEV_SARAH", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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__code_type"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 7501.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 368640.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.service_category__skilled_nursing_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__skilled_nursing_professional"}, "model.the_tuva_project.emergency_department__int_professional_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_PROFESSIONAL_ENCOUNTER_ID", "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}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "START_DATE": {"type": "DATE", "index": 4, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 5, "name": "END_DATE", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_ID", "comment": null}, "ORPHAN_CLAIM_FLAG": {"type": "NUMBER", "index": 7, "name": "ORPHAN_CLAIM_FLAG", "comment": null}, "ENCOUNTER_COUNT": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__int_professional_encounter_id"}, "model.the_tuva_project.service_category__office_visit_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OFFICE_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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_visit_professional"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 80.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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_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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.acute_inpatient__last_claim_values": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_LAST_CLAIM_VALUES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_START": {"type": "DATE", "index": 2, "name": "CLAIM_START", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 3, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "CLAIM_ROW": {"type": "NUMBER", "index": 4, "name": "CLAIM_ROW", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__last_claim_values"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4971.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 53760.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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_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_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}, "BILLING_NPI": {"type": "TEXT", "index": 30, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 31, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 32, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 33, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 34, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 35, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 36, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 37, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 39, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 40, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 41, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 91, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 92, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 117, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 118, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 142, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 143, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1369.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 24576.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.acute_inpatient__encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_ENCOUNTER_ID", "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}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_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.acute_inpatient__encounter_id"}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_LINE_NUMBERS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers"}, "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}, "INPATIENT_PAID": {"type": "NUMBER", "index": 6, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 7, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_VISIT_PAID": {"type": "NUMBER", "index": 8, "name": "OFFICE_VISIT_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 9, "name": "ANCILLARY_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 10, "name": "PHARMACY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 11, "name": "OTHER_PAID", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 12, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 13, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_PAID": {"type": "NUMBER", "index": 14, "name": "AMBULATORY_SURGERY_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 15, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 16, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 17, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 18, "name": "HOME_HEALTH_PAID", "comment": null}, "HOSPICE_PAID": {"type": "NUMBER", "index": 19, "name": "HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 20, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 21, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 22, "name": "LAB_PAID", "comment": null}, "OFFICE_VISIT_PAID_2": {"type": "NUMBER", "index": 23, "name": "OFFICE_VISIT_PAID_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 24, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 25, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 26, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 27, "name": "SKILLED_NURSING_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 28, "name": "URGENT_CARE_PAID", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 29, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 30, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED": {"type": "NUMBER", "index": 31, "name": "OFFICE_VISIT_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 32, "name": "ANCILLARY_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 33, "name": "PHARMACY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 34, "name": "OTHER_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 35, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 36, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_ALLOWED": {"type": "NUMBER", "index": 37, "name": "AMBULATORY_SURGERY_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 38, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 39, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 40, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 41, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "HOSPICE_ALLOWED": {"type": "NUMBER", "index": 42, "name": "HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 43, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 44, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 45, "name": "LAB_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED_2": {"type": "NUMBER", "index": 46, "name": "OFFICE_VISIT_ALLOWED_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 47, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 48, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 49, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 50, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 51, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 52, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 53, "name": "MEDICAL_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 54, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 55, "name": "MEDICAL_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 56, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_medical_claim_denominators": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_DENOMINATORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_DENOMINATOR_NAME": {"type": "TEXT", "index": 1, "name": "TEST_DENOMINATOR_NAME", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators"}, "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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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.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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_PAID": {"type": "NUMBER", "index": 8, "name": "AMBULATORY_SURGERY_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}, "HOSPICE_PAID": {"type": "NUMBER", "index": 13, "name": "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}, "OFFICE_VISIT_PAID": {"type": "NUMBER", "index": 17, "name": "OFFICE_VISIT_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 18, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 19, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 20, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 21, "name": "SKILLED_NURSING_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 22, "name": "URGENT_CARE_PAID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 23, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "seed.the_tuva_project.data_quality__test_catalog": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_TEST_CATALOG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 2, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 3, "name": "TEST_NAME", "comment": null}, "TEST_FIELD": {"type": "TEXT", "index": 4, "name": "TEST_FIELD", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 299.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 7680.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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__test_catalog"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 81597.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1539584.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 17, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 19, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": "NUMBER", "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_NPI": {"type": "TEXT", "index": 12, "name": "FACILITY_NPI", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_VISIT_PAID": {"type": "NUMBER", "index": 10, "name": "OFFICE_VISIT_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 11, "name": "ANCILLARY_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 12, "name": "PHARMACY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 13, "name": "OTHER_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_PAID": {"type": "NUMBER", "index": 16, "name": "AMBULATORY_SURGERY_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}, "HOSPICE_PAID": {"type": "NUMBER", "index": 21, "name": "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}, "OFFICE_VISIT_PAID_2": {"type": "NUMBER", "index": 25, "name": "OFFICE_VISIT_PAID_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 26, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 27, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 28, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 29, "name": "SKILLED_NURSING_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 30, "name": "URGENT_CARE_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 31, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 32, "name": "MEDICAL_ALLOWED", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 33, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 34, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED": {"type": "NUMBER", "index": 35, "name": "OFFICE_VISIT_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 36, "name": "ANCILLARY_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 37, "name": "PHARMACY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 38, "name": "OTHER_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 39, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 40, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_ALLOWED": {"type": "NUMBER", "index": 41, "name": "AMBULATORY_SURGERY_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 42, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 43, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 44, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 45, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "HOSPICE_ALLOWED": {"type": "NUMBER", "index": 46, "name": "HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 47, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 48, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 49, "name": "LAB_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED_2": {"type": "NUMBER", "index": 50, "name": "OFFICE_VISIT_ALLOWED_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 51, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 52, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 53, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 54, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 55, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 56, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 526.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8704.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 16.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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.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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__claims_preprocessing_medical_claim_invalid_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_INVALID_VALUES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_NAME": {"type": "TEXT", "index": 1, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 2, "name": "PIPELINE_TEST", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 3, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 5, "name": "TEST_CATEGORY", "comment": null}, "GRAIN": {"type": "TEXT", "index": 6, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 7, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "FILLED_ROW_COUNT": {"type": "NUMBER", "index": 9, "name": "FILLED_ROW_COUNT", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values"}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_PLAUSIBILITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_NAME": {"type": "TEXT", "index": 1, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 2, "name": "PIPELINE_TEST", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 3, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 5, "name": "TEST_CATEGORY", "comment": null}, "GRAIN": {"type": "TEXT", "index": 6, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 7, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "COUNTS": {"type": "NUMBER", "index": 9, "name": "COUNTS", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility"}, "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": "NUMBER", "index": 4, "name": "VERSION", "comment": null}, "STEWARD": {"type": "TEXT", "index": 5, "name": "STEWARD", "comment": null}, "COMPATIBLE_MEASURE": {"type": "TEXT", "index": 6, "name": "COMPATIBLE_MEASURE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.acute_inpatient__institutional_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL_CLAIMS", "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}, "CLAIM_START_DATE": {"type": "DATE", "index": 3, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 4, "name": "CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 5, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 6, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 9, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 10, "name": "FACILITY_NPI", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 11, "name": "CLAIM_TYPE", "comment": null}, "START_DATE": {"type": "DATE", "index": 12, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 13, "name": "END_DATE", "comment": null}, "DATE_USED_AS_START_DATE": {"type": "TEXT", "index": 14, "name": "DATE_USED_AS_START_DATE", "comment": null}, "DATE_USED_AS_END_DATE": {"type": "TEXT", "index": 15, "name": "DATE_USED_AS_END_DATE", "comment": null}, "DQ_PROBLEM": {"type": "NUMBER", "index": 16, "name": "DQ_PROBLEM", "comment": null}, "DQ_INSIGHT": {"type": "NUMBER", "index": 17, "name": "DQ_INSIGHT", "comment": null}, "START_DATE_NOT_DETERMINED": {"type": "NUMBER", "index": 18, "name": "START_DATE_NOT_DETERMINED", "comment": null}, "END_DATE_NOT_DETERMINED": {"type": "NUMBER", "index": 19, "name": "END_DATE_NOT_DETERMINED", "comment": null}, "START_DATE_AFTER_END_DATE": {"type": "NUMBER", "index": 20, "name": "START_DATE_AFTER_END_DATE", "comment": null}, "PATIENT_ID_NOT_UNIQUE": {"type": "NUMBER", "index": 21, "name": "PATIENT_ID_NOT_UNIQUE", "comment": null}, "PATIENT_ID_MISSING": {"type": "NUMBER", "index": 22, "name": "PATIENT_ID_MISSING", "comment": null}, "CLAIM_START_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 23, "name": "CLAIM_START_DATE_NOT_UNIQUE", "comment": null}, "CLAIM_START_DATE_MISSING": {"type": "NUMBER", "index": 24, "name": "CLAIM_START_DATE_MISSING", "comment": null}, "CLAIM_END_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 25, "name": "CLAIM_END_DATE_NOT_UNIQUE", "comment": null}, "CLAIM_END_DATE_MISSING": {"type": "NUMBER", "index": 26, "name": "CLAIM_END_DATE_MISSING", "comment": null}, "CLAIM_START_DATE_AFTER_CLAIM_END_DATE": {"type": "NUMBER", "index": 27, "name": "CLAIM_START_DATE_AFTER_CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 28, "name": "ADMISSION_DATE_NOT_UNIQUE", "comment": null}, "ADMISSION_DATE_MISSING": {"type": "NUMBER", "index": 29, "name": "ADMISSION_DATE_MISSING", "comment": null}, "DISCHARGE_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 30, "name": "DISCHARGE_DATE_NOT_UNIQUE", "comment": null}, "DISCHARGE_DATE_MISSING": {"type": "NUMBER", "index": 31, "name": "DISCHARGE_DATE_MISSING", "comment": null}, "ADMISSION_DATE_AFTER_DISCHARGE_DATE": {"type": "NUMBER", "index": 32, "name": "ADMISSION_DATE_AFTER_DISCHARGE_DATE", "comment": null}, "ADMIT_TYPE_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 33, "name": "ADMIT_TYPE_CODE_NOT_UNIQUE", "comment": null}, "ADMIT_TYPE_CODE_MISSING": {"type": "NUMBER", "index": 34, "name": "ADMIT_TYPE_CODE_MISSING", "comment": null}, "ADMIT_SOURCE_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 35, "name": "ADMIT_SOURCE_CODE_NOT_UNIQUE", "comment": null}, "ADMIT_SOURCE_CODE_MISSING": {"type": "NUMBER", "index": 36, "name": "ADMIT_SOURCE_CODE_MISSING", "comment": null}, "DISCHARGE_DISPOSITION_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 37, "name": "DISCHARGE_DISPOSITION_CODE_NOT_UNIQUE", "comment": null}, "DISCHARGE_DISPOSITION_CODE_MISSING": {"type": "NUMBER", "index": 38, "name": "DISCHARGE_DISPOSITION_CODE_MISSING", "comment": null}, "FACILITY_NPI_NOT_UNIQUE": {"type": "NUMBER", "index": 39, "name": "FACILITY_NPI_NOT_UNIQUE", "comment": null}, "FACILITY_NPI_MISSING": {"type": "NUMBER", "index": 40, "name": "FACILITY_NPI_MISSING", "comment": null}, "CLAIM_TYPE_NOT_UNIQUE": {"type": "NUMBER", "index": 41, "name": "CLAIM_TYPE_NOT_UNIQUE", "comment": null}, "CLAIM_TYPE_MISSING": {"type": "NUMBER", "index": 42, "name": "CLAIM_TYPE_MISSING", "comment": null}, "CLAIM_TYPE_NOT_INSTITUTIONAL": {"type": "NUMBER", "index": 43, "name": "CLAIM_TYPE_NOT_INSTITUTIONAL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 44, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 45, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__institutional_claims"}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_DATES_INST", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst"}, "model.the_tuva_project.insights__count_claim_by_date_column": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "COUNT_CLAIM_BY_DATE_COLUMN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "NUMBER", "index": 1, "name": "YEAR_MONTH", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 2, "name": "MEMBER_MONTHS", "comment": null}, "CLAIM_START_DATE": {"type": "NUMBER", "index": 3, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "NUMBER", "index": 4, "name": "CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "NUMBER", "index": 5, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "NUMBER", "index": 6, "name": "DISCHARGE_DATE", "comment": null}, "MEDICAL_PAID_DATE": {"type": "NUMBER", "index": 7, "name": "MEDICAL_PAID_DATE", "comment": null}, "DISPENSING_DATE": {"type": "NUMBER", "index": 8, "name": "DISPENSING_DATE", "comment": null}, "PHARMACY_PAID_DATE": {"type": "NUMBER", "index": 9, "name": "PHARMACY_PAID_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__count_claim_by_date_column"}, "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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_VISIT_PAID": {"type": "NUMBER", "index": 8, "name": "OFFICE_VISIT_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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_nqf0034_exclude_institutional_snp": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_institutional_snp"}, "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.quality_measures__int_nqf0034_exclude_hospice_palliative": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_hospice_palliative"}, "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_INSTITUTIONAL_HEADER_FAIL_DETAILS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details"}, "model.the_tuva_project.emergency_department__int_institutional_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_INSTITUTIONAL_CLAIMS", "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}, "CLAIM_START_DATE": {"type": "DATE", "index": 3, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 4, "name": "CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 5, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 6, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 9, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 10, "name": "FACILITY_NPI", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 11, "name": "CLAIM_TYPE", "comment": null}, "START_DATE": {"type": "DATE", "index": 12, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 13, "name": "END_DATE", "comment": null}, "DATE_USED_AS_START_DATE": {"type": "TEXT", "index": 14, "name": "DATE_USED_AS_START_DATE", "comment": null}, "DATE_USED_AS_END_DATE": {"type": "TEXT", "index": 15, "name": "DATE_USED_AS_END_DATE", "comment": null}, "DQ_PROBLEM": {"type": "NUMBER", "index": 16, "name": "DQ_PROBLEM", "comment": null}, "DQ_INSIGHT": {"type": "NUMBER", "index": 17, "name": "DQ_INSIGHT", "comment": null}, "START_DATE_NOT_DETERMINED": {"type": "NUMBER", "index": 18, "name": "START_DATE_NOT_DETERMINED", "comment": null}, "END_DATE_NOT_DETERMINED": {"type": "NUMBER", "index": 19, "name": "END_DATE_NOT_DETERMINED", "comment": null}, "START_DATE_AFTER_END_DATE": {"type": "NUMBER", "index": 20, "name": "START_DATE_AFTER_END_DATE", "comment": null}, "PATIENT_ID_NOT_UNIQUE": {"type": "NUMBER", "index": 21, "name": "PATIENT_ID_NOT_UNIQUE", "comment": null}, "PATIENT_ID_MISSING": {"type": "NUMBER", "index": 22, "name": "PATIENT_ID_MISSING", "comment": null}, "CLAIM_START_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 23, "name": "CLAIM_START_DATE_NOT_UNIQUE", "comment": null}, "CLAIM_START_DATE_MISSING": {"type": "NUMBER", "index": 24, "name": "CLAIM_START_DATE_MISSING", "comment": null}, "CLAIM_END_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 25, "name": "CLAIM_END_DATE_NOT_UNIQUE", "comment": null}, "CLAIM_END_DATE_MISSING": {"type": "NUMBER", "index": 26, "name": "CLAIM_END_DATE_MISSING", "comment": null}, "CLAIM_START_DATE_AFTER_CLAIM_END_DATE": {"type": "NUMBER", "index": 27, "name": "CLAIM_START_DATE_AFTER_CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 28, "name": "ADMISSION_DATE_NOT_UNIQUE", "comment": null}, "ADMISSION_DATE_MISSING": {"type": "NUMBER", "index": 29, "name": "ADMISSION_DATE_MISSING", "comment": null}, "DISCHARGE_DATE_NOT_UNIQUE": {"type": "NUMBER", "index": 30, "name": "DISCHARGE_DATE_NOT_UNIQUE", "comment": null}, "DISCHARGE_DATE_MISSING": {"type": "NUMBER", "index": 31, "name": "DISCHARGE_DATE_MISSING", "comment": null}, "ADMISSION_DATE_AFTER_DISCHARGE_DATE": {"type": "NUMBER", "index": 32, "name": "ADMISSION_DATE_AFTER_DISCHARGE_DATE", "comment": null}, "ADMIT_TYPE_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 33, "name": "ADMIT_TYPE_CODE_NOT_UNIQUE", "comment": null}, "ADMIT_TYPE_CODE_MISSING": {"type": "NUMBER", "index": 34, "name": "ADMIT_TYPE_CODE_MISSING", "comment": null}, "ADMIT_SOURCE_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 35, "name": "ADMIT_SOURCE_CODE_NOT_UNIQUE", "comment": null}, "ADMIT_SOURCE_CODE_MISSING": {"type": "NUMBER", "index": 36, "name": "ADMIT_SOURCE_CODE_MISSING", "comment": null}, "DISCHARGE_DISPOSITION_CODE_NOT_UNIQUE": {"type": "NUMBER", "index": 37, "name": "DISCHARGE_DISPOSITION_CODE_NOT_UNIQUE", "comment": null}, "DISCHARGE_DISPOSITION_CODE_MISSING": {"type": "NUMBER", "index": 38, "name": "DISCHARGE_DISPOSITION_CODE_MISSING", "comment": null}, "FACILITY_NPI_NOT_UNIQUE": {"type": "NUMBER", "index": 39, "name": "FACILITY_NPI_NOT_UNIQUE", "comment": null}, "FACILITY_NPI_MISSING": {"type": "NUMBER", "index": 40, "name": "FACILITY_NPI_MISSING", "comment": null}, "CLAIM_TYPE_NOT_UNIQUE": {"type": "NUMBER", "index": 41, "name": "CLAIM_TYPE_NOT_UNIQUE", "comment": null}, "CLAIM_TYPE_MISSING": {"type": "NUMBER", "index": 42, "name": "CLAIM_TYPE_MISSING", "comment": null}, "CLAIM_TYPE_NOT_INSTITUTIONAL": {"type": "NUMBER", "index": 43, "name": "CLAIM_TYPE_NOT_INSTITUTIONAL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 44, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 45, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__int_institutional_claims"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_NPI": {"type": "TEXT", "index": 6, "name": "FACILITY_NPI", "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.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}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__claims_preprocessing_pharmacy_claim_line_numbers": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_PHARMACY_CLAIM_LINE_NUMBERS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers"}, "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": "NUMBER", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 465920.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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}, "EXCLUSION_DATE": {"type": "DATE", "index": 6, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 7, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 8, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 10, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 11, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 12, "name": "MEASURE_VERSION", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.emergency_department__int_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_ENCOUNTER_ID", "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}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_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.emergency_department__int_encounter_id"}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_PROF_MISSING_VALUES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values"}, "model.the_tuva_project.insights__trend_sum_amount_by_service_category": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "TREND_SUM_AMOUNT_BY_SERVICE_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "SERVICE_CATEGORY_TYPE": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_TYPE", "comment": null}, "SERVICE_CATEGORY": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 4, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_PAID_AMOUNT_CHANGE": {"type": "NUMBER", "index": 5, "name": "TOTAL_PAID_AMOUNT_CHANGE", "comment": null}, "TOTAL_PAID_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 6, "name": "TOTAL_PAID_AMOUNT_PERCENT_CHANGE", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 7, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT_CHANGE": {"type": "NUMBER", "index": 8, "name": "TOTAL_ALLOWED_AMOUNT_CHANGE", "comment": null}, "TOTAL_ALLOWED_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 9, "name": "TOTAL_ALLOWED_AMOUNT_PERCENT_CHANGE", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 10, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT_CHANGE": {"type": "NUMBER", "index": 11, "name": "TOTAL_CHARGE_AMOUNT_CHANGE", "comment": null}, "TOTAL_CHARGE_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 12, "name": "TOTAL_CHARGE_AMOUNT_PERCENT_CHANGE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_service_category"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 221.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.quality_measures__int_nqf0034__frailty": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034__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}, "CONCEPT_NAME": {"type": "TEXT", "index": 3, "name": "CONCEPT_NAME", "comment": null}}, "stats": {"has_stats": {"id": "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__frailty"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__claims_preprocessing_eligibility_plausibility": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_ELIGIBILITY_PLAUSIBILITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TEST_NAME": {"type": "TEXT", "index": 1, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 2, "name": "PIPELINE_TEST", "comment": null}, "SOURCE_TABLE": {"type": "TEXT", "index": 3, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 5, "name": "TEST_CATEGORY", "comment": null}, "GRAIN": {"type": "TEXT", "index": 6, "name": "GRAIN", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 7, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility"}, "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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 72776.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1313792.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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_exclude_dementia": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_dementia"}, "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_VISIT_ALLOWED": {"type": "NUMBER", "index": 8, "name": "OFFICE_VISIT_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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__combined_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_COMBINED_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_claim_type_unmapped": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_CLAIM_TYPE_UNMAPPED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 39364.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 94208.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3882.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 105984.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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_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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_nqf2372__frailty": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372__FRAILTY", "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}, "EXCLUSION_DATE": {"type": "DATE", "index": 4, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 5, "name": "EXCLUSION_REASON", "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.quality_measures__int_nqf2372__frailty"}, "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}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.insights__trend_count_claim_by_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "TREND_COUNT_CLAIM_BY_CLAIM_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "DISTINCT_CLAIM_COUNT": {"type": "NUMBER", "index": 3, "name": "DISTINCT_CLAIM_COUNT", "comment": null}, "DISTINCT_CLAIM_COUNT_CHANGE": {"type": "NUMBER", "index": 4, "name": "DISTINCT_CLAIM_COUNT_CHANGE", "comment": null}, "DISTINCT_CLAIM_PERCENTAGE_CHANGE": {"type": "NUMBER", "index": 5, "name": "DISTINCT_CLAIM_PERCENTAGE_CHANGE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_claim_type"}, "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": "BOOLEAN", "index": 13, "name": "IS_IP_DEFAULT_CATEGORY", "comment": null}, "IS_OP_DEFAULT_CATEGORY": {"type": "BOOLEAN", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.data_quality__claims_preprocessing_summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIMS_PREPROCESSING_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 2, "name": "TEST_CATEGORY", "comment": null}, "COUNTS": {"type": "NUMBER", "index": 3, "name": "COUNTS", "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": 10.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_summary"}, "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_TEST_RESULT_STAGE_ELIGIBILITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 2, "name": "GRAIN", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 3, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 4, "name": "TEST_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 6, "name": "PIPELINE_TEST", "comment": null}, "FAILURES": {"type": "NUMBER", "index": 7, "name": "FAILURES", "comment": null}, "DENOMINATOR": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.core__stg_claims_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_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}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 5, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 6, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 7, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 8, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 13, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 14, "name": "DISCHARGE_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 15, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 16, "name": "SERVICE_CATEGORY_2", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 17, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 18, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 19, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 21, "name": "BILL_TYPE_CODE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 23, "name": "APR_DRG_CODE", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 24, "name": "REVENUE_CENTER_CODE", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 25, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 26, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 27, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 28, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 29, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 30, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 31, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 32, "name": "RENDERING_NPI", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 33, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 34, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 35, "name": "PAID_DATE", "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}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 39, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 40, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 41, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 42, "name": "TOTAL_COST_AMOUNT", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 961.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 16384.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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}, "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}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.acute_inpatient__professional_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_PROFESSIONAL_ENCOUNTER_ID", "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}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "START_DATE": {"type": "DATE", "index": 4, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 5, "name": "END_DATE", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_ID", "comment": null}, "ORPHAN_CLAIM_FLAG": {"type": "NUMBER", "index": 7, "name": "ORPHAN_CLAIM_FLAG", "comment": null}, "ENCOUNTER_COUNT": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__professional_encounter_id"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 78638.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1001472.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.insights__trend_sum_amount_by_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "TREND_SUM_AMOUNT_BY_CLAIM_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 3, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_PAID_AMOUNT_CHANGE": {"type": "NUMBER", "index": 4, "name": "TOTAL_PAID_AMOUNT_CHANGE", "comment": null}, "TOTAL_PAID_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 5, "name": "TOTAL_PAID_AMOUNT_PERCENT_CHANGE", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 6, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT_CHANGE": {"type": "NUMBER", "index": 7, "name": "TOTAL_ALLOWED_AMOUNT_CHANGE", "comment": null}, "TOTAL_ALLOWED_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 8, "name": "TOTAL_ALLOWED_AMOUNT_PERCENT_CHANGE", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 9, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT_CHANGE": {"type": "NUMBER", "index": 10, "name": "TOTAL_CHARGE_AMOUNT_CHANGE", "comment": null}, "TOTAL_CHARGE_AMOUNT_PERCENT_CHANGE": {"type": "NUMBER", "index": 11, "name": "TOTAL_CHARGE_AMOUNT_PERCENT_CHANGE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_claim_type"}, "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_VISIT_PAID": {"type": "NUMBER", "index": 9, "name": "OFFICE_VISIT_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 10, "name": "ANCILLARY_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 11, "name": "PHARMACY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 12, "name": "OTHER_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_PAID": {"type": "NUMBER", "index": 15, "name": "AMBULATORY_SURGERY_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}, "HOSPICE_PAID": {"type": "NUMBER", "index": 20, "name": "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}, "OFFICE_VISIT_PAID_2": {"type": "NUMBER", "index": 24, "name": "OFFICE_VISIT_PAID_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 25, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 26, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 27, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 28, "name": "SKILLED_NURSING_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 29, "name": "URGENT_CARE_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 30, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 31, "name": "MEDICAL_ALLOWED", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 32, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 33, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED": {"type": "NUMBER", "index": 34, "name": "OFFICE_VISIT_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 35, "name": "ANCILLARY_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 36, "name": "PHARMACY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 37, "name": "OTHER_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 38, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 39, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_ALLOWED": {"type": "NUMBER", "index": 40, "name": "AMBULATORY_SURGERY_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 41, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 42, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 43, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 44, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "HOSPICE_ALLOWED": {"type": "NUMBER", "index": 45, "name": "HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 46, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 47, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 48, "name": "LAB_ALLOWED", "comment": null}, "OFFICE_VISIT_ALLOWED_2": {"type": "NUMBER", "index": 49, "name": "OFFICE_VISIT_ALLOWED_2", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 50, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 51, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 52, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 53, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 54, "name": "URGENT_CARE_ALLOWED", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 14567.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 390144.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 9488588.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 68820480.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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__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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 50.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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}, "EXCLUSION_DATE": {"type": "DATE", "index": 6, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 7, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 8, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 10, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 11, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 12, "name": "MEASURE_VERSION", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.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}, "BILLING_NPI": {"type": "TEXT", "index": 30, "name": "BILLING_NPI", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 31, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 32, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 33, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 34, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 35, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 36, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 37, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 39, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 40, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 41, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 91, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 92, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 117, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 118, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 142, "name": "DATA_SOURCE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.acute_inpatient__summary": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ACUTE_INPATIENT_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "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_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 5, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 6, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 7, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 8, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 11, "name": "FACILITY_NPI", "comment": null}, "PROVIDER_FIRST_NAME": {"type": "TEXT", "index": 12, "name": "PROVIDER_FIRST_NAME", "comment": null}, "PROVIDER_LAST_NAME": {"type": "TEXT", "index": 13, "name": "PROVIDER_LAST_NAME", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 14, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 16, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 17, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 19, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 21, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 23, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "FLOAT", "index": 25, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "FLOAT", "index": 26, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "FLOAT", "index": 27, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 28, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 29, "name": "MORTALITY_FLAG", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__summary"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 18.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "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__claims_preprocessing_eligibility_missing_values": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_ELIGIBILITY_MISSING_VALUES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 72776.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1313792.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 47.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.insights__count_claim_by_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "INSIGHTS", "name": "COUNT_CLAIM_BY_CLAIM_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_TYPE": {"type": "TEXT", "index": 1, "name": "CLAIM_TYPE", "comment": null}, "DISTINCT_CLAIM_COUNT": {"type": "NUMBER", "index": 2, "name": "DISTINCT_CLAIM_COUNT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.insights__count_claim_by_claim_type"}, "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_EXCLUDE_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}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:58UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_exclude_dementia"}, "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:56UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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__claims_preprocessing_medical_claim_duplicates": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_INT_CLAIMS_PREPROCESSING_MEDICAL_CLAIM_DUPLICATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE_TABLE": {"type": "TEXT", "index": 1, "name": "SOURCE_TABLE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "GRAIN": {"type": "TEXT", "index": 3, "name": "GRAIN", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TEST_CATEGORY": {"type": "TEXT", "index": 6, "name": "TEST_CATEGORY", "comment": null}, "TEST_NAME": {"type": "TEXT", "index": 7, "name": "TEST_NAME", "comment": null}, "PIPELINE_TEST": {"type": "NUMBER", "index": 8, "name": "PIPELINE_TEST", "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.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates"}, "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}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 4, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 5, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 6, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 7, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 8, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 11, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 12, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 13, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 14, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 16, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 17, "name": "LAST_NAME", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 18, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 19, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 20, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 21, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 22, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 23, "name": "DATA_SOURCE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:55UTC", "include": true, "description": "The timestamp for last update/change"}, "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.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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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.quality_measures__int_nqf2372_exclude_institutional": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_INSTITUTIONAL", "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": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-02-21 19:57UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "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_institutional"}}, "sources": {}, "errors": null} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index ca1e6f883..0807e63fe 100644 --- a/docs/index.html +++ b/docs/index.html @@ -24,7 +24,7 @@
icons
- diff --git a/docs/manifest.json b/docs/manifest.json index 3cc5fba3a..d31bac49d 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v11.json", "dbt_version": "1.7.8", "generated_at": "2024-02-20T20:47:44.875867Z", "invocation_id": "de423a96-1d69-4b7f-8c18-885e2c4bbec4", "env": {}, "project_name": "input_layer", "project_id": "c67fdb5d91230d67641e7c60c81d655e", "user_id": "f44fa49c-dcce-4172-9303-93dd3e638f0a", "send_anonymous_usage_stats": true, "adapter_type": "snowflake"}, "nodes": {"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": "c92d7d6e8cdee32f1e4bc59cc1f1c496ee1c60a1798c38bd4f9a839fb2717ff3"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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\").", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.528076, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "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\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": "c0f8dcb63bbd8a89602af7d1991f7a22cbeb897b7a4fc5f53e138a9296f178b5"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.5262809, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "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\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": "7d020e526e3f5694de500ea5e9f81717c18b2becabfc1dff236b0ffd40adb12f"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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 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": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI 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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.515542, "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 facility_npi\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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_numeric"], "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 facility_npi\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\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": "982cfede679c0d134abc59c71a1c0aabffb2e5b01f2d84c122c717872f30cfc9"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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": []}, "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": []}, "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.485591, "relation_name": "tuva.input_layer.eligibility", "raw_code": "select\n patient_id\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\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 , 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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\nfrom raw._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": "189006551e2aa9380319cb756893be2e208dcdc18183369dba7415bc90b4b0e0"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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": []}, "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.507499, "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 , billing_npi\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 , data_source\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 , billing_npi\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 , data_source\nfrom raw._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": "9e6cd57222be5c6a03901fd513cdbdcd178e09f109de7c58b7afe513ae5c80ac"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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": []}, "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": []}, "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": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.509897, "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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\nfrom raw._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": "ba8647dc0bcb914db16e0a9e250a0dc8137e68ce45ab3239a634be2e52a4ac5c"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.520261, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_float"], "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\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": "ac6c7c9003e3ba687d20f4de3f3a049c14e446671a31c7d69f89970ffe599e3c"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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": []}, "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.525215, "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 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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_float"], "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 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\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": "9e67f9077ebefb43b868ea2c8fe3ff38a588ae4fe6cc5690614789f2df29fe6a"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.512842, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int"], "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\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": "1e22d2c43fdffbfca36c3f69b287c7a45a81d97366aa8ffe3314f1e3f02c0a4a"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.5226939, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int"], "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\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": "f811aa31586fe9cd5fce30d9b1160a415c09612da672b2957dd915dbfea5f030"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.524034, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "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\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": "2b70e3d7b8e2e7476af0eab32f835956d4a63d678b9cf9caa394030cb98da36f"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708461580.518657, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int"], "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\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": "raw", "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": "0f576b654df2062fa4770c70b5ee48bbf37333a5d8362500909ba7c280cbad63"}, "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)", "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)", "address": "varchar(255)", "city": "varchar(255)", "state": "varchar(255)", "zip_code": "varchar(255)", "phone": "varchar(255)", "data_source": "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)", "member_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)", "address": "varchar(255)", "city": "varchar(255)", "state": "varchar(255)", "zip_code": "varchar(255)", "phone": "varchar(255)", "data_source": "varchar(255)"}}, "created_at": 1708461580.4183092, "relation_name": "raw._tuva_synthetic.eligibility_seed", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.medical_claim_seed": {"database": "raw", "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": "b4abfdab9f7f5860d89707f27e7785218af75b4d3e66e24e6ec6b6d2307dcc3e"}, "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", "data_source": "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": {"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", "data_source": "varchar(255)"}}, "created_at": 1708461580.4597151, "relation_name": "raw._tuva_synthetic.medical_claim_seed", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.lab_result_seed": {"database": "raw", "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": "200211d64758e470275cc23e72be5ea67da2ed0355d3cf7cb950a84f6d121654"}, "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)", "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)", "tuva_last_run": "varchar(255)"}}, "created_at": 1708461580.426306, "relation_name": "raw._tuva_synthetic.lab_result_seed", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.pharmacy_claim_seed": {"database": "raw", "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": "66096b86d7bd198c82e3c67c5546791e094b980d06ab9379d00e3b58c054dfd0"}, "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", "data_source": "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": {"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", "data_source": "varchar(255)"}}, "created_at": 1708461580.4642649, "relation_name": "raw._tuva_synthetic.pharmacy_claim_seed", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "model.the_tuva_project.insights__count_claim_by_claim_type": {"database": "raw", "schema": "insights", "name": "insights__count_claim_by_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__count_claim_by_claim_type.sql", "original_file_path": "models/insights/final/insights__count_claim_by_claim_type.sql", "unique_id": "model.the_tuva_project.insights__count_claim_by_claim_type", "fqn": ["the_tuva_project", "insights", "final", "insights__count_claim_by_claim_type"], "alias": "count_claim_by_claim_type", "checksum": {"name": "sha256", "checksum": "aac53ff2bb99be715d6cad672ed44d502f2bf6ff0c6db695caa45600408b1b1f"}, "config": {"enabled": true, "alias": "count_claim_by_claim_type", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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}, "access": "protected", "bind": false, "columns": [{"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}]}, "tags": ["insights"], "description": "Count of distinct claims by claim type.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "count_claim_by_claim_type", "tags": ["insights"], "materialized": "table", "columns": [{"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}], "enabled": true, "bind": false}, "created_at": 1708461580.534857, "relation_name": "raw.insights.count_claim_by_claim_type", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect \r\n claim_type\r\n , count(distinct claim_id) as distinct_claim_count\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by claim_type\r\nunion all\r\nselect \r\n 'pharmacy'\r\n , count(distinct claim_id) as distinct_claim_count\r\nfrom {{ ref('core__pharmacy_claim') }}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__count_claim_by_claim_type.sql", "compiled": true, "compiled_code": "\n\n\nselect \n claim_type\n , count(distinct claim_id) as distinct_claim_count\nfrom raw.core.medical_claim\ngroup by claim_type\nunion all\nselect \n 'pharmacy'\n , count(distinct claim_id) as distinct_claim_count\nfrom raw.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.insights__count_claim_by_service_category": {"database": "raw", "schema": "insights", "name": "insights__count_claim_by_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__count_claim_by_service_category.sql", "original_file_path": "models/insights/final/insights__count_claim_by_service_category.sql", "unique_id": "model.the_tuva_project.insights__count_claim_by_service_category", "fqn": ["the_tuva_project", "insights", "final", "insights__count_claim_by_service_category"], "alias": "count_claim_by_service_category", "checksum": {"name": "sha256", "checksum": "bca04574d291a5ed9ef59871be58a9a0e1edd3fd413f42391be51a9cd89f04a6"}, "config": {"enabled": true, "alias": "count_claim_by_service_category", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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}, "access": "protected", "bind": false, "columns": [{"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}]}, "tags": ["insights"], "description": "Count of distinct claims by service category.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "count_claim_by_service_category", "tags": ["insights"], "materialized": "table", "columns": [{"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}], "enabled": true, "bind": false}, "created_at": 1708461580.538832, "relation_name": "raw.insights.count_claim_by_service_category", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect \r\n 'service_category_1' as service_category_type\r\n , service_category_1 as service_category\r\n , count(distinct claim_id) as distinct_claim_count\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by service_category_1\r\n\r\nunion all\r\n\r\nselect \r\n 'service_category_2' as service_category_type\r\n , service_category_2 as service_category\r\n , count(distinct claim_id) as distinct_claim_count\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by service_category_2", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"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/insights/final/insights__count_claim_by_service_category.sql", "compiled": true, "compiled_code": "\n\nselect \n 'service_category_1' as service_category_type\n , service_category_1 as service_category\n , count(distinct claim_id) as distinct_claim_count\nfrom raw.core.medical_claim\ngroup by service_category_1\n\nunion all\n\nselect \n 'service_category_2' as service_category_type\n , service_category_2 as service_category\n , count(distinct claim_id) as distinct_claim_count\nfrom raw.core.medical_claim\ngroup by service_category_2", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.insights__trend_count_claim_by_claim_type": {"database": "raw", "schema": "insights", "name": "insights__trend_count_claim_by_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__trend_count_claim_by_claim_type.sql", "original_file_path": "models/insights/final/insights__trend_count_claim_by_claim_type.sql", "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_claim_type", "fqn": ["the_tuva_project", "insights", "final", "insights__trend_count_claim_by_claim_type"], "alias": "trend_count_claim_by_claim_type", "checksum": {"name": "sha256", "checksum": "840c120c80c7edd82f4b970067c62781f8f517a7fde240f3dbfe0ed69f4b7ab4"}, "config": {"enabled": true, "alias": "trend_count_claim_by_claim_type", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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}, "access": "protected", "bind": false, "columns": [{"name": "year_month", "description": "Year and month of the claim end date."}, {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}, {"name": "distinct_claim_count_change", "description": "Change in distinct claim count from the previous year month."}, {"name": "distinct_claim_percentage_change", "description": "Percent in distinct claim count change from the previous year month."}]}, "tags": ["insights"], "description": "Monthly trend of distinct claims by claim type", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "trend_count_claim_by_claim_type", "tags": ["insights"], "materialized": "table", "columns": [{"name": "year_month", "description": "Year and month of the claim end date."}, {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}, {"name": "distinct_claim_count_change", "description": "Change in distinct claim count from the previous year month."}, {"name": "distinct_claim_percentage_change", "description": "Percent in distinct claim count change from the previous year month."}], "enabled": true, "bind": false}, "created_at": 1708461580.5458329, "relation_name": "raw.insights.trend_count_claim_by_claim_type", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith trend_by_claim_type as(\r\n select\r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , claim_type\r\n , count(distinct claim_id) as distinct_claim_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , claim_type\r\n)\r\n, trend_with_previous_count as(\r\n select \r\n year_month\r\n , claim_type\r\n , distinct_claim_count\r\n , lag(distinct_claim_count) over (partition by claim_type order by year_month) as previous_distinct_claim_count\r\n from trend_by_claim_type\r\n)\r\n\r\nselect\r\n year_month\r\n , claim_type\r\n , distinct_claim_count\r\n , distinct_claim_count - previous_distinct_claim_count as distinct_claim_count_change\r\n , case\r\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \r\n else distinct_claim_count\r\n end as distinct_claim_percentage_change\r\nfrom trend_with_previous_count", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__trend_count_claim_by_claim_type.sql", "compiled": true, "compiled_code": "\n\nwith trend_by_claim_type as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , claim_type\n , count(distinct claim_id) as distinct_claim_count\n from raw.core.medical_claim\n group by \n year_month\n , claim_type\n)\n, trend_with_previous_count as(\n select \n year_month\n , claim_type\n , distinct_claim_count\n , lag(distinct_claim_count) over (partition by claim_type order by year_month) as previous_distinct_claim_count\n from trend_by_claim_type\n)\n\nselect\n year_month\n , claim_type\n , distinct_claim_count\n , distinct_claim_count - previous_distinct_claim_count as distinct_claim_count_change\n , case\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \n else distinct_claim_count\n end as distinct_claim_percentage_change\nfrom trend_with_previous_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.insights__trend_sum_amount_by_claim_type": {"database": "raw", "schema": "insights", "name": "insights__trend_sum_amount_by_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__trend_sum_amount_by_claim_type.sql", "original_file_path": "models/insights/final/insights__trend_sum_amount_by_claim_type.sql", "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_claim_type", "fqn": ["the_tuva_project", "insights", "final", "insights__trend_sum_amount_by_claim_type"], "alias": "trend_sum_amount_by_claim_type", "checksum": {"name": "sha256", "checksum": "4e464a22d2d898b7d5fd096f3bd16bb3c57a887875544aef1e01c17ebd857ec6"}, "config": {"enabled": true, "alias": "trend_sum_amount_by_claim_type", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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}, "access": "protected", "bind": false, "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_paid_amount_change", "description": "Change in paid_amount from the previous month."}, {"name": "total_paid_amount_percent_change", "description": "Percent change in paid_amount from the previous month."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_allowed_amount_change", "description": "Change in allowed_amount from the previous month."}, {"name": "total_allowed_amount_percent_change", "description": "Percent change in allowed_amount from the previous month."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}, {"name": "total_charge_amount_change", "description": "Change in charge_amount from the previous month."}, {"name": "total_charge_amount_percent_change", "description": "Percent change in charge_amount from the previous month."}]}, "tags": ["insights"], "description": "Monthly trend of paid_amount, alllowed_amount, and charge_amount by claim type", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "trend_sum_amount_by_claim_type", "tags": ["insights"], "materialized": "table", "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_paid_amount_change", "description": "Change in paid_amount from the previous month."}, {"name": "total_paid_amount_percent_change", "description": "Percent change in paid_amount from the previous month."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_allowed_amount_change", "description": "Change in allowed_amount from the previous month."}, {"name": "total_allowed_amount_percent_change", "description": "Percent change in allowed_amount from the previous month."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}, {"name": "total_charge_amount_change", "description": "Change in charge_amount from the previous month."}, {"name": "total_charge_amount_percent_change", "description": "Percent change in charge_amount from the previous month."}], "enabled": true, "bind": false}, "created_at": 1708461580.5498428, "relation_name": "raw.insights.trend_sum_amount_by_claim_type", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith trend_by_medical_claim_type as(\r\n select\r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , claim_type\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , claim_type\r\n)\r\n, trend_by_pharmacy_claim_type as(\r\n select\r\n cast({{ date_part(\"year\", \"dispensing_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"dispensing_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , cast('pharmacy' as {{ dbt.type_string() }}) as claim_type\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , 0 as total_charge_amount\r\n from {{ ref('core__pharmacy_claim') }}\r\n group by \r\n year_month\r\n)\r\n, trend_with_previous_medical_sum as(\r\n select \r\n year_month\r\n , claim_type\r\n , total_paid_amount\r\n , lag(total_paid_amount) over (partition by claim_type order by year_month) as previous_total_paid_amount\r\n , total_allowed_amount\r\n , lag(total_allowed_amount) over (partition by claim_type order by year_month) as previous_total_allowed_amount\r\n , total_charge_amount\r\n , lag(total_charge_amount) over (partition by claim_type order by year_month) as previous_total_charge_amount\r\n from trend_by_medical_claim_type\r\n)\r\n, trend_with_previous_pharmacy_sum as(\r\n select \r\n year_month\r\n , claim_type\r\n , total_paid_amount\r\n , lag(total_paid_amount) over (partition by claim_type order by year_month) as previous_total_paid_amount\r\n , total_allowed_amount\r\n , lag(total_allowed_amount) over (partition by claim_type order by year_month) as previous_total_allowed_amount\r\n , total_charge_amount\r\n , lag(total_charge_amount) over (partition by claim_type order by year_month) as previous_total_charge_amount\r\n from trend_by_pharmacy_claim_type\r\n)\r\nselect\r\n year_month\r\n , claim_type\r\n , total_paid_amount\r\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\r\n , case \r\n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\r\n else total_paid_amount\r\n end as total_paid_amount_percent_change\r\n , total_allowed_amount\r\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\r\n , case \r\n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\r\n else total_allowed_amount\r\n end as total_allowed_amount_percent_change\r\n , total_charge_amount\r\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\r\n , case \r\n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\r\n else total_charge_amount\r\n end as total_charge_amount_percent_change\r\nfrom trend_with_previous_medical_sum\r\n\r\nunion all \r\n\r\nselect\r\n year_month\r\n , claim_type\r\n , total_paid_amount\r\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\r\n , case \r\n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\r\n else total_paid_amount\r\n end as total_paid_amount_percent_change\r\n , total_allowed_amount\r\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\r\n , case \r\n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\r\n else total_allowed_amount\r\n end as total_allowed_amount_percent_change\r\n , total_charge_amount\r\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\r\n , case \r\n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\r\n else total_charge_amount\r\n end as total_charge_amount_percent_change\r\nfrom trend_with_previous_pharmacy_sum", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__trend_sum_amount_by_claim_type.sql", "compiled": true, "compiled_code": "\n\nwith trend_by_medical_claim_type as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , claim_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 from raw.core.medical_claim\n group by \n year_month\n , claim_type\n)\n, trend_by_pharmacy_claim_type as(\n select\n cast(date_part('year', dispensing_date) as TEXT) || right('0'||cast(date_part('month', dispensing_date) as TEXT),2) as year_month\n , cast('pharmacy' as TEXT) as claim_type\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , 0 as total_charge_amount\n from raw.core.pharmacy_claim\n group by \n year_month\n)\n, trend_with_previous_medical_sum as(\n select \n year_month\n , claim_type\n , total_paid_amount\n , lag(total_paid_amount) over (partition by claim_type order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by claim_type order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by claim_type order by year_month) as previous_total_charge_amount\n from trend_by_medical_claim_type\n)\n, trend_with_previous_pharmacy_sum as(\n select \n year_month\n , claim_type\n , total_paid_amount\n , lag(total_paid_amount) over (partition by claim_type order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by claim_type order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by claim_type order by year_month) as previous_total_charge_amount\n from trend_by_pharmacy_claim_type\n)\nselect\n year_month\n , claim_type\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_medical_sum\n\nunion all \n\nselect\n year_month\n , claim_type\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_pharmacy_sum", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.insights__orphan_claim_by_claim_type": {"database": "raw", "schema": "insights", "name": "insights__orphan_claim_by_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__orphan_claim_by_claim_type.sql", "original_file_path": "models/insights/final/insights__orphan_claim_by_claim_type.sql", "unique_id": "model.the_tuva_project.insights__orphan_claim_by_claim_type", "fqn": ["the_tuva_project", "insights", "final", "insights__orphan_claim_by_claim_type"], "alias": "orphan_claim_by_claim_type", "checksum": {"name": "sha256", "checksum": "fc94f0c9fcdd42adfdb72bc8a8d971a77a148619d31beb093850f9c46d9f5f6c"}, "config": {"enabled": true, "alias": "orphan_claim_by_claim_type", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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}, "access": "protected", "bind": false, "columns": [{"name": "claim_category", "description": "The broader claim type a claim belongs to e.g. medical or pharmacy."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}]}, "tags": ["insights"], "description": "Count of medical and pharmacy claims without a corresponding eligibilty record.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "orphan_claim_by_claim_type", "tags": ["insights"], "materialized": "table", "columns": [{"name": "claim_category", "description": "The broader claim type a claim belongs to e.g. medical or pharmacy."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}], "enabled": true, "bind": false}, "created_at": 1708461580.5404558, "relation_name": "raw.insights.orphan_claim_by_claim_type", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith medical_claim_orphan as(\r\nselect\r\n 'medical_claim' as claim_category\r\n , claim_id\r\n , patient_id\r\n , cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\nfrom {{ ref('core__medical_claim') }}\r\n)\r\n\r\n, pharmacy_claim_orphan as(\r\nselect\r\n 'pharmacy_claim' as claim_category\r\n , claim_id\r\n , patient_id\r\n , cast({{ date_part(\"year\", \"dispensing_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"dispensing_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\nfrom {{ ref('core__pharmacy_claim') }}\r\n)\r\n, union_orphans as(\r\n select \r\n med.* \r\n from medical_claim_orphan med\r\n left join {{ ref('financial_pmpm__member_months') }} months\r\n on med.patient_id = months.patient_id\r\n and med.year_month = months.year_month\r\n where months.patient_id is null\r\n\r\n union all\r\n\r\n select \r\n med.* \r\n from pharmacy_claim_orphan med\r\n left join {{ ref('financial_pmpm__member_months') }} months\r\n on med.patient_id = months.patient_id\r\n and med.year_month = months.year_month\r\n where months.patient_id is null\r\n)\r\n\r\nselect\r\n claim_category\r\n , count(distinct claim_id) as distinct_claim_count\r\nfrom union_orphans\r\ngroup by claim_category", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "financial_pmpm__member_months", "package": null, "version": null}, {"name": "financial_pmpm__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.financial_pmpm__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__orphan_claim_by_claim_type.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim_orphan as(\nselect\n 'medical_claim' as claim_category\n , claim_id\n , patient_id\n , cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\nfrom raw.core.medical_claim\n)\n\n, pharmacy_claim_orphan as(\nselect\n 'pharmacy_claim' as claim_category\n , claim_id\n , patient_id\n , cast(date_part('year', dispensing_date) as TEXT) || right('0'||cast(date_part('month', dispensing_date) as TEXT),2) as year_month\nfrom raw.core.pharmacy_claim\n)\n, union_orphans as(\n select \n med.* \n from medical_claim_orphan med\n left join raw.financial_pmpm.member_months months\n on med.patient_id = months.patient_id\n and med.year_month = months.year_month\n where months.patient_id is null\n\n union all\n\n select \n med.* \n from pharmacy_claim_orphan med\n left join raw.financial_pmpm.member_months months\n on med.patient_id = months.patient_id\n and med.year_month = months.year_month\n where months.patient_id is null\n)\n\nselect\n claim_category\n , count(distinct claim_id) as distinct_claim_count\nfrom union_orphans\ngroup by claim_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.insights__count_claim_by_date_column": {"database": "raw", "schema": "insights", "name": "insights__count_claim_by_date_column", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__count_claim_by_date_column.sql", "original_file_path": "models/insights/final/insights__count_claim_by_date_column.sql", "unique_id": "model.the_tuva_project.insights__count_claim_by_date_column", "fqn": ["the_tuva_project", "insights", "final", "insights__count_claim_by_date_column"], "alias": "count_claim_by_date_column", "checksum": {"name": "sha256", "checksum": "2298b6ef62d6b803dfcd7a0ce609b04298c4ca07b1330076876862075febff90"}, "config": {"enabled": true, "alias": "count_claim_by_date_column", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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}, "access": "protected", "bind": false, "columns": [{"name": "year_month", "description": "Year and month of the claim end date or the member enrollment."}, {"name": "member_months", "description": "Count of unique member months."}, {"name": "claim_start_date", "description": "Count of unique medical claims."}, {"name": "claim_end_date", "description": "Count of unique medical claims."}, {"name": "admission_date", "description": "Count of unique medical claims."}, {"name": "discharge_date", "description": "Count of unique medical claims."}, {"name": "medical_paid_date", "description": "Count of unique medical claims."}, {"name": "dispensing_date", "description": "Count of unique pharmacy claims."}, {"name": "pharmacy_paid_date", "description": "Count of unique pharmacy claims."}]}, "tags": ["insights"], "description": "Count of distinct claims by multiple dates.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "count_claim_by_date_column", "tags": ["insights"], "materialized": "table", "columns": [{"name": "year_month", "description": "Year and month of the claim end date or the member enrollment."}, {"name": "member_months", "description": "Count of unique member months."}, {"name": "claim_start_date", "description": "Count of unique medical claims."}, {"name": "claim_end_date", "description": "Count of unique medical claims."}, {"name": "admission_date", "description": "Count of unique medical claims."}, {"name": "discharge_date", "description": "Count of unique medical claims."}, {"name": "medical_paid_date", "description": "Count of unique medical claims."}, {"name": "dispensing_date", "description": "Count of unique pharmacy claims."}, {"name": "pharmacy_paid_date", "description": "Count of unique pharmacy claims."}], "enabled": true, "bind": false}, "created_at": 1708461580.537142, "relation_name": "raw.insights.count_claim_by_date_column", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith date_stage as(\r\n\r\n select\r\n 'claim_start_date' as date_field\r\n , cast({{ date_part(\"year\", \"claim_start_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_start_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n\r\n union all\r\n\r\n select\r\n 'claim_end_date' as date_field\r\n , cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n union all\r\n\r\n select\r\n 'admission_date' as date_field\r\n , cast({{ date_part(\"year\", \"admission_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"admission_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n\r\n union all\r\n\r\n select\r\n 'discharge_date' as date_field\r\n , cast({{ date_part(\"year\", \"discharge_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"discharge_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n\r\n union all\r\n\r\n select\r\n 'medical paid_date' as date_field\r\n , cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n\r\n union all\r\n\r\n select\r\n 'dispensing_date' as date_field\r\n , cast({{ date_part(\"year\", \"dispensing_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"dispensing_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__pharmacy_claim') }}\r\n group by \r\n year_month\r\n\r\n union all\r\n\r\n select\r\n 'pharmacy paid_date' as date_field\r\n , cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__pharmacy_claim') }}\r\n group by \r\n year_month\r\n\r\n union all \r\n\r\n select\r\n 'member_months' as date_field\r\n , year_month\r\n , count(*) as distinct_count\r\n from {{ ref('financial_pmpm__member_months') }}\r\n group by\r\n year_month\r\n)\r\n\r\n\r\n, all_date_range as (\r\n select distinct \r\n replace(cal.year_month,'-','') as year_month\r\n from {{ ref('terminology__calendar') }} cal\r\n where (cal.year_month >= (select min(year_month) from date_stage)\r\n and cal.year_month <= (select max(year_month) from date_stage))\r\n \r\n)\r\n\r\nselect\r\n cast(all_date.year_month as {{ dbt.type_int() }} ) as year_month\r\n , member_months.distinct_count as member_months\r\n , claim_start.distinct_count as claim_start_date\r\n , claim_end.distinct_count as claim_end_date\r\n , admission_date.distinct_count as admission_date\r\n , discharge_date.distinct_count as discharge_date\r\n , med_paid_date.distinct_count as medical_paid_date\r\n , dispensing_date.distinct_count as dispensing_date\r\n , pharm_paid_date.distinct_count as pharmacy_paid_date\r\nfrom all_date_range all_date\r\nleft join date_stage member_months\r\n on all_date.year_month = member_months.year_month\r\n and member_months.date_field = 'member_months'\r\nleft join date_stage claim_start\r\n on all_date.year_month = claim_start.year_month\r\n and claim_start.date_field = 'claim_start_date'\r\nleft join date_stage claim_end\r\n on all_date.year_month = claim_end.year_month\r\n and claim_end.date_field = 'claim_end_date'\r\nleft join date_stage admission_date\r\n on all_date.year_month = admission_date.year_month\r\n and admission_date.date_field = 'admission_date'\r\nleft join date_stage discharge_date\r\n on all_date.year_month = discharge_date.year_month\r\n and discharge_date.date_field = 'discharge_date'\r\nleft join date_stage med_paid_date\r\n on all_date.year_month = med_paid_date.year_month\r\n and med_paid_date.date_field = 'medical paid_date'\r\nleft join date_stage dispensing_date\r\n on all_date.year_month = dispensing_date.year_month\r\n and dispensing_date.date_field = 'dispensing_date'\r\nleft join date_stage pharm_paid_date\r\n on all_date.year_month = pharm_paid_date.year_month\r\n and pharm_paid_date.date_field = 'pharmacy paid_date'", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "financial_pmpm__member_months", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.financial_pmpm__member_months", "seed.the_tuva_project.terminology__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__count_claim_by_date_column.sql", "compiled": true, "compiled_code": "\n\nwith date_stage as(\n\n select\n 'claim_start_date' as date_field\n , cast(date_part('year', claim_start_date) as TEXT) || right('0'||cast(date_part('month', claim_start_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'claim_end_date' as date_field\n , cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.medical_claim\n group by \n year_month\n union all\n\n select\n 'admission_date' as date_field\n , cast(date_part('year', admission_date) as TEXT) || right('0'||cast(date_part('month', admission_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'discharge_date' as date_field\n , cast(date_part('year', discharge_date) as TEXT) || right('0'||cast(date_part('month', discharge_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'medical paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) || right('0'||cast(date_part('month', paid_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'dispensing_date' as date_field\n , cast(date_part('year', dispensing_date) as TEXT) || right('0'||cast(date_part('month', dispensing_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.pharmacy_claim\n group by \n year_month\n\n union all\n\n select\n 'pharmacy paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) || right('0'||cast(date_part('month', paid_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.pharmacy_claim\n group by \n year_month\n\n union all \n\n select\n 'member_months' as date_field\n , year_month\n , count(*) as distinct_count\n from raw.financial_pmpm.member_months\n group by\n year_month\n)\n\n\n, all_date_range as (\n select distinct \n replace(cal.year_month,'-','') as year_month\n from raw.terminology.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 , member_months.distinct_count as member_months\n , claim_start.distinct_count as claim_start_date\n , claim_end.distinct_count as claim_end_date\n , admission_date.distinct_count as admission_date\n , discharge_date.distinct_count as discharge_date\n , med_paid_date.distinct_count as medical_paid_date\n , dispensing_date.distinct_count as dispensing_date\n , pharm_paid_date.distinct_count as pharmacy_paid_date\nfrom all_date_range all_date\nleft join date_stage member_months\n on all_date.year_month = member_months.year_month\n and member_months.date_field = 'member_months'\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.insights__trend_sum_amount_by_service_category": {"database": "raw", "schema": "insights", "name": "insights__trend_sum_amount_by_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__trend_sum_amount_by_service_category.sql", "original_file_path": "models/insights/final/insights__trend_sum_amount_by_service_category.sql", "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_service_category", "fqn": ["the_tuva_project", "insights", "final", "insights__trend_sum_amount_by_service_category"], "alias": "trend_sum_amount_by_service_category", "checksum": {"name": "sha256", "checksum": "d1729b1b296fed0f471e170e1314fafbdbcacbab452faed47fb0731e2fc5f1e8"}, "config": {"enabled": true, "alias": "trend_sum_amount_by_service_category", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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}, "access": "protected", "bind": false, "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_paid_amount_change", "description": "Change in paid_amount from the previous month."}, {"name": "total_paid_amount_percent_change", "description": "Percent change in paid_amount from the previous month."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_allowed_amount_change", "description": "Change in allowed_amount from the previous month."}, {"name": "total_allowed_amount_percent_change", "description": "Percent change in allowed_amount from the previous month."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}, {"name": "total_charge_amount_change", "description": "Change in charge_amount from the previous month."}, {"name": "total_charge_amount_percent_change", "description": "Percent change in charge_amount from the previous month."}]}, "tags": ["insights"], "description": "Monthly trend of paid_amount, alllowed_amount, and charge_amount by service category", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "trend_sum_amount_by_service_category", "tags": ["insights"], "materialized": "table", "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_paid_amount_change", "description": "Change in paid_amount from the previous month."}, {"name": "total_paid_amount_percent_change", "description": "Percent change in paid_amount from the previous month."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_allowed_amount_change", "description": "Change in allowed_amount from the previous month."}, {"name": "total_allowed_amount_percent_change", "description": "Percent change in allowed_amount from the previous month."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}, {"name": "total_charge_amount_change", "description": "Change in charge_amount from the previous month."}, {"name": "total_charge_amount_percent_change", "description": "Percent change in charge_amount from the previous month."}], "enabled": true, "bind": false}, "created_at": 1708461580.551151, "relation_name": "raw.insights.trend_sum_amount_by_service_category", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith trend_by_service_category_1 as(\r\n select\r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , 'service_category_1' as service_category_type\r\n , service_category_1 as service_category\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , service_category_1\r\n)\r\n, trend_by_service_category_2 as(\r\n select\r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , 'service_category_2' as service_category_type\r\n , service_category_2 as service_category\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , service_category_2\r\n)\r\n, trend_with_previous_service_category_1_sum as(\r\n select \r\n year_month\r\n , service_category_type\r\n , service_category\r\n , total_paid_amount\r\n , lag(total_paid_amount) over (partition by service_category order by year_month) as previous_total_paid_amount\r\n , total_allowed_amount\r\n , lag(total_allowed_amount) over (partition by service_category order by year_month) as previous_total_allowed_amount\r\n , total_charge_amount\r\n , lag(total_charge_amount) over (partition by service_category order by year_month) as previous_total_charge_amount\r\n from trend_by_service_category_1\r\n)\r\n, trend_with_previous_service_category_2_sum as(\r\n select \r\n year_month\r\n , service_category_type\r\n , service_category\r\n , total_paid_amount\r\n , lag(total_paid_amount) over (partition by service_category order by year_month) as previous_total_paid_amount\r\n , total_allowed_amount\r\n , lag(total_allowed_amount) over (partition by service_category order by year_month) as previous_total_allowed_amount\r\n , total_charge_amount\r\n , lag(total_charge_amount) over (partition by service_category order by year_month) as previous_total_charge_amount\r\n from trend_by_service_category_2\r\n)\r\nselect\r\n year_month\r\n , service_category_type\r\n , service_category\r\n , total_paid_amount\r\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\r\n , case \r\n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\r\n else total_paid_amount\r\n end as total_paid_amount_percent_change\r\n , total_allowed_amount\r\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\r\n , case \r\n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\r\n else total_allowed_amount\r\n end as total_allowed_amount_percent_change\r\n , total_charge_amount\r\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\r\n , case \r\n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\r\n else total_charge_amount\r\n end as total_charge_amount_percent_change\r\nfrom trend_with_previous_service_category_1_sum\r\n\r\nunion all \r\n\r\nselect\r\n year_month\r\n , service_category_type\r\n , service_category\r\n , total_paid_amount\r\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\r\n , case \r\n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\r\n else total_paid_amount\r\n end as total_paid_amount_percent_change\r\n , total_allowed_amount\r\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\r\n , case \r\n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\r\n else total_allowed_amount\r\n end as total_allowed_amount_percent_change\r\n , total_charge_amount\r\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\r\n , case \r\n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\r\n else total_charge_amount\r\n end as total_charge_amount_percent_change\r\nfrom trend_with_previous_service_category_2_sum", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__trend_sum_amount_by_service_category.sql", "compiled": true, "compiled_code": "\n\n\nwith trend_by_service_category_1 as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , 'service_category_1' as service_category_type\n , service_category_1 as service_category\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 from raw.core.medical_claim\n group by \n year_month\n , service_category_1\n)\n, trend_by_service_category_2 as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , 'service_category_2' as service_category_type\n , service_category_2 as service_category\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 from raw.core.medical_claim\n group by \n year_month\n , service_category_2\n)\n, trend_with_previous_service_category_1_sum as(\n select \n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , lag(total_paid_amount) over (partition by service_category order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by service_category order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by service_category order by year_month) as previous_total_charge_amount\n from trend_by_service_category_1\n)\n, trend_with_previous_service_category_2_sum as(\n select \n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , lag(total_paid_amount) over (partition by service_category order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by service_category order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by service_category order by year_month) as previous_total_charge_amount\n from trend_by_service_category_2\n)\nselect\n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_service_category_1_sum\n\nunion all \n\nselect\n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_service_category_2_sum", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.insights__sum_amount_by_claim_type": {"database": "raw", "schema": "insights", "name": "insights__sum_amount_by_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__sum_amount_by_claim_type.sql", "original_file_path": "models/insights/final/insights__sum_amount_by_claim_type.sql", "unique_id": "model.the_tuva_project.insights__sum_amount_by_claim_type", "fqn": ["the_tuva_project", "insights", "final", "insights__sum_amount_by_claim_type"], "alias": "sum_amount_by_claim_type", "checksum": {"name": "sha256", "checksum": "1850231cfaf383fe60720e0636c24cd3a351e593aa2956e28565c008303a171d"}, "config": {"enabled": true, "alias": "sum_amount_by_claim_type", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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}, "access": "protected", "bind": false, "columns": [{"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}]}, "tags": ["insights"], "description": "Sum of paid_amount, allowed_amount, and charge_amount by claim type", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "sum_amount_by_claim_type", "tags": ["insights"], "materialized": "table", "columns": [{"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}], "enabled": true, "bind": false}, "created_at": 1708461580.5425038, "relation_name": "raw.insights.sum_amount_by_claim_type", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect \r\n claim_type\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by claim_type\r\n\r\nunion all\r\n\r\nselect \r\n 'pharmacy'\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , null as total_charge_amount\r\nfrom {{ ref('core__pharmacy_claim') }}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__sum_amount_by_claim_type.sql", "compiled": true, "compiled_code": "\n\nselect \n claim_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\nfrom raw.core.medical_claim\ngroup by claim_type\n\nunion all\n\nselect \n 'pharmacy'\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , null as total_charge_amount\nfrom raw.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.insights__sum_amount_by_service_category": {"database": "raw", "schema": "insights", "name": "insights__sum_amount_by_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__sum_amount_by_service_category.sql", "original_file_path": "models/insights/final/insights__sum_amount_by_service_category.sql", "unique_id": "model.the_tuva_project.insights__sum_amount_by_service_category", "fqn": ["the_tuva_project", "insights", "final", "insights__sum_amount_by_service_category"], "alias": "sum_amount_by_service_category", "checksum": {"name": "sha256", "checksum": "d6b11197aed8609cfdb1117b04d8c31dabdd622025616b92b2d82264f9436cf8"}, "config": {"enabled": true, "alias": "sum_amount_by_service_category", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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}, "access": "protected", "bind": false, "columns": [{"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}]}, "tags": ["insights"], "description": "Sum of paid_amount, allowed_amount, and charge_amount by service category", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "sum_amount_by_service_category", "tags": ["insights"], "materialized": "table", "columns": [{"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}], "enabled": true, "bind": false}, "created_at": 1708461580.543791, "relation_name": "raw.insights.sum_amount_by_service_category", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect\r\n 'service_category_1' as service_category_type\r\n , service_category_1\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by service_category_1\r\n\r\nunion all\r\n\r\nselect\r\n 'service_category_2' as service_category_type\r\n , service_category_2\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by service_category_2", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"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/insights/final/insights__sum_amount_by_service_category.sql", "compiled": true, "compiled_code": "\n\nselect\n 'service_category_1' as service_category_type\n , service_category_1\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\nfrom raw.core.medical_claim\ngroup by service_category_1\n\nunion all\n\nselect\n 'service_category_2' as service_category_type\n , service_category_2\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\nfrom raw.core.medical_claim\ngroup by service_category_2", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.insights__trend_count_claim_by_service_category": {"database": "raw", "schema": "insights", "name": "insights__trend_count_claim_by_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__trend_count_claim_by_service_category.sql", "original_file_path": "models/insights/final/insights__trend_count_claim_by_service_category.sql", "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_service_category", "fqn": ["the_tuva_project", "insights", "final", "insights__trend_count_claim_by_service_category"], "alias": "trend_count_claim_by_service_category", "checksum": {"name": "sha256", "checksum": "f3ca33dfdd8f451c8c44b16b2b2037d08430e93eb153e92965b8593be400562e"}, "config": {"enabled": true, "alias": "trend_count_claim_by_service_category", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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}, "access": "protected", "bind": false, "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}, {"name": "distinct_claim_count_change", "description": "Change in distinct claim count from the previous year month."}, {"name": "distinct_claim_percentage_change", "description": "Percent in distinct claim count change from the previous year month."}]}, "tags": ["insights"], "description": "Monthly trend of distinct claims by service category", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "trend_count_claim_by_service_category", "tags": ["insights"], "materialized": "table", "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}, {"name": "distinct_claim_count_change", "description": "Change in distinct claim count from the previous year month."}, {"name": "distinct_claim_percentage_change", "description": "Percent in distinct claim count change from the previous year month."}], "enabled": true, "bind": false}, "created_at": 1708461580.54712, "relation_name": "raw.insights.trend_count_claim_by_service_category", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith trend_by_service_category_1 as (\r\n select \r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , service_category_1\r\n , count(distinct claim_id) as distinct_claim_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , service_category_1\r\n)\r\n, trend_by_service_category_2 as (\r\n select \r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , service_category_2\r\n , count(distinct claim_id) as distinct_claim_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , service_category_2\r\n)\r\n, previous_service_category_1_claim_count as(\r\n select\r\n year_month\r\n , service_category_1\r\n , distinct_claim_count\r\n , lag(distinct_claim_count) over (partition by service_category_1 order by year_month) as previous_distinct_claim_count\r\n from trend_by_service_category_1\r\n)\r\n, previous_service_category_2_claim_count as(\r\n select\r\n year_month\r\n , service_category_2\r\n , distinct_claim_count\r\n , lag(distinct_claim_count) over (partition by service_category_2 order by year_month) as previous_distinct_claim_count\r\n from trend_by_service_category_2\r\n)\r\nselect \r\n year_month\r\n , service_category_1 as service_category\r\n , distinct_claim_count\r\n , distinct_claim_count-previous_distinct_claim_count as distinct_claim_count_change\r\n , case\r\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \r\n else distinct_claim_count\r\n end as distinct_claim_percentage_change\r\nfrom previous_service_category_1_claim_count\r\n\r\n union all\r\n\r\n select \r\n year_month\r\n , service_category_2 as service_category\r\n , distinct_claim_count\r\n , distinct_claim_count-previous_distinct_claim_count as distinct_claim_count_change\r\n , case\r\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \r\n else distinct_claim_count\r\n end as distinct_claim_percentage_change\r\nfrom previous_service_category_2_claim_count", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__trend_count_claim_by_service_category.sql", "compiled": true, "compiled_code": "\n\nwith trend_by_service_category_1 as (\n select \n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , service_category_1\n , count(distinct claim_id) as distinct_claim_count\n from raw.core.medical_claim\n group by \n year_month\n , service_category_1\n)\n, trend_by_service_category_2 as (\n select \n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , service_category_2\n , count(distinct claim_id) as distinct_claim_count\n from raw.core.medical_claim\n group by \n year_month\n , service_category_2\n)\n, previous_service_category_1_claim_count as(\n select\n year_month\n , service_category_1\n , distinct_claim_count\n , lag(distinct_claim_count) over (partition by service_category_1 order by year_month) as previous_distinct_claim_count\n from trend_by_service_category_1\n)\n, previous_service_category_2_claim_count as(\n select\n year_month\n , service_category_2\n , distinct_claim_count\n , lag(distinct_claim_count) over (partition by service_category_2 order by year_month) as previous_distinct_claim_count\n from trend_by_service_category_2\n)\nselect \n year_month\n , service_category_1 as service_category\n , distinct_claim_count\n , distinct_claim_count-previous_distinct_claim_count as distinct_claim_count_change\n , case\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \n else distinct_claim_count\n end as distinct_claim_percentage_change\nfrom previous_service_category_1_claim_count\n\n union all\n\n select \n year_month\n , service_category_2 as service_category\n , distinct_claim_count\n , distinct_claim_count-previous_distinct_claim_count as distinct_claim_count_change\n , case\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \n else distinct_claim_count\n end as distinct_claim_percentage_change\nfrom previous_service_category_2_claim_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.medical_claim_expanded": {"database": "raw", "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": "69979f61d8ec6cb46e490030a14fd4e3941a0ba6152404e2e7741f7c73d8f702"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_expanded"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.5522828, "relation_name": "raw.claims_expanded.medical_claim_expanded", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\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": "raw", "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": "6b456d0042528c7fd5a822cd48dac1386771fc763bb555dfee64d2cbbfd57509"}, "config": {"enabled": true, "alias": "_stg_claims_encounter", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core claims encounters", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "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", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.575789, "relation_name": "raw.core._stg_claims_encounter", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the encounter table in core.\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('acute inpatient' as {{ dbt.type_string() }} ) as encounter_type\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(facility_npi as {{ dbt.type_string() }} ) as facility_npi\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(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('acute_inpatient__summary') }} \n\nunion all \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('emergency department' as {{ dbt.type_string() }} ) as encounter_type\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(facility_npi as {{ dbt.type_string() }} ) as facility_npi\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(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('emergency_department__summary') }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_summary", "package": null, "version": null}, {"name": "acute_inpatient__summary", "package": null, "version": null}, {"name": "emergency_department__summary", "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.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.emergency_department__summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_encounter.sql", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\n\n\n\n-- *************************************************\n-- This dbt model creates the encounter table in core.\n-- *************************************************\n\nselect\n cast(encounter_id as TEXT ) as encounter_id\n , cast(patient_id as TEXT ) as patient_id\n , cast('acute inpatient' as TEXT ) as encounter_type\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(facility_npi as TEXT ) as facility_npi\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(data_source as TEXT ) as data_source\n , cast('2024-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom raw.claims_preprocessing.acute_inpatient_summary \n\nunion all \n\nselect\n cast(encounter_id as TEXT ) as encounter_id\n , cast(patient_id as TEXT ) as patient_id\n , cast('emergency department' as TEXT ) as encounter_type\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(facility_npi as TEXT ) as facility_npi\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(data_source as TEXT ) as data_source\n , cast('2024-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom raw.claims_preprocessing.emergency_department_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.core__stg_clinical_condition": {"database": "raw", "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": "d3889d8a95c2317831b0269c43788072e3e59a2c3c45d2ea457dcd50a56519c6"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.587439, "relation_name": "raw.core._stg_clinical_condition", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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-02-20 20:47:44.615990+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": "raw", "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": "80a8f62f2dc605f4c8162227431692accab2daf6f617c40560afdc8987c89ef0"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.577012, "relation_name": "raw.core._stg_claims_location", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\r\n\r\n{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\nwith all_providers_in_claims_dataset as (\r\nselect distinct facility_npi as npi, data_source\r\nfrom {{ ref('core__stg_claims_medical_claim') }}\r\n\r\nunion all\r\n\r\nselect distinct rendering_npi as npi, data_source\r\nfrom {{ ref('core__stg_claims_medical_claim') }}\r\n\r\nunion all\r\n\r\nselect distinct billing_npi as npi, data_source\r\nfrom {{ ref('core__stg_claims_medical_claim') }}\r\n),\r\n\r\n\r\nprovider as (\r\nselect aa.*, bb.data_source\r\nfrom {{ ref('terminology__provider') }} aa\r\ninner join all_providers_in_claims_dataset bb\r\non aa.npi = bb.npi\r\nwhere lower(aa.entity_type_description) = 'organization'\r\n)\r\n\r\n\r\n\r\nselect \r\n cast(npi as {{ dbt.type_string() }} ) as location_id\r\n , cast(npi as {{ dbt.type_string() }} ) as npi\r\n , cast(provider_organization_name as {{ dbt.type_string() }} ) as name\r\n , cast(null as {{ dbt.type_string() }} ) as facility_type\r\n , cast(parent_organization_name as {{ dbt.type_string() }} ) as parent_organization\r\n , cast(practice_address_line_1 as {{ dbt.type_string() }} ) as address\r\n , cast(practice_city as {{ dbt.type_string() }} ) as city\r\n , cast(practice_state as {{ dbt.type_string() }} ) as state\r\n , cast(practice_zip_code as {{ dbt.type_string() }} ) as zip_code\r\n , cast(null as {{ dbt.type_float() }} ) as latitude\r\n , cast(null 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 provider", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_summary", "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_medical_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.data_quality__claims_preprocessing_summary", "model.the_tuva_project.core__stg_claims_medical_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": "-- depends_on: raw.data_quality.claims_preprocessing_summary\n\n\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct rendering_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct billing_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom raw.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-02-20 20:47:44.615990+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": "raw", "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": "98f89acd71abd7f9cb7bd970ea5c25346781c7f96979c983923b2e65ca087c26"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.586092, "relation_name": "raw.core._stg_claims_practitioner", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\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_npi as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\nunion all\n\nselect distinct rendering_npi as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\nunion all\n\nselect distinct billing_npi as npi, data_source\nfrom {{ ref('core__stg_claims_medical_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": "data_quality__claims_preprocessing_summary", "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_medical_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.data_quality__claims_preprocessing_summary", "model.the_tuva_project.core__stg_claims_medical_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": "-- depends_on: raw.data_quality.claims_preprocessing_summary\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_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct rendering_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct billing_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom raw.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-02-20 20:47:44.615990+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": "raw", "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": "9bd0664acba7fa0fd6f901f52f8431618c5cdc5292c6669837e4e5064574d954"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.584876, "relation_name": "raw.core._stg_claims_eligibility", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(member_id as {{ dbt.type_string() }} ) as member_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 , cast(plan as {{ dbt.type_string() }} ) as 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(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": "data_quality__claims_preprocessing_summary", "package": null, "version": null}, {"name": "normalized_input__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "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": "-- depends_on: raw.data_quality.claims_preprocessing_summary\n\n\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_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 , cast(plan as TEXT ) as 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(data_source as TEXT ) as data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "63a3710e40a80c23aa5f49ca10271c696f08ff49a8c0a56067cbcc1223c9d761"}, "config": {"enabled": true, "alias": "_stg_claims_medical_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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core medical claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "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", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.574563, "relation_name": "raw.core._stg_claims_medical_claim", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\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\n\nselect\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(coalesce(ap.encounter_id,ed.encounter_id) as {{ dbt.type_string() }} ) as encounter_id \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 , cast(med.plan as {{ dbt.type_string() }} ) as 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(med.admit_source_code as {{ dbt.type_string() }} ) as admit_source_code\n , cast(med.admit_type_code as {{ dbt.type_string() }} ) as admit_type_code\n , cast(med.discharge_disposition_code as {{ dbt.type_string() }} ) as discharge_disposition_code\n , cast(med.place_of_service_code as {{ dbt.type_string() }} ) as place_of_service_code\n , cast(med.bill_type_code as {{ dbt.type_string() }} ) as bill_type_code\n , cast(med.ms_drg_code as {{ dbt.type_string() }} ) as ms_drg_code\n , cast(med.apr_drg_code as {{ dbt.type_string() }} ) as apr_drg_code\n , cast(med.revenue_center_code as {{ dbt.type_string() }} ) as revenue_center_code\n , cast(med.service_unit_quantity as {{ dbt.type_int() }} ) 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_npi as {{ dbt.type_string() }} ) as rendering_npi\n , cast(med.billing_npi as {{ dbt.type_string() }} ) as billing_npi\n , cast(med.facility_npi as {{ dbt.type_string() }} ) as facility_npi\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.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') }} med\nleft join {{ ref('service_category__service_category_grouper') }} srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\nleft join {{ ref('acute_inpatient__encounter_id') }} ap\n on med.claim_id = ap.claim_id\n and med.claim_line_number = ap.claim_line_number\nleft join {{ ref('emergency_department__int_encounter_id') }} ed\n on med.claim_id = ed.claim_id\n and med.claim_line_number = ed.claim_line_number", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_summary", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "acute_inpatient__encounter_id", "package": null, "version": null}, {"name": "emergency_department__int_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_numeric", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.emergency_department__int_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_medical_claim.sql", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\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\n\nselect\n cast(med.claim_id as TEXT ) as claim_id\n , cast(med.claim_line_number as integer ) as claim_line_number\n , cast(coalesce(ap.encounter_id,ed.encounter_id) as TEXT ) as encounter_id \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 , cast(med.plan as TEXT ) as 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(med.admit_source_code as TEXT ) as admit_source_code\n , cast(med.admit_type_code as TEXT ) as admit_type_code\n , cast(med.discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(med.place_of_service_code as TEXT ) as place_of_service_code\n , cast(med.bill_type_code as TEXT ) as bill_type_code\n , cast(med.ms_drg_code as TEXT ) as ms_drg_code\n , cast(med.apr_drg_code as TEXT ) as apr_drg_code\n , cast(med.revenue_center_code as TEXT ) as revenue_center_code\n , cast(med.service_unit_quantity as integer ) 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_npi as TEXT ) as rendering_npi\n , cast(med.billing_npi as TEXT ) as billing_npi\n , cast(med.facility_npi as TEXT ) as facility_npi\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.data_source as TEXT ) as data_source\n , cast('2024-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim med\nleft join raw.claims_preprocessing.service_category_grouper srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\nleft join raw.claims_preprocessing._int_acute_inpatient_encounter_id ap\n on med.claim_id = ap.claim_id\n and med.claim_line_number = ap.claim_line_number\nleft join raw.claims_preprocessing._int_emergency_department_encounter_id ed\n on med.claim_id = ed.claim_id\n and med.claim_line_number = ed.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": "raw", "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": "a96f8b5cb3af832db76032dad987449d33dd33358700051dbad46944ad1db4d0"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.581318, "relation_name": "raw.core._stg_claims_procedure", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\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 , 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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 \nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 \nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 cast(\n unpivot_cte.data_source\n ||'_'\n ||unpivot_cte.claim_id\n ||'_'\n ||unpivot_cte.source_code\n ||case when unpivot_cte.modifier_1 is not null then '_'||unpivot_cte.modifier_1 else '' end\n ||case when unpivot_cte.modifier_2 is not null then '_'||unpivot_cte.modifier_2 else '' end\n ||case when unpivot_cte.modifier_3 is not null then '_'||unpivot_cte.modifier_3 else '' end\n ||case when unpivot_cte.modifier_4 is not null then '_'||unpivot_cte.modifier_4 else '' end\n ||case when unpivot_cte.modifier_5 is not null then '_'||unpivot_cte.modifier_5 else '' end\n ||case when unpivot_cte.practitioner_npi is not null then '_'||unpivot_cte.practitioner_npi else '' end\n as {{ dbt.type_string() }} ) as procedure_id\n , cast(unpivot_cte.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(coalesce(ap.encounter_id, ed.encounter_id) as {{ dbt.type_string() }} ) as encounter_id\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\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\nleft join {{ ref('acute_inpatient__encounter_id')}} as ap\n on unpivot_cte.claim_id = ap.claim_id\nleft join {{ ref('emergency_department__int_encounter_id')}} as ed\n on unpivot_cte.claim_id = ed.claim_id", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_summary", "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": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}, {"name": "acute_inpatient__encounter_id", "package": null, "version": null}, {"name": "emergency_department__int_encounter_id", "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.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__hcpcs_level_2", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.emergency_department__int_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_procedure.sql", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\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 , 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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere hcpcs_code is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_1 is not null\n \nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_2 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_3 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_4 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_5 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_6 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_7 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_8 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_9 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_10 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_11 is not null\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_12 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_13 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_14 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_15 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_16 is not null\n \nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_17 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_18 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_19 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_20 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_21 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_22 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_23 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_24 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_25 is not null\n\n)\n\nselect distinct\n cast(\n unpivot_cte.data_source\n ||'_'\n ||unpivot_cte.claim_id\n ||'_'\n ||unpivot_cte.source_code\n ||case when unpivot_cte.modifier_1 is not null then '_'||unpivot_cte.modifier_1 else '' end\n ||case when unpivot_cte.modifier_2 is not null then '_'||unpivot_cte.modifier_2 else '' end\n ||case when unpivot_cte.modifier_3 is not null then '_'||unpivot_cte.modifier_3 else '' end\n ||case when unpivot_cte.modifier_4 is not null then '_'||unpivot_cte.modifier_4 else '' end\n ||case when unpivot_cte.modifier_5 is not null then '_'||unpivot_cte.modifier_5 else '' end\n ||case when unpivot_cte.practitioner_npi is not null then '_'||unpivot_cte.practitioner_npi else '' end\n as TEXT ) as procedure_id\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(coalesce(ap.encounter_id, ed.encounter_id) as TEXT ) as encounter_id\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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\nleft join raw.terminology.icd_10_pcs as icd\n on unpivot_cte.source_code = icd.icd_10_pcs\nleft join raw.terminology.hcpcs_level_2 as hcpcs\n on unpivot_cte.source_code = hcpcs.hcpcs\nleft join raw.claims_preprocessing._int_acute_inpatient_encounter_id as ap\n on unpivot_cte.claim_id = ap.claim_id\nleft join raw.claims_preprocessing._int_emergency_department_encounter_id as ed\n on unpivot_cte.claim_id = ed.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.core__stg_clinical_patient": {"database": "raw", "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": "3daa12aef291b5031181cfcb88268f82029fd207206c85657d8cd0d4f3bf7b09"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.595371, "relation_name": "raw.core._stg_clinical_patient", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\n )\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(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(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('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\n\nfrom {{ ref('patient') }}", "language": "sql", "refs": [{"name": "patient", "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_float", "macro.dbt.type_timestamp"], "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\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(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('2024-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\n\nfrom tuva.input_layer.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.core__stg_clinical_procedure": {"database": "raw", "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": "9f332ea3f889dc17ca47d3668380056beb9958919f436791d2d345119ba919bf"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.5980082, "relation_name": "raw.core._stg_clinical_procedure", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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-02-20 20:47:44.615990+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": "raw", "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": "842c9dbc9adb69aabc5f4e69b627ad03506e01105ee084250a1c1451fbdee7ee"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.5888698, "relation_name": "raw.core._stg_clinical_encounter", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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 , {{ 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(facility_npi as {{ dbt.type_string() }} ) as facility_npi\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(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 , 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(facility_npi as TEXT ) as facility_npi\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(data_source as TEXT ) as data_source\n , cast('2024-02-20 20:47:44.615990+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": "raw", "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": "3534e17215e27b1fd8d009a8fd5a2f88343046667b640afb9e4fbb068db9e60b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.592722, "relation_name": "raw.core._stg_clinical_medication", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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-02-20 20:47:44.615990+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": "raw", "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": "d121fb782d2034f53473526655c16e227d37dd6933d58923b0716e4baf476b1c"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.57979, "relation_name": "raw.core._stg_claims_condition", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 cast(unpivot_cte.data_source||'_'||unpivot_cte.claim_id||'_'||unpivot_cte.diagnosis_rank||'_'||unpivot_cte.source_code as {{ dbt.type_string() }} ) as condition_id\n , cast(unpivot_cte.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(coalesce(ap.encounter_id, ed.encounter_id) as {{ dbt.type_string() }} ) as encounter_id\n , cast(unpivot_cte.claim_id as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('unpivot_cte.condition_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.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\nleft join {{ ref('acute_inpatient__encounter_id')}} as ap\n on unpivot_cte.claim_id = ap.claim_id\nleft join {{ ref('emergency_department__int_encounter_id')}} as ed\n on unpivot_cte.claim_id = ed.claim_id\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": "data_quality__claims_preprocessing_summary", "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": "acute_inpatient__encounter_id", "package": null, "version": null}, {"name": "emergency_department__int_encounter_id", "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.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.emergency_department__int_encounter_id", "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": "-- depends_on: raw.data_quality.claims_preprocessing_summary\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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere diagnosis_code_1 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_2 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_3 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_4 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_5 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_6 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_7 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_8 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_9 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_10 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_11 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_12 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_13 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_14 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_15 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_16 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_17 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_18 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_19 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_20 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_21 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_22 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_23 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_24 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_25 is not null\n\n)\n\nselect distinct\n cast(unpivot_cte.data_source||'_'||unpivot_cte.claim_id||'_'||unpivot_cte.diagnosis_rank||'_'||unpivot_cte.source_code as TEXT ) as condition_id\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(coalesce(ap.encounter_id, ed.encounter_id) as TEXT ) as encounter_id\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.condition_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.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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\nleft join raw.claims_preprocessing._int_acute_inpatient_encounter_id as ap\n on unpivot_cte.claim_id = ap.claim_id\nleft join raw.claims_preprocessing._int_emergency_department_encounter_id as ed\n on unpivot_cte.claim_id = ed.claim_id\nleft join raw.terminology.icd_10_cm icd\n on unpivot_cte.source_code = icd.icd_10_cm\nleft join raw.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": "raw", "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": "4861fe602fc9b4355ea3da9ae79829c4c4eb329b9423d304eadf2523c43b8937"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.590119, "relation_name": "raw.core._stg_clinical_lab_result", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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_int() }} ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as {{ dbt.type_int() }} ) 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_int", "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 integer ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as integer ) 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-02-20 20:47:44.615990+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": "raw", "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": "e04f15cb36d85a844dd2b7fb431eedc8db9a6dfc6eb03e8fdbe604002558dfb1"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.5966122, "relation_name": "raw.core._stg_clinical_practitioner", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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-02-20 20:47:44.615990+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": "raw", "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": "4eb5bf8a16d0bf0c494854c355642cb48db25b455f4579873a8eee277dcebf76"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.583387, "relation_name": "raw.core._stg_claims_pharmacy_claim", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n )\n}}\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 {{ 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 , cast(plan as {{ dbt.type_string() }} ) as plan\n , cast(prescribing_provider_npi as {{ dbt.type_string() }} ) as prescribing_provider_npi\n , cast(dispensing_provider_npi as {{ dbt.type_string() }} ) as dispensing_provider_npi\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as {{ dbt.type_string() }} ) as ndc_code\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(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(data_source as {{ dbt.type_string() }} ) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__pharmacy_claim') }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_summary", "package": null, "version": null}, {"name": "normalized_input__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "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": "-- depends_on: raw.data_quality.claims_preprocessing_summary\n\n\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 ) 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 , cast(plan as TEXT ) as plan\n , cast(prescribing_provider_npi as TEXT ) as prescribing_provider_npi\n , cast(dispensing_provider_npi as TEXT ) as dispensing_provider_npi\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\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(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(data_source as TEXT ) as data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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__stg_clinical_location": {"database": "raw", "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": "d174a7c1a6034db5bd81239712dd36ba2a7d8ddebeda83eca4c9d86f00c169b8"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.591388, "relation_name": "raw.core._stg_clinical_location", "raw_code": "{{ config(\r\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\r\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-02-20 20:47:44.615990+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": "raw", "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": "58641291a4486f06e047c98789ab4e49d52a68f0bc1ea93c17c61a15f8204009"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.578281, "relation_name": "raw.core._stg_claims_patient", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\n\n\n\nwith patient_stage as(\n select\n patient_id\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,first_name\n ,last_name\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 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(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('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }}) as tuva_last_run\nfrom patient_stage\nwhere row_sequence = 1", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_summary", "package": null, "version": null}, {"name": "normalized_input__eligibility", "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.data_quality__claims_preprocessing_summary", "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": "-- depends_on: raw.data_quality.claims_preprocessing_summary\n\n\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\n\n\n\nwith patient_stage as(\n select\n patient_id\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,first_name\n ,last_name\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 from raw.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(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('2024-02-20 20:47:44.615990+00:00' as timestamp) 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": "raw", "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": "b31467cd0c59b6991f06f89f122a3e668b8620f30634b202c27e21905f6e9173"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.5941482, "relation_name": "raw.core._stg_clinical_observation", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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-02-20 20:47:44.615990+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": "raw", "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": "d6e2bac51e9f18580249d402ed5ddc88c616d33d70781c4adf4dfd980499f836"}, "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": "#0f3d0b"}, "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": {"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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.569612, "relation_name": "raw.core.pharmacy_claim", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r\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 raw.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": "raw", "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": "6bf20ce96592d16fd9ab798870231dc2cb5fd32632e677db4eccf028738d1a4f"}, "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": "#0f3d0b"}, "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.", "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": []}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.554176, "relation_name": "raw.core.condition", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\n )\r\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_condition') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_condition') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_condition') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_condition') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_condition", "package": null, "version": null}, {"name": "core__stg_clinical_condition", "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"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__condition.sql", "compiled": true, "compiled_code": "\n\n\nselect * from raw.core._stg_claims_condition\nunion all\nselect * from raw.core._stg_clinical_condition\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": "raw", "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": "a66973783354be761131b8742966bf7655b486e3e75b1f1c298bec92c348f49a"}, "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": "#0f3d0b"}, "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 person across all datasets.", "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": []}, "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": []}, "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": []}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.568102, "relation_name": "raw.core.patient", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\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 raw.core._stg_claims_patient\nunion all\nselect * from raw.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": "raw", "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": "f9476ba4518a0bd40ed1de34b409cd2a90558632afa56fb482ab58b016ad4ab9"}, "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": "#0f3d0b"}, "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 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": []}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.5588942, "relation_name": "raw.core.lab_result", "raw_code": "{{ config(\r\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\nselect * from {{ ref('core__stg_clinical_lab_result')}}", "language": "sql", "refs": [{"name": "core__stg_clinical_lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__lab_result.sql", "compiled": true, "compiled_code": "\n\nselect * from raw.core._stg_clinical_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__encounter": {"database": "raw", "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": "fdcb9a40f227bf4cdad6aec9e5697db02ee3e64eda31110e1a9c06a412f6185d"}, "config": {"enabled": true, "alias": "encounter", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "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 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": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI 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.", "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": "#0f3d0b"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "encounter", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.557218, "relation_name": "raw.core.encounter", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n{% if var('clinical_enabled', false) == true and var('claims_enabled', false) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_encounter') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_encounter') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_encounter') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_encounter') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_clinical_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["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 * from raw.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": "raw", "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": "6c4444c95ace83c2f6bc4f2e9dfc69bef360c3b0a01bea5e67b3da4761485111"}, "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": "#0f3d0b"}, "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": {"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": []}, "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": []}, "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": []}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.555637, "relation_name": "raw.core.eligibility", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r\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 raw.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": "raw", "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": "a88b9caf3980e1ee823faa433af0c5947ef0f37507508f67b22190afbf349dd8"}, "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": "#0f3d0b"}, "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": "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": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each person across all datasets.", "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": []}, "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": []}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.5730681, "relation_name": "raw.core.procedure", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\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_procedure') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_procedure') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_procedure') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_procedure') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_procedure", "package": null, "version": null}, {"name": "core__stg_clinical_procedure", "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"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__procedure.sql", "compiled": true, "compiled_code": "\n\nselect * from raw.core._stg_claims_procedure\nunion all\nselect * from raw.core._stg_clinical_procedure\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": "raw", "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": "b126bbc3a07a5f93f701d0199e8fde6ef13a7fd9ac7ad71619de948a8d49fdc1"}, "config": {"enabled": true, "alias": "medical_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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The medical claim table contains information on services rendered to patients 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": "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": []}, "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": []}, "encounter_type": {"name": "encounter_type", "description": "The type of encounter this claim belongs to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "The encounter_id for the encounter that this claims belongs to.\n", "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": []}, "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": "#0f3d0b"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "medical_claim", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.562761, "relation_name": "raw.core.medical_claim", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r\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 raw.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": "raw", "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": "978a0da0c66bbea4fd6018afdebb6ca1dd8e3d47d0dcab69f1cc72d9356f52b9"}, "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": "#0f3d0b"}, "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": "Custom description of the source system e.g. Epic.", "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.56022, "relation_name": "raw.core.location", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\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 raw.core._stg_claims_location\nunion all\nselect * from raw.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__medication": {"database": "raw", "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": "465c23d0e83d37bcd661cec2d9e6b14101d171d7dc5b1481e9ef8e0580998512"}, "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": "#0f3d0b"}, "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": []}, "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": {"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": []}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.5643232, "relation_name": "raw.core.medication", "raw_code": "{{ config(\r\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\n\r\nselect * from {{ ref('core__stg_clinical_medication')}}", "language": "sql", "refs": [{"name": "core__stg_clinical_medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__medication.sql", "compiled": true, "compiled_code": "\n\n\nselect * from raw.core._stg_clinical_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__observation": {"database": "raw", "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": "8e922586d391bb227ab514044d20f47f328a489ae785158adf2d12a7f1c84d4b"}, "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": "#0f3d0b"}, "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 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": []}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.5664, "relation_name": "raw.core.observation", "raw_code": "{{ config(\r\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\n\r\nselect * from {{ ref('core__stg_clinical_observation')}}", "language": "sql", "refs": [{"name": "core__stg_clinical_observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__observation.sql", "compiled": true, "compiled_code": "\n\n\nselect * from raw.core._stg_clinical_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__practitioner": {"database": "raw", "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": "dc5b35a5bbe081c71df40883440b3b6eb12bc8d7fead93c496176c6e50da8ac8"}, "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": "#0f3d0b"}, "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": "First name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_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": []}, "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": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708461580.571551, "relation_name": "raw.core.practitioner", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\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 raw.core._stg_claims_practitioner\nunion all\nselect * from raw.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.data_quality__claims_preprocessing_use_case": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_use_case", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_use_case.sql", "original_file_path": "models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_use_case.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "final", "data_quality__claims_preprocessing_use_case"], "alias": "claims_preprocessing_use_case", "checksum": {"name": "sha256", "checksum": "48696a2c60c3f6cdd20585fae8aa2a8731937164cfa95438fea455f7a54af1d4"}, "config": {"enabled": true, "alias": "claims_preprocessing_use_case", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {"use_case": {"name": "use_case", "description": "The mart or logic that would be affected by test failures", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_table": {"name": "source_table", "description": "Table this use case is in reference to", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "test_name": {"name": "test_name", "description": "Name of the test being performed", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "failures": {"name": "failures", "description": "Number of failures of this test", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "denominator": {"name": "denominator", "description": "Total number of records analyzed for this test", "meta": {}, "data_type": "integer", "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": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claims_preprocessing_use_case", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.640519, "relation_name": "raw.data_quality.claims_preprocessing_use_case", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\nwith use_case_stage as(\n select\n 'encounters' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__medical_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all\n\n select \n 'service_grouper' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__medical_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'hcpcs_code missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'readmissions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__medical_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'pmpm' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__medical_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('patient_id missing'\n ,'claim_start_date missing'\n ,'claim_type invalid'\n ,'claim_type missing'\n\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'readmissions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__pharmacy_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('patient_id missing'\n ,'dispensing_date missing'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'paid_amount missing'\n )\n and source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'member_months' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct patient_id||data_source) from {{ ref('normalized_input__eligibility') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('patient_id missing'\n ,'enrollment_start_date missing'\n ,'enrollment_end_date invalid'\n ,'payer missing'\n ,'payer missing'\n ,'payer_type invalid'\n )\n and source_table = 'normalized_input__eligibility'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'chronic_conditions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__medical_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'claim_start_date missing'\n ,'claim_start_date invalid'\n ,'patient_id missing'\n ,'patient_id invalid'\n ,'diagnosis_code_type missing'\n ,'diagnosis_code_type invalid'\n ,'procedure_code_1 missing'\n ,'procedure_code_1 invalid'\n ,'procedure_code_type invalid'\n ,'procedure_code_type missing'\n /** encounter fields **/\n ,'diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'chronic_conditions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__pharmacy_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('ndc_code missing'\n ,'patient_id missing'\n ,'paid_date missing'\n )\n and source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , test_name\n)\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from use_case_stage", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "normalized_input__pharmacy_claim", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "normalized_input__eligibility", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "normalized_input__pharmacy_claim", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__pharmacy_claim", "model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_use_case.sql", "compiled": true, "compiled_code": "\nwith use_case_stage as(\n select\n 'encounters' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all\n\n select \n 'service_grouper' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'hcpcs_code missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'readmissions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'pmpm' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('patient_id missing'\n ,'claim_start_date missing'\n ,'claim_type invalid'\n ,'claim_type missing'\n\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'readmissions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_pharmacy_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('patient_id missing'\n ,'dispensing_date missing'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'paid_amount missing'\n )\n and source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'member_months' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct patient_id||data_source) from raw.claims_preprocessing.normalized_input_eligibility ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('patient_id missing'\n ,'enrollment_start_date missing'\n ,'enrollment_end_date invalid'\n ,'payer missing'\n ,'payer missing'\n ,'payer_type invalid'\n )\n and source_table = 'normalized_input__eligibility'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'chronic_conditions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'claim_start_date missing'\n ,'claim_start_date invalid'\n ,'patient_id missing'\n ,'patient_id invalid'\n ,'diagnosis_code_type missing'\n ,'diagnosis_code_type invalid'\n ,'procedure_code_1 missing'\n ,'procedure_code_1 invalid'\n ,'procedure_code_type invalid'\n ,'procedure_code_type missing'\n /** encounter fields **/\n ,'diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'chronic_conditions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_pharmacy_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('ndc_code missing'\n ,'patient_id missing'\n ,'paid_date missing'\n )\n and source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , test_name\n)\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run from use_case_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.data_quality__claims_preprocessing_test_detail": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_detail", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_detail.sql", "original_file_path": "models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_detail.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "final", "data_quality__claims_preprocessing_test_detail"], "alias": "claims_preprocessing_test_detail", "checksum": {"name": "sha256", "checksum": "e6a08ca903b518c67318cb0cc79714ee9901d90f796de8b8ce59a760e7e30d09"}, "config": {"enabled": true, "alias": "claims_preprocessing_test_detail", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {"source_table": {"name": "source_table", "description": "Table this test is in reference to", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "test_category": {"name": "test_category", "description": "Category of test", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "test_name": {"name": "test_name", "description": "Name of the test being performed", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "grain": {"name": "grain", "description": "Grain of the test", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Specific claim type, if any, that this test is specific to", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pipeline_test": {"name": "pipeline_test", "description": "Flag to indicate a pipeline stopping test", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "foreign_key": {"name": "foreign_key", "description": "The column this table can be used to join back to the source table\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 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": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claims_preprocessing_test_detail", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.637381, "relation_name": "raw.data_quality.claims_preprocessing_test_detail", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith test_detail_union as(\n\nselect * from {{ ref('data_quality__claims_preprocessing_test_detail_stage_medical_claim') }}\nunion all\nselect * from {{ ref('data_quality__claims_preprocessing_test_detail_stage_eligibility') }}\nunion all\nselect * from {{ ref('data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim') }}\n\n\n)\n\nselect \n source_table\n , case \n when source_table = 'normalized_input__medical_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__medical_claim' and test_category = 'claim_type'\n then '2_claim_type'\n when source_table = 'normalized_input__medical_claim' and test_category = 'header'\n then '3_header'\n when source_table = 'normalized_input__medical_claim' and test_category = 'invalid_values'\n then '4_invalid_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'missing_values'\n then '5_missing_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'plausibility'\n then '6_plausibility' \n when source_table = 'normalized_input__eligibility' and test_category = 'duplicate_eligibility'\n then '1_duplicate_eligibility'\n when source_table = 'normalized_input__eligibility' and test_category = 'invalid_values'\n then '2_invalid_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'missing_values'\n then '3_missing_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'plausibility'\n then '4_plausibility'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'missing_values'\n then '2_missing_values'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'plausibility'\n then '3_plausibility'\n else test_category \n end as test_category\n , test_name \n , grain\n , claim_type\n , pipeline_test\n , foreign_key\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom test_detail_union", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_detail_stage_medical_claim", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail_stage_eligibility", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_detail.sql", "compiled": true, "compiled_code": "\n\nwith test_detail_union as(\n\nselect * from raw.data_quality._int_claims_preprocessing_test_detail_stage_medical_claim\nunion all\nselect * from raw.data_quality._int_claims_preprocessing_test_detail_stage_eligibility\nunion all\nselect * from raw.data_quality._int_claims_preprocessing_test_detail_stage_pharmacy_claim\n\n\n)\n\nselect \n source_table\n , case \n when source_table = 'normalized_input__medical_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__medical_claim' and test_category = 'claim_type'\n then '2_claim_type'\n when source_table = 'normalized_input__medical_claim' and test_category = 'header'\n then '3_header'\n when source_table = 'normalized_input__medical_claim' and test_category = 'invalid_values'\n then '4_invalid_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'missing_values'\n then '5_missing_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'plausibility'\n then '6_plausibility' \n when source_table = 'normalized_input__eligibility' and test_category = 'duplicate_eligibility'\n then '1_duplicate_eligibility'\n when source_table = 'normalized_input__eligibility' and test_category = 'invalid_values'\n then '2_invalid_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'missing_values'\n then '3_missing_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'plausibility'\n then '4_plausibility'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'missing_values'\n then '2_missing_values'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'plausibility'\n then '3_plausibility'\n else test_category \n end as test_category\n , test_name \n , grain\n , claim_type\n , pipeline_test\n , foreign_key\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom test_detail_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.data_quality__claims_preprocessing_summary": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_summary.sql", "original_file_path": "models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_summary.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_summary", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "final", "data_quality__claims_preprocessing_summary"], "alias": "claims_preprocessing_summary", "checksum": {"name": "sha256", "checksum": "507eea2f065d4c9d52e5f49ece43e2996ceed1d5dcd2726b7a0b7b2a8f92e6a8"}, "config": {"enabled": true, "alias": "claims_preprocessing_summary", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {"source_table": {"name": "source_table", "description": "Table this test category is in reference to", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "test_category": {"name": "test_category", "description": "Category of test", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "counts": {"name": "counts", "description": "Aggregated counts of all tests in this category and table that failed\n", "meta": {}, "data_type": "integer", "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": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claims_preprocessing_summary", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.635298, "relation_name": "raw.data_quality.claims_preprocessing_summary", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith test_failure_summary as (\n select\n cast(source_table as {{ dbt.type_string() }} ) as source_table\n , cast(grain as {{ dbt.type_string() }} ) as grain\n , cast(test_category as {{ dbt.type_string() }} ) as test_category\n , cast(count(distinct foreign_key||data_source) as int) as counts\n from {{ ref('data_quality__claims_preprocessing_test_detail' )}}\n group by\n source_table\n ,grain\n ,test_category\n)\n\n, summary_union as(\n select\n cast(source_table as {{ dbt.type_string() }} ) as source_table\n , cast(grain as {{ dbt.type_string() }} ) as grain\n , cast(test_category as {{ dbt.type_string() }} ) as test_category\n , cast(counts as int) as counts\n from test_failure_summary\n\n /******* The tables below populate the test when no failures are present ******/\n union all\n\n select * from (\n select\n cast('normalized_input__medical_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('duplicate_claims' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_duplicates' )}} )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('claim_type' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts \n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_claim_type_mapping_failures' )}} )\n and not exists (select 1 from {{ ref('data_quality__claims_preprocessing_claim_type_unmapped' )}} )\n and not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_inst_missing_values' )}} where test_category = 'claim_type')\n and not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_prof_missing_values' )}} where test_category = 'claim_type')\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('header' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_institutional_header_fail_details' )}} )\n and not exists (select 1 from {{ ref('data_quality__claims_preprocessing_professional_header_fail_details' )}} )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('invalid_values' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_invalid_values' )}} )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('missing_values' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_inst_missing_values' )}} )\n and not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_prof_missing_values' )}} )\n\n /**** eligibility ****/\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as {{ dbt.type_string() }} ) as source_table\n , cast('patient_id' as {{ dbt.type_string() }} ) as grain\n , cast('duplicate_eligibility' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_eligibility_duplicates' )}} )\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as {{ dbt.type_string() }} ) as source_table\n , cast('patient_id' as {{ dbt.type_string() }} ) as grain\n , cast('invalid_values' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_eligibility_invalid_values' )}} )\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as {{ dbt.type_string() }} ) as source_table\n , cast('patient_id' as {{ dbt.type_string() }} ) as grain\n , cast('missing_values' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_eligibility_missing_values' )}} )\n\n /**** pharmacy_claim ****/\n union all\n select * from (\n select\n cast('normalized_input__pharmacy_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('duplicate_claims' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_pharmacy_claim_duplicates' )}} )\n union all\n select * from (\n select\n cast('normalized_input__pharmacy_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('missing_values' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_pharmacy_claim_missing_values' )}} )\n)\n\nselect \n cast(source_table as {{ dbt.type_string() }} ) as source_table\n , cast(case \n when source_table = 'normalized_input__medical_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__medical_claim' and test_category = 'claim_type'\n then '2_claim_type'\n when source_table = 'normalized_input__medical_claim' and test_category = 'header'\n then '3_header'\n when source_table = 'normalized_input__medical_claim' and test_category = 'invalid_values'\n then '4_invalid_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'missing_values'\n then '5_missing_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'plausibility'\n then '6_plausibility' \n when source_table = 'normalized_input__medical_claim' and test_category = 'good'\n then '7_good' \n when source_table = 'normalized_input__eligibility' and test_category = 'duplicate_eligibility'\n then '1_duplicate_eligibility'\n when source_table = 'normalized_input__eligibility' and test_category = 'invalid_values'\n then '2_invalid_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'missing_values'\n then '3_missing_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'plausibility'\n then '4_plausibility' \n when source_table = 'normalized_input__eligibility' and test_category = 'good'\n then '5_good'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'missing_values'\n then '2_missing_values'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'plausibility'\n then '3_plausibility' \n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'good'\n then '4_good'\n else test_category \n end as {{ dbt.type_string() }} ) as test_category\n , cast(counts as int) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom summary_union", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_duplicates", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_claim_type_mapping_failures", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_claim_type_unmapped", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_inst_missing_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_prof_missing_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_institutional_header_fail_details", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_professional_header_fail_details", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_invalid_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_inst_missing_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_prof_missing_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_eligibility_duplicates", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_eligibility_invalid_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_eligibility_missing_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_pharmacy_claim_duplicates", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_pharmacy_claim_missing_values", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_summary.sql", "compiled": true, "compiled_code": "\n\nwith test_failure_summary as (\n select\n cast(source_table as TEXT ) as source_table\n , cast(grain as TEXT ) as grain\n , cast(test_category as TEXT ) as test_category\n , cast(count(distinct foreign_key||data_source) as int) as counts\n from raw.data_quality.claims_preprocessing_test_detail\n group by\n source_table\n ,grain\n ,test_category\n)\n\n, summary_union as(\n select\n cast(source_table as TEXT ) as source_table\n , cast(grain as TEXT ) as grain\n , cast(test_category as TEXT ) as test_category\n , cast(counts as int) as counts\n from test_failure_summary\n\n /******* The tables below populate the test when no failures are present ******/\n union all\n\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('duplicate_claims' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_duplicates )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('claim_type' as TEXT ) as test_category\n , cast(0 as int) as counts \n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_claim_type_mapping_failures )\n and not exists (select 1 from raw.data_quality._int_claims_preprocessing_claim_type_unmapped )\n and not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values where test_category = 'claim_type')\n and not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values where test_category = 'claim_type')\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('header' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_institutional_header_fail_details )\n and not exists (select 1 from raw.data_quality._int_claims_preprocessing_professional_header_fail_details )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('invalid_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_invalid_values )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('missing_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values )\n and not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values )\n\n /**** eligibility ****/\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as TEXT ) as source_table\n , cast('patient_id' as TEXT ) as grain\n , cast('duplicate_eligibility' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_eligibility_duplicates )\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as TEXT ) as source_table\n , cast('patient_id' as TEXT ) as grain\n , cast('invalid_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_eligibility_invalid_values )\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as TEXT ) as source_table\n , cast('patient_id' as TEXT ) as grain\n , cast('missing_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_eligibility_missing_values )\n\n /**** pharmacy_claim ****/\n union all\n select * from (\n select\n cast('normalized_input__pharmacy_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('duplicate_claims' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_pharmacy_claim_duplicates )\n union all\n select * from (\n select\n cast('normalized_input__pharmacy_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('missing_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_pharmacy_claim_missing_values )\n)\n\nselect \n cast(source_table as TEXT ) as source_table\n , cast(case \n when source_table = 'normalized_input__medical_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__medical_claim' and test_category = 'claim_type'\n then '2_claim_type'\n when source_table = 'normalized_input__medical_claim' and test_category = 'header'\n then '3_header'\n when source_table = 'normalized_input__medical_claim' and test_category = 'invalid_values'\n then '4_invalid_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'missing_values'\n then '5_missing_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'plausibility'\n then '6_plausibility' \n when source_table = 'normalized_input__medical_claim' and test_category = 'good'\n then '7_good' \n when source_table = 'normalized_input__eligibility' and test_category = 'duplicate_eligibility'\n then '1_duplicate_eligibility'\n when source_table = 'normalized_input__eligibility' and test_category = 'invalid_values'\n then '2_invalid_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'missing_values'\n then '3_missing_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'plausibility'\n then '4_plausibility' \n when source_table = 'normalized_input__eligibility' and test_category = 'good'\n then '5_good'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'missing_values'\n then '2_missing_values'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'plausibility'\n then '3_plausibility' \n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'good'\n then '4_good'\n else test_category \n end as TEXT ) as test_category\n , cast(counts as int) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom summary_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.data_quality__claims_preprocessing_test_result": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_result.sql", "original_file_path": "models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_result.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "final", "data_quality__claims_preprocessing_test_result"], "alias": "claims_preprocessing_test_result", "checksum": {"name": "sha256", "checksum": "65630b4a70b2b25ccd0d81b6643c26021c0dcbad572e678e4c41be7e6349b217"}, "config": {"enabled": true, "alias": "claims_preprocessing_test_result", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {"source_table": {"name": "source_table", "description": "Table this test is in reference to", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "grain": {"name": "grain", "description": "Grain of the test", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "test_category": {"name": "test_category", "description": "Category of test", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "test_name": {"name": "test_name", "description": "Name of the test being performed", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Specific claim type, if any, that this test is specific to", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pipeline_test": {"name": "pipeline_test", "description": "Flag to indicate a pipeline stopping test", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "failures": {"name": "failures", "description": "Number of failures of this test", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "denominator": {"name": "denominator", "description": "Total number of records analyzed for this test", "meta": {}, "data_type": "integer", "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": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claims_preprocessing_test_result", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.639008, "relation_name": "raw.data_quality.claims_preprocessing_test_result", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect * from {{ ref('data_quality__claims_preprocessing_test_result_stage_medical_claim') }}\n\nunion all\n\nselect * from {{ ref('data_quality__claims_preprocessing_test_result_stage_eligibility') }}\n\nunion all\n\nselect * from {{ ref('data_quality__claims_preprocessing_test_result_stage_pharmacy_claim') }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_result_stage_medical_claim", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_result_stage_eligibility", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_result_stage_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_result.sql", "compiled": true, "compiled_code": "\n\nselect * from raw.data_quality._int_claims_preprocessing_test_result_stage_medical_claim\n\nunion all\n\nselect * from raw.data_quality._int_claims_preprocessing_test_result_stage_eligibility\n\nunion all\n\nselect * from raw.data_quality._int_claims_preprocessing_test_result_stage_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__claims_preprocessing_test_result_stage_pharmacy_claim": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_result_stage_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_pharmacy_claim.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_result_stage_pharmacy_claim"], "alias": "_int_claims_preprocessing_test_result_stage_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "11c74f62639a1b7393e37d300b38cf87f5980119ccd8e5e7c142d81fb673ca3d"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_result_stage_pharmacy_claim", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_result_stage_pharmacy_claim", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.678702, "relation_name": "raw.data_quality._int_claims_preprocessing_test_result_stage_pharmacy_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith pharmacy_claim_denominator as(\n select \n cast('all' as {{ dbt.type_string() }} ) as claim_type\n , cast(count(distinct claim_id||data_source) as int) as count\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\n from {{ ref('normalized_input__pharmacy_claim') }}\n)\n\n, distinct_patient_per_category as(\n select\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n from {{ ref('data_quality__claims_preprocessing_test_detail') }}\n where source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n )\n\n select\n source_table\n , grain\n , claim.test_category\n , claim.test_name\n , claim.claim_type\n , pipeline_test\n , claim.failures\n , denom.count as denominator\n , tuva_last_run\n from distinct_patient_per_category claim\n left join pharmacy_claim_denominator denom\n on claim.claim_type = denom.claim_type\n group by\n source_table\n , grain\n , claim.test_category\n , claim.test_name\n , claim.claim_type\n , pipeline_test\n , claim.failures\n , denom.count\n , tuva_last_run", "language": "sql", "refs": [{"name": "normalized_input__pharmacy_claim", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.normalized_input__pharmacy_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim_denominator as(\n select \n cast('all' as TEXT ) as claim_type\n , cast(count(distinct claim_id||data_source) as int) as count\n , cast('2024-02-20 20:47:44.615990+00:00' as TEXT ) as tuva_last_run\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n)\n\n, distinct_patient_per_category as(\n select\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n from raw.data_quality.claims_preprocessing_test_detail\n where source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n )\n\n select\n source_table\n , grain\n , claim.test_category\n , claim.test_name\n , claim.claim_type\n , pipeline_test\n , claim.failures\n , denom.count as denominator\n , tuva_last_run\n from distinct_patient_per_category claim\n left join pharmacy_claim_denominator denom\n on claim.claim_type = denom.claim_type\n group by\n source_table\n , grain\n , claim.test_category\n , claim.test_name\n , claim.claim_type\n , pipeline_test\n , claim.failures\n , denom.count\n , 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.data_quality__claims_preprocessing_test_detail_stage_eligibility": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_detail_stage_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_eligibility.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_eligibility.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_detail_stage_eligibility"], "alias": "_int_claims_preprocessing_test_detail_stage_eligibility", "checksum": {"name": "sha256", "checksum": "b04f520f2584760c3df5fc6247855112df25a989876ae4fd16e9bb38f218ba72"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_detail_stage_eligibility", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_detail_stage_eligibility", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.649342, "relation_name": "raw.data_quality._int_claims_preprocessing_test_detail_stage_eligibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_eligibility_duplicates') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_eligibility_missing_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_eligibility_invalid_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_eligibility_plausibility') }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_eligibility_duplicates", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_eligibility_missing_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_eligibility_invalid_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_eligibility_plausibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_eligibility.sql", "compiled": true, "compiled_code": "\n\n\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_eligibility_duplicates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_eligibility_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_eligibility_invalid_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_eligibility_plausibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_invalid_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_npi.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_npi.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_invalid_npi"], "alias": "_int_claims_preprocessing_medical_claim_invalid_npi", "checksum": {"name": "sha256", "checksum": "a597aa1d75f2240878b8134e9f03bbe4b31f7632add407ebfd6b77075c70625d"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_invalid_npi", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_invalid_npi", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.6624901, "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_invalid_npi", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith medical_claim as (\n\n select *\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, valid_billing_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.billing_npi) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__provider')}} pro\n on medical_claim.billing_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'billing_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.billing_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_facility_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.facility_npi) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__provider')}} pro\n on medical_claim.facility_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'facility_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.facility_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_rendering_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.rendering_npi) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__provider')}} pro\n on medical_claim.rendering_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'rendering_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.rendering_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_billing_npi\nunion all\nselect * from valid_facility_npi\nunion all\nselect * from valid_rendering_npi", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "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.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_npi.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select *\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, valid_billing_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.billing_npi) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.provider pro\n on medical_claim.billing_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'billing_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.billing_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_facility_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.facility_npi) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.provider pro\n on medical_claim.facility_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'facility_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.facility_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_rendering_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.rendering_npi) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.provider pro\n on medical_claim.rendering_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'rendering_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.rendering_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_billing_npi\nunion all\nselect * from valid_facility_npi\nunion all\nselect * from valid_rendering_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__claims_preprocessing_eligibility_missing_values": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_eligibility_missing_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_missing_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_missing_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_eligibility_missing_values"], "alias": "_int_claims_preprocessing_eligibility_missing_values", "checksum": {"name": "sha256", "checksum": "d2e6e2bfbd26ec32ccb9262ed739f2a429b7d0b74776853b2406dfc3bec60424"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_eligibility_missing_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_eligibility_missing_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.644067, "relation_name": "raw.data_quality._int_claims_preprocessing_eligibility_missing_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set eligibility_missing_column_list = [\n 'patient_id'\n , 'member_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 , 'dual_status_code'\n , 'medicare_status_code'\n , 'first_name'\n , 'last_name'\n , 'address'\n , 'city'\n , 'state'\n , 'zip_code'\n , 'phone'\n , 'data_source'\n] -%}\n\nwith eligibility_missing as (\n\n {{ eligibility_missing_column_check(builtins.ref('normalized_input__eligibility'), eligibility_missing_column_list) }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'patient_id' as grain\n , eligibility_missing.patient_id\n , eligibility_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom eligibility_missing\n left join test_catalog\n on test_catalog.test_name = eligibility_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__eligibility'\ngroup by\n eligibility_missing.patient_id\n , eligibility_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.eligibility_missing_column_check"], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_missing_values.sql", "compiled": true, "compiled_code": "\n\nwith eligibility_missing as (\n\n \n select\n patient_id\n , data_source\n , 'patient_id' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where patient_id is null\n union all\n select\n patient_id\n , data_source\n , 'member_id' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where member_id is null\n union all\n select\n patient_id\n , data_source\n , 'gender' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where gender is null\n union all\n select\n patient_id\n , data_source\n , 'race' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where race is null\n union all\n select\n patient_id\n , data_source\n , 'birth_date' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where birth_date is null\n union all\n select\n patient_id\n , data_source\n , 'death_date' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where death_date is null\n union all\n select\n patient_id\n , data_source\n , 'death_flag' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where death_flag is null\n union all\n select\n patient_id\n , data_source\n , 'enrollment_start_date' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where enrollment_start_date is null\n union all\n select\n patient_id\n , data_source\n , 'enrollment_end_date' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where enrollment_end_date is null\n union all\n select\n patient_id\n , data_source\n , 'payer' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where payer is null\n union all\n select\n patient_id\n , data_source\n , 'payer_type' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where payer_type is null\n union all\n select\n patient_id\n , data_source\n , 'dual_status_code' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where dual_status_code is null\n union all\n select\n patient_id\n , data_source\n , 'medicare_status_code' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where medicare_status_code is null\n union all\n select\n patient_id\n , data_source\n , 'first_name' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where first_name is null\n union all\n select\n patient_id\n , data_source\n , 'last_name' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where last_name is null\n union all\n select\n patient_id\n , data_source\n , 'address' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where address is null\n union all\n select\n patient_id\n , data_source\n , 'city' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where city is null\n union all\n select\n patient_id\n , data_source\n , 'state' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where state is null\n union all\n select\n patient_id\n , data_source\n , 'zip_code' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where zip_code is null\n union all\n select\n patient_id\n , data_source\n , 'phone' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where phone is null\n union all\n select\n patient_id\n , data_source\n , 'data_source' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where data_source is null\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'patient_id' as grain\n , eligibility_missing.patient_id\n , eligibility_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom eligibility_missing\n left join test_catalog\n on test_catalog.test_name = eligibility_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__eligibility'\ngroup by\n eligibility_missing.patient_id\n , eligibility_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_pharmacy_claim_duplicates", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_duplicates.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_duplicates.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_pharmacy_claim_duplicates"], "alias": "_int_claims_preprocessing_pharmacy_claim_duplicates", "checksum": {"name": "sha256", "checksum": "b95ed8a0bc634462973a923f9e3dfeb32d9b17e41ec66d72fb86f356f4f6b2df"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_pharmacy_claim_duplicates", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_pharmacy_claim_duplicates", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.6749802, "relation_name": "raw.data_quality._int_claims_preprocessing_pharmacy_claim_duplicates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__pharmacy_claim') }}\n left join test_catalog\n on test_catalog.test_name = 'duplicate pharmacy claims'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n claim_id\n , claim_line_number\n , data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "language": "sql", "refs": [{"name": "data_quality__test_catalog", "package": null, "version": null}, {"name": "normalized_input__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.data_quality__test_catalog", "model.the_tuva_project.normalized_input__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_duplicates.sql", "compiled": true, "compiled_code": "\n\nwith test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_pharmacy_claim\n left join test_catalog\n on test_catalog.test_name = 'duplicate pharmacy claims'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n claim_id\n , claim_line_number\n , data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving 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.data_quality__claims_preprocessing_eligibility_plausibility": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_eligibility_plausibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_plausibility.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_plausibility.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_eligibility_plausibility"], "alias": "_int_claims_preprocessing_eligibility_plausibility", "checksum": {"name": "sha256", "checksum": "5c0a56afedaf7f81a45427652011c15bc5aa77266f0987de893c5881c5b38522"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_eligibility_plausibility", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_eligibility_plausibility", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.647744, "relation_name": "raw.data_quality._int_claims_preprocessing_eligibility_plausibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith eligiblity as (\n\n select *\n from {{ ref('normalized_input__eligibility') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, multiple_genders_test as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple genders'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.gender) > 1\n\n)\n\n, multiple_races_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple races'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.race) > 1\n\n)\n\n, multiple_birth_dates_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple birth dates'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.birth_date) > 1\n\n)\n\n, multiple_death_dates_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple death dates'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.death_date) > 1\n\n)\n\n, birth_date_after_death_date as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'birth date after death date'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where eligiblity.birth_date > eligiblity.death_date\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from multiple_genders_test\nunion all\nselect * from multiple_races_test\nunion all\nselect * from multiple_birth_dates_test\nunion all\nselect * from multiple_death_dates_test\nunion all\nselect * from birth_date_after_death_date", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_plausibility.sql", "compiled": true, "compiled_code": "\n\nwith eligiblity as (\n\n select *\n from raw.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, multiple_genders_test as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple genders'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.gender) > 1\n\n)\n\n, multiple_races_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple races'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.race) > 1\n\n)\n\n, multiple_birth_dates_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple birth dates'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.birth_date) > 1\n\n)\n\n, multiple_death_dates_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple death dates'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.death_date) > 1\n\n)\n\n, birth_date_after_death_date as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'birth date after death date'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where eligiblity.birth_date > eligiblity.death_date\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from multiple_genders_test\nunion all\nselect * from multiple_races_test\nunion all\nselect * from multiple_birth_dates_test\nunion all\nselect * from multiple_death_dates_test\nunion all\nselect * from birth_date_after_death_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__claims_preprocessing_medical_claim_inst_missing_values": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_inst_missing_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_inst_missing_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_inst_missing_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_inst_missing_values"], "alias": "_int_claims_preprocessing_medical_claim_inst_missing_values", "checksum": {"name": "sha256", "checksum": "5feee9116be1eb359dd57e13e1f6b25926d2ea1c7bdc5993702f608354105159"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_inst_missing_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_inst_missing_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.661118, "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set institutional_missing_column_list = [\n 'claim_id'\n , 'claim_line_number'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'bill_type_code'\n , 'revenue_center_code'\n , 'hcpcs_code'\n , 'rendering_npi'\n , 'billing_npi'\n , 'facility_npi'\n , 'paid_date'\n , 'paid_amount'\n , 'diagnosis_code_type'\n , 'diagnosis_code_1'\n , 'data_source'\n] -%}\n\nwith institutional_missing as (\n\n {{ medical_claim_missing_column_check(builtins.ref('normalized_input__medical_claim'), institutional_missing_column_list, 'institutional') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , institutional_missing.claim_id\n , institutional_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom institutional_missing\n left join test_catalog\n on test_catalog.test_name = institutional_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n institutional_missing.claim_id\n , institutional_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_missing_column_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_inst_missing_values.sql", "compiled": true, "compiled_code": "\n\nwith institutional_missing as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_id is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'claim_line_number' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_line_number is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where patient_id is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where member_id is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where payer is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where plan is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_start_date is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_end_date is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where bill_type_code is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'revenue_center_code' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where revenue_center_code is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'hcpcs_code' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where hcpcs_code is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'rendering_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where rendering_npi is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where billing_npi is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'facility_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where facility_npi is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where paid_date is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'paid_amount' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where paid_amount is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_type is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_1 is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where data_source is null\n and claim_type = 'institutional'\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , institutional_missing.claim_id\n , institutional_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom institutional_missing\n left join test_catalog\n on test_catalog.test_name = institutional_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n institutional_missing.claim_id\n , institutional_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_pharmacy_header_fail_details", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_header_fail_details.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_header_fail_details.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_pharmacy_header_fail_details"], "alias": "_int_claims_preprocessing_pharmacy_header_fail_details", "checksum": {"name": "sha256", "checksum": "37a628cc32db63424c1759946a5db79ca68ab304cc0f5c7a31c100addc2d7e10"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_pharmacy_header_fail_details", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_pharmacy_header_fail_details", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.657303, "relation_name": "raw.data_quality._int_claims_preprocessing_pharmacy_header_fail_details", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set pharmacy_header_column_list = [\n 'claim_id'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'data_source'\n] -%}\n\nwith pharmacy_header_duplicates as (\n\n {{ pharmacy_claim_header_duplicate_check(builtins.ref('normalized_input__pharmacy_claim'), pharmacy_header_column_list) }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , pharmacy_header_duplicates.claim_id\n , pharmacy_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom pharmacy_header_duplicates\n left join test_catalog\n on test_catalog.test_name = pharmacy_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by \n pharmacy_header_duplicates.claim_id\n , pharmacy_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__pharmacy_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.pharmacy_claim_header_duplicate_check"], "nodes": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_header_fail_details.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_header_duplicates as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n , count(distinct claim_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct claim_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n , count(distinct patient_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct patient_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n , count(distinct member_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct member_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n , count(distinct payer) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct payer) > 1\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n , count(distinct plan) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct plan) > 1\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n , count(distinct data_source) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct data_source) > 1\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , pharmacy_header_duplicates.claim_id\n , pharmacy_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pharmacy_header_duplicates\n left join test_catalog\n on test_catalog.test_name = pharmacy_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by \n pharmacy_header_duplicates.claim_id\n , pharmacy_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_professional_header_fail_details", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_professional_header_fail_details.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_professional_header_fail_details.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_professional_header_fail_details"], "alias": "_int_claims_preprocessing_professional_header_fail_details", "checksum": {"name": "sha256", "checksum": "5b05422d8e84979c2e858816d8ea00f89bc0cbccee2b6e7cdbc4eb362afa7a3a"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_professional_header_fail_details", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_professional_header_fail_details", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.656127, "relation_name": "raw.data_quality._int_claims_preprocessing_professional_header_fail_details", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set professional_header_column_list = [\n 'claim_id'\n , 'claim_type'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'place_of_service_code'\n , 'billing_npi'\n , 'paid_date'\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 , 'data_source'\n] -%}\n\nwith professional_header_duplicates as (\n\n {{ medical_claim_header_duplicate_check(builtins.ref('normalized_input__medical_claim'), professional_header_column_list, 'professional') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'professional' as claim_type\n , 'claim_id' as grain\n , professional_header_duplicates.claim_id\n , professional_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom professional_header_duplicates\n left join test_catalog\n on test_catalog.test_name = professional_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n and test_catalog.claim_type = 'professional'\ngroup by \n professional_header_duplicates.claim_id\n , professional_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_header_duplicate_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_professional_header_fail_details.sql", "compiled": true, "compiled_code": "\n\nwith professional_header_duplicates as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n , count(distinct claim_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_type' as column_checked\n , count(distinct claim_type) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n , count(distinct patient_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct patient_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n , count(distinct member_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct member_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n , count(distinct payer) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct payer) > 1\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n , count(distinct plan) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct plan) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n , count(distinct claim_start_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_start_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n , count(distinct claim_end_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_end_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'place_of_service_code' as column_checked\n , count(distinct place_of_service_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct place_of_service_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n , count(distinct billing_npi) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct billing_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n , count(distinct paid_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct paid_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n , count(distinct diagnosis_code_type) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n , count(distinct diagnosis_code_1) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_2' as column_checked\n , count(distinct diagnosis_code_2) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_3' as column_checked\n , count(distinct diagnosis_code_3) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_4' as column_checked\n , count(distinct diagnosis_code_4) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_5' as column_checked\n , count(distinct diagnosis_code_5) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_6' as column_checked\n , count(distinct diagnosis_code_6) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_7' as column_checked\n , count(distinct diagnosis_code_7) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_8' as column_checked\n , count(distinct diagnosis_code_8) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_9' as column_checked\n , count(distinct diagnosis_code_9) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_10' as column_checked\n , count(distinct diagnosis_code_10) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_11' as column_checked\n , count(distinct diagnosis_code_11) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_12' as column_checked\n , count(distinct diagnosis_code_12) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_13' as column_checked\n , count(distinct diagnosis_code_13) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_14' as column_checked\n , count(distinct diagnosis_code_14) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_15' as column_checked\n , count(distinct diagnosis_code_15) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_16' as column_checked\n , count(distinct diagnosis_code_16) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_17' as column_checked\n , count(distinct diagnosis_code_17) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_18' as column_checked\n , count(distinct diagnosis_code_18) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_19' as column_checked\n , count(distinct diagnosis_code_19) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_20' as column_checked\n , count(distinct diagnosis_code_20) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_21' as column_checked\n , count(distinct diagnosis_code_21) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_22' as column_checked\n , count(distinct diagnosis_code_22) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_23' as column_checked\n , count(distinct diagnosis_code_23) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_24' as column_checked\n , count(distinct diagnosis_code_24) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_25' as column_checked\n , count(distinct diagnosis_code_25) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n , count(distinct data_source) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct data_source) > 1\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'professional' as claim_type\n , 'claim_id' as grain\n , professional_header_duplicates.claim_id\n , professional_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom professional_header_duplicates\n left join test_catalog\n on test_catalog.test_name = professional_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n and test_catalog.claim_type = 'professional'\ngroup by \n professional_header_duplicates.claim_id\n , professional_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_eligibility_duplicates", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_duplicates.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_duplicates.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_eligibility_duplicates"], "alias": "_int_claims_preprocessing_eligibility_duplicates", "checksum": {"name": "sha256", "checksum": "6d5abb7f253bb640bfeee840b0232e14dff93e474286afa1fd6a61c8020eea12"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_eligibility_duplicates", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_eligibility_duplicates", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.6417642, "relation_name": "raw.data_quality._int_claims_preprocessing_eligibility_duplicates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith eligibility as (\n\n select\n patient_id\n , member_id\n , payer\n , plan\n , enrollment_start_date\n , enrollment_end_date\n , data_source\n from {{ ref('normalized_input__eligibility') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'patient_id' as grain\n , patient_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom eligibility\n left join test_catalog\n on test_catalog.test_name = 'duplicate eligibility'\n and test_catalog.source_table = 'normalized_input__eligibility'\ngroup by\n eligibility.patient_id\n , eligibility.member_id\n , eligibility.payer\n , eligibility.plan\n , eligibility.enrollment_start_date\n , eligibility.enrollment_end_date\n , eligibility.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_duplicates.sql", "compiled": true, "compiled_code": "\n\nwith eligibility as (\n\n select\n patient_id\n , member_id\n , payer\n , plan\n , enrollment_start_date\n , enrollment_end_date\n , data_source\n from raw.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'patient_id' as grain\n , patient_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom eligibility\n left join test_catalog\n on test_catalog.test_name = 'duplicate eligibility'\n and test_catalog.source_table = 'normalized_input__eligibility'\ngroup by\n eligibility.patient_id\n , eligibility.member_id\n , eligibility.payer\n , eligibility.plan\n , eligibility.enrollment_start_date\n , eligibility.enrollment_end_date\n , eligibility.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving 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.data_quality__claims_preprocessing_claim_type_unmapped": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_claim_type_unmapped", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_unmapped.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_unmapped.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_claim_type_unmapped"], "alias": "_int_claims_preprocessing_claim_type_unmapped", "checksum": {"name": "sha256", "checksum": "48e0b867c4bfac43b1ad76d39a4c844372f60bf5dc1a8bbdabc6f71987e056ae"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_claim_type_unmapped", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_claim_type_unmapped", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.653429, "relation_name": "raw.data_quality._int_claims_preprocessing_claim_type_unmapped", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith medical_claim as (\n\n select\n claim_id\n , data_source\n , claim_type\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom medical_claim\n left join test_catalog\n on test_catalog.test_name = 'claim_type missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\nwhere medical_claim.claim_type is null\ngroup by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_unmapped.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select\n claim_id\n , data_source\n , claim_type\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom medical_claim\n left join test_catalog\n on test_catalog.test_name = 'claim_type missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\nwhere medical_claim.claim_type is null\ngroup by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_invalid_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_invalid_values"], "alias": "_int_claims_preprocessing_medical_claim_invalid_values", "checksum": {"name": "sha256", "checksum": "00fc1edabd9d8489e3a56535cf5e1027e073187f1c5d734624110fd73904ac30"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_invalid_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_invalid_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.658442, "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_invalid_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith medical_claim as (\n\n select *\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, valid_bill_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.bill_type_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__bill_type')}} tob\n on medical_claim.bill_type_code = tob.bill_type_code\n left join test_catalog\n on test_catalog.test_name = 'bill_type_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and tob.bill_type_code is null\n and medical_claim.bill_type_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_revenue_center as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.revenue_center_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__revenue_center') }} rev\n on medical_claim.revenue_center_code = rev.revenue_center_code\n left join test_catalog\n on test_catalog.test_name = 'revenue_center_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and rev.revenue_center_code is null\n and medical_claim.revenue_center_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_discharge_disposition as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.discharge_disposition_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__discharge_disposition') }} discharge\n on medical_claim.discharge_disposition_code = discharge.discharge_disposition_code\n left join test_catalog\n on test_catalog.test_name = 'discharge_disposition_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and discharge.discharge_disposition_code is null\n and medical_claim.discharge_disposition_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_admit_source as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.admit_source_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__admit_source') }} adsource\n on medical_claim.admit_source_code = adsource.admit_source_code\n left join test_catalog\n on test_catalog.test_name = 'admit_source_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and adsource.admit_source_code is null\n and medical_claim.admit_source_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_admit_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.admit_type_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__admit_type') }} adtype\n on medical_claim.admit_type_code = adtype.admit_type_code\n left join test_catalog\n on test_catalog.test_name = 'admit_type_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and adtype.admit_type_code is null\n and medical_claim.admit_type_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_ms_drg as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.ms_drg_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__ms_drg') }} msdrg\n on medical_claim.ms_drg_code = msdrg.ms_drg_code\n left join test_catalog\n on test_catalog.test_name = 'ms_drg_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and msdrg.ms_drg_code is null\n and medical_claim.ms_drg_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_apr_drg as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.apr_drg_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__apr_drg') }} aprdrg\n on medical_claim.apr_drg_code = aprdrg.apr_drg_code\n left join test_catalog\n on test_catalog.test_name = 'apr_drg_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and aprdrg.apr_drg_code is null\n and medical_claim.apr_drg_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_present_on_admission as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_poa_1) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__present_on_admission') }} poa\n on medical_claim.diagnosis_poa_1 = poa.present_on_admit_code\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_poa_1 invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and poa.present_on_admit_code is null\n and medical_claim.diagnosis_poa_1 is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_procedure_code_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.procedure_code_type) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__code_type') }} codetype\n on medical_claim.procedure_code_type = codetype.code_type\n left join test_catalog\n on test_catalog.test_name = 'procedure_code_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claim_type = 'institutional'\n and codetype.code_type is null\n and medical_claim.procedure_code_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_place_of_service as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.place_of_service_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__place_of_service') }} pos\n on medical_claim.place_of_service_code = pos.place_of_service_code\n left join test_catalog\n on test_catalog.test_name = 'place_of_service_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claim_type = 'professional'\n and pos.place_of_service_code is null\n and medical_claim.place_of_service_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_diagnosis_code_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_code_type) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__code_type') }} codetype\n on medical_claim.diagnosis_code_type = codetype.code_type\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_code_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where codetype.code_type is null\n and medical_claim.diagnosis_code_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_diagnosis_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_code_1) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__icd_10_cm') }} icd\n on medical_claim.diagnosis_code_1 = icd.icd_10_cm\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_code_1 invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where diagnosis_code_type = 'icd-10-cm'\n and icd.icd_10_cm is null\n and medical_claim.diagnosis_code_1 is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_claim_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.claim_type) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__claim_type') }} claimtype\n on medical_claim.claim_type = claimtype.claim_type\n left join test_catalog\n on test_catalog.test_name = 'claim_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claimtype.claim_type is null\n and medical_claim.claim_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_bill_type\nunion all \nselect * from valid_revenue_center\nunion all \nselect * from valid_discharge_disposition\nunion all \nselect * from valid_admit_source\nunion all \nselect * from valid_admit_type\nunion all \nselect * from valid_ms_drg\nunion all \nselect * from valid_apr_drg\nunion all \nselect * from valid_present_on_admission\nunion all \nselect * from valid_diagnosis_code_type\nunion all \nselect * from valid_procedure_code_type\nunion all \nselect * from valid_diagnosis_code\nunion all \nselect * from valid_claim_type\nunion all \nselect * from valid_place_of_service", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__revenue_center", "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__present_on_admission", "package": null, "version": null}, {"name": "terminology__code_type", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}, {"name": "terminology__code_type", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__claim_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__revenue_center", "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__present_on_admission", "seed.the_tuva_project.terminology__code_type", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__claim_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_values.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select *\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, valid_bill_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.bill_type_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.bill_type tob\n on medical_claim.bill_type_code = tob.bill_type_code\n left join test_catalog\n on test_catalog.test_name = 'bill_type_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and tob.bill_type_code is null\n and medical_claim.bill_type_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_revenue_center as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.revenue_center_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.revenue_center rev\n on medical_claim.revenue_center_code = rev.revenue_center_code\n left join test_catalog\n on test_catalog.test_name = 'revenue_center_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and rev.revenue_center_code is null\n and medical_claim.revenue_center_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_discharge_disposition as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.discharge_disposition_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.discharge_disposition discharge\n on medical_claim.discharge_disposition_code = discharge.discharge_disposition_code\n left join test_catalog\n on test_catalog.test_name = 'discharge_disposition_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and discharge.discharge_disposition_code is null\n and medical_claim.discharge_disposition_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_admit_source as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.admit_source_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.admit_source adsource\n on medical_claim.admit_source_code = adsource.admit_source_code\n left join test_catalog\n on test_catalog.test_name = 'admit_source_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and adsource.admit_source_code is null\n and medical_claim.admit_source_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_admit_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.admit_type_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.admit_type adtype\n on medical_claim.admit_type_code = adtype.admit_type_code\n left join test_catalog\n on test_catalog.test_name = 'admit_type_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and adtype.admit_type_code is null\n and medical_claim.admit_type_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_ms_drg as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.ms_drg_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.ms_drg msdrg\n on medical_claim.ms_drg_code = msdrg.ms_drg_code\n left join test_catalog\n on test_catalog.test_name = 'ms_drg_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and msdrg.ms_drg_code is null\n and medical_claim.ms_drg_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_apr_drg as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.apr_drg_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.apr_drg aprdrg\n on medical_claim.apr_drg_code = aprdrg.apr_drg_code\n left join test_catalog\n on test_catalog.test_name = 'apr_drg_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and aprdrg.apr_drg_code is null\n and medical_claim.apr_drg_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_present_on_admission as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_poa_1) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.present_on_admission poa\n on medical_claim.diagnosis_poa_1 = poa.present_on_admit_code\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_poa_1 invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and poa.present_on_admit_code is null\n and medical_claim.diagnosis_poa_1 is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_procedure_code_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.procedure_code_type) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.code_type codetype\n on medical_claim.procedure_code_type = codetype.code_type\n left join test_catalog\n on test_catalog.test_name = 'procedure_code_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claim_type = 'institutional'\n and codetype.code_type is null\n and medical_claim.procedure_code_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_place_of_service as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.place_of_service_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.place_of_service pos\n on medical_claim.place_of_service_code = pos.place_of_service_code\n left join test_catalog\n on test_catalog.test_name = 'place_of_service_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claim_type = 'professional'\n and pos.place_of_service_code is null\n and medical_claim.place_of_service_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_diagnosis_code_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_code_type) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.code_type codetype\n on medical_claim.diagnosis_code_type = codetype.code_type\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_code_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where codetype.code_type is null\n and medical_claim.diagnosis_code_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_diagnosis_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_code_1) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.icd_10_cm icd\n on medical_claim.diagnosis_code_1 = icd.icd_10_cm\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_code_1 invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where diagnosis_code_type = 'icd-10-cm'\n and icd.icd_10_cm is null\n and medical_claim.diagnosis_code_1 is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_claim_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.claim_type) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.claim_type claimtype\n on medical_claim.claim_type = claimtype.claim_type\n left join test_catalog\n on test_catalog.test_name = 'claim_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claimtype.claim_type is null\n and medical_claim.claim_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_bill_type\nunion all \nselect * from valid_revenue_center\nunion all \nselect * from valid_discharge_disposition\nunion all \nselect * from valid_admit_source\nunion all \nselect * from valid_admit_type\nunion all \nselect * from valid_ms_drg\nunion all \nselect * from valid_apr_drg\nunion all \nselect * from valid_present_on_admission\nunion all \nselect * from valid_diagnosis_code_type\nunion all \nselect * from valid_procedure_code_type\nunion all \nselect * from valid_diagnosis_code\nunion all \nselect * from valid_claim_type\nunion all \nselect * from valid_place_of_service", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_denominators", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_denominators.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_denominators.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_denominators"], "alias": "_int_claims_preprocessing_medical_claim_denominators", "checksum": {"name": "sha256", "checksum": "dc9cb9b97fd99d9c96893688dbd1ad350f0d4464a40edda3cb9b7e67a31f0305"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_denominators", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_denominators", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.668782, "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_denominators", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n/*\n Denominator logic for invalid value tests is dependent on whether that\n specific field is populated or not. We created a macro to automatically\n generate the CTE. All invalid value tests must have a\n test_category = 'invalid_values' in the catalog seed.\n*/\nwith professional_denominator as (\n\n select\n cast('professional' as {{ dbt.type_string() }} ) as test_denominator_name\n , cast(count(distinct claim_id||data_source) as int) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('normalized_input__medical_claim') }}\n where claim_type = 'professional'\n\n)\n\n, institutional_denominator as (\n\n select\n cast('institutional' as {{ dbt.type_string() }} ) as test_denominator_name\n , count(distinct claim_id||data_source) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('normalized_input__medical_claim') }}\n where claim_type = 'institutional'\n\n)\n\n, all_claim_denominator as (\n\n select\n cast('all' as {{ dbt.type_string() }} ) as test_denominator_name\n , count(distinct claim_id||data_source) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('normalized_input__medical_claim') }}\n where claim_type is not null\n\n)\n\n, invalid_value_denominators as (\n\n {{ medical_claim_denominator_invalid_values(builtins.ref('normalized_input__medical_claim')) }}\n\n)\n\nselect * from institutional_denominator\nunion all \nselect * from professional_denominator\nunion all\nselect * from all_claim_denominator\nunion all\nselect * from invalid_value_denominators", "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": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.medical_claim_denominator_invalid_values"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_denominators.sql", "compiled": true, "compiled_code": "\n/*\n Denominator logic for invalid value tests is dependent on whether that\n specific field is populated or not. We created a macro to automatically\n generate the CTE. All invalid value tests must have a\n test_category = 'invalid_values' in the catalog seed.\n*/\nwith professional_denominator as (\n\n select\n cast('professional' as TEXT ) as test_denominator_name\n , cast(count(distinct claim_id||data_source) as int) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n\n)\n\n, institutional_denominator as (\n\n select\n cast('institutional' as TEXT ) as test_denominator_name\n , count(distinct claim_id||data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n\n)\n\n, all_claim_denominator as (\n\n select\n cast('all' as TEXT ) as test_denominator_name\n , count(distinct claim_id||data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type is not null\n\n)\n\n, invalid_value_denominators as (\n\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'admit_source_code'\n where rel.admit_source_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'admit_type_code'\n where rel.admit_type_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'apr_drg_code'\n where rel.apr_drg_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'bill_type_code'\n where rel.bill_type_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'billing_npi'\n where rel.billing_npi is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'claim_type'\n where rel.claim_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'diagnosis_code_1'\n where rel.diagnosis_code_1 is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'diagnosis_code_type'\n where rel.diagnosis_code_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'diagnosis_poa_1'\n where rel.diagnosis_poa_1 is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'discharge_disposition_code'\n where rel.discharge_disposition_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'facility_npi'\n where rel.facility_npi is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'ms_drg_code'\n where rel.ms_drg_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'place_of_service_code'\n where rel.place_of_service_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'procedure_code_type'\n where rel.procedure_code_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'rendering_npi'\n where rel.rendering_npi is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'revenue_center_code'\n where rel.revenue_center_code is not null\n group by cat.test_name\n \n\n)\n\nselect * from institutional_denominator\nunion all \nselect * from professional_denominator\nunion all\nselect * from all_claim_denominator\nunion all\nselect * from invalid_value_denominators", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_result_stage_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_eligibility.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_eligibility.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_result_stage_eligibility"], "alias": "_int_claims_preprocessing_test_result_stage_eligibility", "checksum": {"name": "sha256", "checksum": "753569040691376d857bdd73fb8791e45075deb95919342a7ee81013f9e6fda1"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_result_stage_eligibility", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_result_stage_eligibility", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.6454241, "relation_name": "raw.data_quality._int_claims_preprocessing_test_result_stage_eligibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n/*\n Tests with the category 'invalid_values' are joined to the denominator model\n on test_name since that denominator logic is dependent on whether that\n specific field is populated or not.\n\n All other tests are joined to the denominator model on claim_type.\n*/\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__claims_preprocessing_test_detail') }} det\ninner join {{ ref('data_quality__claims_preprocessing_eligibility_denominators') }} denom\n on det.claim_type = denom.test_denominator_name\nwhere source_table = 'normalized_input__eligibility'\nand test_category <> 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator\n\nunion all\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__claims_preprocessing_test_detail') }} det\ninner join {{ ref('data_quality__claims_preprocessing_eligibility_denominators') }} denom\n on det.test_name = denom.test_denominator_name\nwhere source_table = 'normalized_input__eligibility'\nand test_category = 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_eligibility_denominators", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_eligibility_denominators", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_eligibility.sql", "compiled": true, "compiled_code": "\n/*\n Tests with the category 'invalid_values' are joined to the denominator model\n on test_name since that denominator logic is dependent on whether that\n specific field is populated or not.\n\n All other tests are joined to the denominator model on claim_type.\n*/\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.data_quality.claims_preprocessing_test_detail det\ninner join raw.data_quality._int_claims_preprocessing_eligibility_denominators denom\n on det.claim_type = denom.test_denominator_name\nwhere source_table = 'normalized_input__eligibility'\nand test_category <> 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator\n\nunion all\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.data_quality.claims_preprocessing_test_detail det\ninner join raw.data_quality._int_claims_preprocessing_eligibility_denominators denom\n on det.test_name = denom.test_denominator_name\nwhere source_table = 'normalized_input__eligibility'\nand test_category = 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_dates_inst", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates_inst.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates_inst.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_dates_inst"], "alias": "_int_claims_preprocessing_medical_claim_dates_inst", "checksum": {"name": "sha256", "checksum": "6be9a7b6f055b101d3e9c22b9456b0f6cbbc6160ab81b685ad0a18a94789cce3"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_dates_inst", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_dates_inst", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.6724072, "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_dates_inst", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set claim_date_column_list = [\n 'admission_date'\n , 'discharge_date'\n] -%}\n\nwith claim_dates as (\n\n {{ medical_claim_date_check(builtins.ref('normalized_input__medical_claim'), claim_date_column_list, 'institutional') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom claim_dates\n left join test_catalog\n on test_catalog.test_name = claim_dates.column_checked||' invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_date_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates_inst.sql", "compiled": true, "compiled_code": "\n\nwith claim_dates as (\n\n select\n claim_id\n , data_source\n , 'admission_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.admission_date = cal.full_date\n where cal.full_date is null\n and rel.admission_date is not null\n and rel.claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'discharge_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.discharge_date = cal.full_date\n where cal.full_date is null\n and rel.discharge_date is not null\n and rel.claim_type = 'institutional'\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom claim_dates\n left join test_catalog\n on test_catalog.test_name = claim_dates.column_checked||' invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_eligibility_denominators", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_denominators.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_denominators.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_eligibility_denominators"], "alias": "_int_claims_preprocessing_eligibility_denominators", "checksum": {"name": "sha256", "checksum": "56012ed85540b96749b6aa611bf2946b4712d502a1025505a6fab8fba8591912"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_eligibility_denominators", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_eligibility_denominators", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.646562, "relation_name": "raw.data_quality._int_claims_preprocessing_eligibility_denominators", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n/*\n Denominator logic for invalid value tests is dependent on whether that\n specific field is populated or not. We created a macro to automatically\n generate the CTE. All invalid value tests must have a\n test_category = 'invalid_values' in the catalog seed.\n*/\nwith all_denominator as (\n\n select\n cast('all' as {{ dbt.type_string() }} ) as test_denominator_name\n , count(distinct patient_id) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('normalized_input__eligibility') }}\n\n)\n\n, invalid_value_denominators as (\n\n {{ eligibility_denominator_invalid_values(builtins.ref('normalized_input__eligibility')) }}\n\n)\n\nselect * from all_denominator\nunion all\nselect * from invalid_value_denominators", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}, {"name": "normalized_input__eligibility", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.eligibility_denominator_invalid_values"], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_denominators.sql", "compiled": true, "compiled_code": "\n/*\n Denominator logic for invalid value tests is dependent on whether that\n specific field is populated or not. We created a macro to automatically\n generate the CTE. All invalid value tests must have a\n test_category = 'invalid_values' in the catalog seed.\n*/\nwith all_denominator as (\n\n select\n cast('all' as TEXT ) as test_denominator_name\n , count(distinct patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, invalid_value_denominators as (\n\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'dual_status_code'\n where rel.dual_status_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'gender'\n where rel.gender is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'medicare_status_code'\n where rel.medicare_status_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'original_reason_entitlement_code'\n where rel.original_reason_entitlement_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'payer_type'\n where rel.payer_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'race'\n where rel.race is not null\n group by cat.test_name\n \n\n)\n\nselect * from all_denominator\nunion all\nselect * from invalid_value_denominators", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_plausibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_plausibility.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_plausibility.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_plausibility"], "alias": "_int_claims_preprocessing_medical_claim_plausibility", "checksum": {"name": "sha256", "checksum": "10f44a5f456acec65c5efd13c52edb1cc815fd756a2449b6fe1058bfaabd1efd"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_plausibility", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_plausibility", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.669981, "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_plausibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith medical_claim as (\n\n select *\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, claim_start_date_after_claim_end_date as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'claim_start_date after claim_end_date'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_start_date > medical_claim.claim_end_date\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, admission_date_after_discharge_date as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'admission_date after discharge_date'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and medical_claim.admission_date > medical_claim.discharge_date\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, admission_date_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'admission_date incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.admission_date is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, discharge_date_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'discharge_date incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.discharge_date is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, revenue_center_code_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'revenue_center_code incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.revenue_center_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, institutional_header_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'institutional header-level fields incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and (\n medical_claim.admit_type_code is not null\n or medical_claim.admit_type_code is not null\n or medical_claim.admit_source_code is not null\n or medical_claim.discharge_disposition_code is not null\n or medical_claim.bill_type_code is not null\n or medical_claim.ms_drg_code is not null\n or medical_claim.apr_drg_code is not null\n )\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, place_of_service_code_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'place_of_service_code incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and medical_claim.place_of_service_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from claim_start_date_after_claim_end_date\nunion all\nselect * from admission_date_after_discharge_date\nunion all\nselect * from admission_date_incorrect\nunion all\nselect * from discharge_date_incorrect\nunion all\nselect * from revenue_center_code_incorrect\nunion all\nselect * from institutional_header_incorrect\nunion all\nselect * from place_of_service_code_incorrect", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_plausibility.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select *\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, claim_start_date_after_claim_end_date as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'claim_start_date after claim_end_date'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_start_date > medical_claim.claim_end_date\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, admission_date_after_discharge_date as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'admission_date after discharge_date'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and medical_claim.admission_date > medical_claim.discharge_date\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, admission_date_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'admission_date incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.admission_date is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, discharge_date_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'discharge_date incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.discharge_date is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, revenue_center_code_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'revenue_center_code incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.revenue_center_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, institutional_header_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'institutional header-level fields incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and (\n medical_claim.admit_type_code is not null\n or medical_claim.admit_type_code is not null\n or medical_claim.admit_source_code is not null\n or medical_claim.discharge_disposition_code is not null\n or medical_claim.bill_type_code is not null\n or medical_claim.ms_drg_code is not null\n or medical_claim.apr_drg_code is not null\n )\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, place_of_service_code_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'place_of_service_code incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and medical_claim.place_of_service_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from claim_start_date_after_claim_end_date\nunion all\nselect * from admission_date_after_discharge_date\nunion all\nselect * from admission_date_incorrect\nunion all\nselect * from discharge_date_incorrect\nunion all\nselect * from revenue_center_code_incorrect\nunion all\nselect * from institutional_header_incorrect\nunion all\nselect * from place_of_service_code_incorrect", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_duplicates", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_duplicates.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_duplicates.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_duplicates"], "alias": "_int_claims_preprocessing_medical_claim_duplicates", "checksum": {"name": "sha256", "checksum": "2fbf09a6f1e10336741cd2b4ed5c173232e22a3add41a4d91e6050f597300429"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_duplicates", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_duplicates", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.666233, "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_duplicates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }}\n left join test_catalog\n on test_catalog.test_name = 'duplicate medical claims'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_id\n , claim_line_number\n , data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "language": "sql", "refs": [{"name": "data_quality__test_catalog", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.data_quality__test_catalog", "model.the_tuva_project.normalized_input__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_duplicates.sql", "compiled": true, "compiled_code": "\n\nwith test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n left join test_catalog\n on test_catalog.test_name = 'duplicate medical claims'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_id\n , claim_line_number\n , data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving 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.data_quality__claims_preprocessing_medical_claim_dates": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_dates"], "alias": "_int_claims_preprocessing_medical_claim_dates", "checksum": {"name": "sha256", "checksum": "3fb80a26a99074269c5d81b49d39e18c36c8c3a4cf9b6696d0a68a9e9dd32dea"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_dates", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_dates", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.671201, "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set claim_date_column_list = [\n 'claim_start_date'\n , 'claim_end_date'\n , 'claim_line_start_date'\n , 'claim_line_end_date'\n , 'paid_date'\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] -%}\n\nwith claim_dates as (\n\n {{ medical_claim_date_check(builtins.ref('normalized_input__medical_claim'), claim_date_column_list) }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom claim_dates\n left join test_catalog\n on test_catalog.test_name = claim_dates.column_checked||' invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_date_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates.sql", "compiled": true, "compiled_code": "\n\nwith claim_dates as (\n\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.claim_start_date = cal.full_date\n where cal.full_date is null\n and rel.claim_start_date is not null\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.claim_end_date = cal.full_date\n where cal.full_date is null\n and rel.claim_end_date is not null\n union all\n select\n claim_id\n , data_source\n , 'claim_line_start_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.claim_line_start_date = cal.full_date\n where cal.full_date is null\n and rel.claim_line_start_date is not null\n union all\n select\n claim_id\n , data_source\n , 'claim_line_end_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.claim_line_end_date = cal.full_date\n where cal.full_date is null\n and rel.claim_line_end_date is not null\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.paid_date = cal.full_date\n where cal.full_date is null\n and rel.paid_date is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_1' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_1 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_1 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_2' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_2 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_2 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_3' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_3 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_3 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_4' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_4 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_4 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_5' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_5 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_5 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_6' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_6 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_6 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_7' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_7 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_7 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_8' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_8 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_8 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_9' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_9 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_9 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_10' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_10 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_10 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_11' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_11 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_11 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_12' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_12 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_12 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_13' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_13 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_13 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_14' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_14 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_14 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_15' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_15 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_15 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_16' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_16 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_16 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_17' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_17 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_17 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_18' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_18 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_18 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_19' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_19 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_19 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_20' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_20 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_20 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_21' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_21 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_21 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_22' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_22 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_22 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_23' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_23 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_23 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_24' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_24 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_24 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_25' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_25 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_25 is not null\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom claim_dates\n left join test_catalog\n on test_catalog.test_name = claim_dates.column_checked||' invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_institutional_header_fail_details", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_institutional_header_fail_details.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_institutional_header_fail_details.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_institutional_header_fail_details"], "alias": "_int_claims_preprocessing_institutional_header_fail_details", "checksum": {"name": "sha256", "checksum": "75f3a4e11c345a50688ca8c027aa7d06520d0455bd39c2bee57cde06a7bbcb14"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_institutional_header_fail_details", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_institutional_header_fail_details", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.654776, "relation_name": "raw.data_quality._int_claims_preprocessing_institutional_header_fail_details", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set institutional_header_column_list = [\n 'claim_id'\n , 'claim_type'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'admission_date'\n , 'discharge_date'\n , 'admit_source_code'\n , 'admit_type_code'\n , 'discharge_disposition_code'\n , 'bill_type_code'\n , 'ms_drg_code'\n , 'facility_npi'\n , 'billing_npi'\n , 'rendering_npi'\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] -%}\n\n\nwith institutional_header_duplicates as (\n\n {{ medical_claim_header_duplicate_check(builtins.ref('normalized_input__medical_claim'), institutional_header_column_list, 'institutional') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , institutional_header_duplicates.claim_id\n , institutional_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom institutional_header_duplicates\n left join test_catalog\n on test_catalog.test_name = institutional_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n and test_catalog.claim_type = 'institutional'\ngroup by \n institutional_header_duplicates.claim_id\n , institutional_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_header_duplicate_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_institutional_header_fail_details.sql", "compiled": true, "compiled_code": "\n\nwith institutional_header_duplicates as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n , count(distinct claim_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_type' as column_checked\n , count(distinct claim_type) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n , count(distinct patient_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct patient_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n , count(distinct member_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct member_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n , count(distinct payer) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct payer) > 1\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n , count(distinct plan) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct plan) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n , count(distinct claim_start_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_start_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n , count(distinct claim_end_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_end_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'admission_date' as column_checked\n , count(distinct admission_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct admission_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'discharge_date' as column_checked\n , count(distinct discharge_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct discharge_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'admit_source_code' as column_checked\n , count(distinct admit_source_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct admit_source_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'admit_type_code' as column_checked\n , count(distinct admit_type_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct admit_type_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'discharge_disposition_code' as column_checked\n , count(distinct discharge_disposition_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct discharge_disposition_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_checked\n , count(distinct bill_type_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct bill_type_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'ms_drg_code' as column_checked\n , count(distinct ms_drg_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct ms_drg_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'facility_npi' as column_checked\n , count(distinct facility_npi) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct facility_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n , count(distinct billing_npi) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct billing_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'rendering_npi' as column_checked\n , count(distinct rendering_npi) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct rendering_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n , count(distinct diagnosis_code_type) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n , count(distinct diagnosis_code_1) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_2' as column_checked\n , count(distinct diagnosis_code_2) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_3' as column_checked\n , count(distinct diagnosis_code_3) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_4' as column_checked\n , count(distinct diagnosis_code_4) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_5' as column_checked\n , count(distinct diagnosis_code_5) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_6' as column_checked\n , count(distinct diagnosis_code_6) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_7' as column_checked\n , count(distinct diagnosis_code_7) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_8' as column_checked\n , count(distinct diagnosis_code_8) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_9' as column_checked\n , count(distinct diagnosis_code_9) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_10' as column_checked\n , count(distinct diagnosis_code_10) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_11' as column_checked\n , count(distinct diagnosis_code_11) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_12' as column_checked\n , count(distinct diagnosis_code_12) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_13' as column_checked\n , count(distinct diagnosis_code_13) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_14' as column_checked\n , count(distinct diagnosis_code_14) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_15' as column_checked\n , count(distinct diagnosis_code_15) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_16' as column_checked\n , count(distinct diagnosis_code_16) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_17' as column_checked\n , count(distinct diagnosis_code_17) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_18' as column_checked\n , count(distinct diagnosis_code_18) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_19' as column_checked\n , count(distinct diagnosis_code_19) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_20' as column_checked\n , count(distinct diagnosis_code_20) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_21' as column_checked\n , count(distinct diagnosis_code_21) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_22' as column_checked\n , count(distinct diagnosis_code_22) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_23' as column_checked\n , count(distinct diagnosis_code_23) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_24' as column_checked\n , count(distinct diagnosis_code_24) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_25' as column_checked\n , count(distinct diagnosis_code_25) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_1' as column_checked\n , count(distinct diagnosis_poa_1) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_2' as column_checked\n , count(distinct diagnosis_poa_2) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_3' as column_checked\n , count(distinct diagnosis_poa_3) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_4' as column_checked\n , count(distinct diagnosis_poa_4) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_5' as column_checked\n , count(distinct diagnosis_poa_5) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_6' as column_checked\n , count(distinct diagnosis_poa_6) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_7' as column_checked\n , count(distinct diagnosis_poa_7) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_8' as column_checked\n , count(distinct diagnosis_poa_8) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_9' as column_checked\n , count(distinct diagnosis_poa_9) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_10' as column_checked\n , count(distinct diagnosis_poa_10) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_11' as column_checked\n , count(distinct diagnosis_poa_11) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_12' as column_checked\n , count(distinct diagnosis_poa_12) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_13' as column_checked\n , count(distinct diagnosis_poa_13) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_14' as column_checked\n , count(distinct diagnosis_poa_14) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_15' as column_checked\n , count(distinct diagnosis_poa_15) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_16' as column_checked\n , count(distinct diagnosis_poa_16) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_17' as column_checked\n , count(distinct diagnosis_poa_17) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_18' as column_checked\n , count(distinct diagnosis_poa_18) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_19' as column_checked\n , count(distinct diagnosis_poa_19) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_20' as column_checked\n , count(distinct diagnosis_poa_20) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_21' as column_checked\n , count(distinct diagnosis_poa_21) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_22' as column_checked\n , count(distinct diagnosis_poa_22) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_23' as column_checked\n , count(distinct diagnosis_poa_23) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_24' as column_checked\n , count(distinct diagnosis_poa_24) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_25' as column_checked\n , count(distinct diagnosis_poa_25) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_type' as column_checked\n , count(distinct procedure_code_type) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_1' as column_checked\n , count(distinct procedure_code_1) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_2' as column_checked\n , count(distinct procedure_code_2) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_3' as column_checked\n , count(distinct procedure_code_3) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_4' as column_checked\n , count(distinct procedure_code_4) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_5' as column_checked\n , count(distinct procedure_code_5) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_6' as column_checked\n , count(distinct procedure_code_6) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_7' as column_checked\n , count(distinct procedure_code_7) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_8' as column_checked\n , count(distinct procedure_code_8) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_9' as column_checked\n , count(distinct procedure_code_9) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_10' as column_checked\n , count(distinct procedure_code_10) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_11' as column_checked\n , count(distinct procedure_code_11) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_12' as column_checked\n , count(distinct procedure_code_12) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_13' as column_checked\n , count(distinct procedure_code_13) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_14' as column_checked\n , count(distinct procedure_code_14) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_15' as column_checked\n , count(distinct procedure_code_15) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_16' as column_checked\n , count(distinct procedure_code_16) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_17' as column_checked\n , count(distinct procedure_code_17) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_18' as column_checked\n , count(distinct procedure_code_18) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_19' as column_checked\n , count(distinct procedure_code_19) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_20' as column_checked\n , count(distinct procedure_code_20) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_21' as column_checked\n , count(distinct procedure_code_21) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_22' as column_checked\n , count(distinct procedure_code_22) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_23' as column_checked\n , count(distinct procedure_code_23) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_24' as column_checked\n , count(distinct procedure_code_24) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_25' as column_checked\n , count(distinct procedure_code_25) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_1' as column_checked\n , count(distinct procedure_date_1) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_2' as column_checked\n , count(distinct procedure_date_2) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_3' as column_checked\n , count(distinct procedure_date_3) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_4' as column_checked\n , count(distinct procedure_date_4) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_5' as column_checked\n , count(distinct procedure_date_5) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_6' as column_checked\n , count(distinct procedure_date_6) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_7' as column_checked\n , count(distinct procedure_date_7) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_8' as column_checked\n , count(distinct procedure_date_8) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_9' as column_checked\n , count(distinct procedure_date_9) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_10' as column_checked\n , count(distinct procedure_date_10) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_11' as column_checked\n , count(distinct procedure_date_11) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_12' as column_checked\n , count(distinct procedure_date_12) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_13' as column_checked\n , count(distinct procedure_date_13) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_14' as column_checked\n , count(distinct procedure_date_14) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_15' as column_checked\n , count(distinct procedure_date_15) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_16' as column_checked\n , count(distinct procedure_date_16) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_17' as column_checked\n , count(distinct procedure_date_17) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_18' as column_checked\n , count(distinct procedure_date_18) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_19' as column_checked\n , count(distinct procedure_date_19) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_20' as column_checked\n , count(distinct procedure_date_20) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_21' as column_checked\n , count(distinct procedure_date_21) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_22' as column_checked\n , count(distinct procedure_date_22) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_23' as column_checked\n , count(distinct procedure_date_23) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_24' as column_checked\n , count(distinct procedure_date_24) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_25' as column_checked\n , count(distinct procedure_date_25) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n , count(distinct data_source) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct data_source) > 1\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , institutional_header_duplicates.claim_id\n , institutional_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom institutional_header_duplicates\n left join test_catalog\n on test_catalog.test_name = institutional_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n and test_catalog.claim_type = 'institutional'\ngroup by \n institutional_header_duplicates.claim_id\n , institutional_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_line_numbers.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_line_numbers.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_pharmacy_claim_line_numbers"], "alias": "_int_claims_preprocessing_pharmacy_claim_line_numbers", "checksum": {"name": "sha256", "checksum": "1c91805299434e6ad218c8c6152f060e7c0d39beb06b79043036893c8664f15d"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_pharmacy_claim_line_numbers", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_pharmacy_claim_line_numbers", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.6761532, "relation_name": "raw.data_quality._int_claims_preprocessing_pharmacy_claim_line_numbers", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith pharmacy_claim as (\n\n select\n claim_id\n , claim_line_number\n , data_source\n from {{ ref('normalized_input__pharmacy_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, add_row_num as (\n\n select\n claim_id\n , data_source\n , claim_line_number\n , row_number() over (\n partition by claim_id, data_source\n order by claim_line_number\n ) as expected_line_number\n from pharmacy_claim\n\n)\n\n, line_num_check as (\n\n select\n add_row_num.claim_id\n , add_row_num.data_source\n , add_row_num.claim_line_number\n , add_row_num.expected_line_number\n from add_row_num\n left join pharmacy_claim\n on add_row_num.claim_id = pharmacy_claim.claim_id\n and add_row_num.data_source = pharmacy_claim.data_source\n and add_row_num.expected_line_number = pharmacy_claim.claim_line_number\n where pharmacy_claim.claim_line_number is null\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom line_num_check\n left join test_catalog\n on test_catalog.test_name = 'claim_line_number non-sequential'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__pharmacy_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_line_numbers.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n\n select\n claim_id\n , claim_line_number\n , data_source\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, add_row_num as (\n\n select\n claim_id\n , data_source\n , claim_line_number\n , row_number() over (\n partition by claim_id, data_source\n order by claim_line_number\n ) as expected_line_number\n from pharmacy_claim\n\n)\n\n, line_num_check as (\n\n select\n add_row_num.claim_id\n , add_row_num.data_source\n , add_row_num.claim_line_number\n , add_row_num.expected_line_number\n from add_row_num\n left join pharmacy_claim\n on add_row_num.claim_id = pharmacy_claim.claim_id\n and add_row_num.data_source = pharmacy_claim.data_source\n and add_row_num.expected_line_number = pharmacy_claim.claim_line_number\n where pharmacy_claim.claim_line_number is null\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom line_num_check\n left join test_catalog\n on test_catalog.test_name = 'claim_line_number non-sequential'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_detail_stage_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_medical_claim.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_medical_claim.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "alias": "_int_claims_preprocessing_test_detail_stage_medical_claim", "checksum": {"name": "sha256", "checksum": "90c49436b2aea8df587eed018fcbf165ec55bed9f7c131471c5080eb850140fe"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_detail_stage_medical_claim", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_detail_stage_medical_claim", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.673771, "relation_name": "raw.data_quality._int_claims_preprocessing_test_detail_stage_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n \nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_institutional_header_fail_details') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_professional_header_fail_details') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_inst_missing_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_prof_missing_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_invalid_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_claim_type_unmapped') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_claim_type_mapping_failures') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_duplicates') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_plausibility') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_dates') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_dates_inst') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_line_numbers') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_invalid_npi') }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_institutional_header_fail_details", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_professional_header_fail_details", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_inst_missing_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_prof_missing_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_invalid_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_claim_type_unmapped", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_claim_type_mapping_failures", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_duplicates", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_plausibility", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_dates", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_dates_inst", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_line_numbers", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_invalid_npi", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_medical_claim.sql", "compiled": true, "compiled_code": "\n \nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_institutional_header_fail_details\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_professional_header_fail_details\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_invalid_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_claim_type_unmapped\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_claim_type_mapping_failures\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_duplicates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_plausibility\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_dates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_dates_inst\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_line_numbers\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_invalid_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__claims_preprocessing_claim_type_mapping_failures": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_claim_type_mapping_failures", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_mapping_failures.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_mapping_failures.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_claim_type_mapping_failures"], "alias": "_int_claims_preprocessing_claim_type_mapping_failures", "checksum": {"name": "sha256", "checksum": "c7f9f6ece097d661fdd2ebaaae833e508a840e267a9743c4157db3a6806ef18f"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_claim_type_mapping_failures", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_claim_type_mapping_failures", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.6650848, "relation_name": "raw.data_quality._int_claims_preprocessing_claim_type_mapping_failures", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith claim_type_mapping as (\n\n select \n claim_id\n , claim_line_number\n , data_source\n , claim_type as source_claim_type\n , case\n when bill_type_code is not null or revenue_center_code is not null \n then 'institutional'\n when place_of_service_code is not null\n then 'professional'\n else null\n end as data_profiling_claim_type\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_type_mapping.claim_id\n , claim_type_mapping.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom claim_type_mapping\n left join test_catalog\n on test_catalog.test_name = 'claim_type mapping incorrect'\n and test_catalog.source_table = 'normalized_input__medical_claim'\nwhere claim_type_mapping.source_claim_type <> claim_type_mapping.data_profiling_claim_type\ngroup by\n claim_type_mapping.claim_id\n , claim_type_mapping.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_mapping_failures.sql", "compiled": true, "compiled_code": "\n\nwith claim_type_mapping as (\n\n select \n claim_id\n , claim_line_number\n , data_source\n , claim_type as source_claim_type\n , case\n when bill_type_code is not null or revenue_center_code is not null \n then 'institutional'\n when place_of_service_code is not null\n then 'professional'\n else null\n end as data_profiling_claim_type\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_type_mapping.claim_id\n , claim_type_mapping.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom claim_type_mapping\n left join test_catalog\n on test_catalog.test_name = 'claim_type mapping incorrect'\n and test_catalog.source_table = 'normalized_input__medical_claim'\nwhere claim_type_mapping.source_claim_type <> claim_type_mapping.data_profiling_claim_type\ngroup by\n claim_type_mapping.claim_id\n , claim_type_mapping.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_prof_missing_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_prof_missing_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_prof_missing_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_prof_missing_values"], "alias": "_int_claims_preprocessing_medical_claim_prof_missing_values", "checksum": {"name": "sha256", "checksum": "8b0cea71d418a60bb765be2656c3f410adee4e57ea7cef3e1206a13d7b61a551"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_prof_missing_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_prof_missing_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.663726, "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set professional_missing_column_list = [\n 'claim_id'\n , 'claim_line_number'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'place_of_service_code'\n , 'hcpcs_code'\n , 'rendering_npi'\n , 'billing_npi'\n , 'paid_date'\n , 'paid_amount'\n , 'diagnosis_code_type'\n , 'diagnosis_code_1'\n , 'data_source'\n] -%}\n\nwith professional_missing as (\n\n {{ medical_claim_missing_column_check(builtins.ref('normalized_input__medical_claim'), professional_missing_column_list, 'professional') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'professional' as claim_type\n , 'claim_id' as grain\n , professional_missing.claim_id\n , professional_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom professional_missing\n left join test_catalog\n on test_catalog.test_name = professional_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n professional_missing.claim_id\n , professional_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_missing_column_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_prof_missing_values.sql", "compiled": true, "compiled_code": "\n\nwith professional_missing as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_id is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'claim_line_number' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_line_number is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where patient_id is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where member_id is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where payer is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where plan is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_start_date is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_end_date is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'place_of_service_code' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where place_of_service_code is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'hcpcs_code' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where hcpcs_code is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'rendering_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where rendering_npi is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where billing_npi is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where paid_date is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'paid_amount' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where paid_amount is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_type is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_1 is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where data_source is null\n and claim_type = 'professional'\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'professional' as claim_type\n , 'claim_id' as grain\n , professional_missing.claim_id\n , professional_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom professional_missing\n left join test_catalog\n on test_catalog.test_name = professional_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n professional_missing.claim_id\n , professional_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_pharmacy_claim_missing_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_missing_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_missing_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_pharmacy_claim_missing_values"], "alias": "_int_claims_preprocessing_pharmacy_claim_missing_values", "checksum": {"name": "sha256", "checksum": "0d9d6bdf7d07d356c3e5d413309250d0390bcebf13191d438073ec4bbd15caab"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_pharmacy_claim_missing_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_pharmacy_claim_missing_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.677496, "relation_name": "raw.data_quality._int_claims_preprocessing_pharmacy_claim_missing_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set pharmacy_claim_missing_column_list = [\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 , 'data_source'\n] -%}\n\nwith pharmacy_claim_missing as (\n\n {{ pharmacy_claim_missing_column_check(builtins.ref('normalized_input__pharmacy_claim'), pharmacy_claim_missing_column_list) }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , pharmacy_claim_missing.claim_id\n , pharmacy_claim_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom pharmacy_claim_missing\n left join test_catalog\n on test_catalog.test_name = pharmacy_claim_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n pharmacy_claim_missing.claim_id\n , pharmacy_claim_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__pharmacy_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.pharmacy_claim_missing_column_check"], "nodes": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_missing_values.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim_missing as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where claim_id is null\n union all\n select\n claim_id\n , data_source\n , 'claim_line_number' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where claim_line_number is null\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where patient_id is null\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where member_id is null\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where payer is null\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where plan is null\n union all\n select\n claim_id\n , data_source\n , 'prescribing_provider_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where prescribing_provider_npi is null\n union all\n select\n claim_id\n , data_source\n , 'dispensing_provider_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where dispensing_provider_npi is null\n union all\n select\n claim_id\n , data_source\n , 'dispensing_date' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where dispensing_date is null\n union all\n select\n claim_id\n , data_source\n , 'ndc_code' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where ndc_code is null\n union all\n select\n claim_id\n , data_source\n , 'quantity' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where quantity is null\n union all\n select\n claim_id\n , data_source\n , 'days_supply' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where days_supply is null\n union all\n select\n claim_id\n , data_source\n , 'refills' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where refills is null\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where paid_date is null\n union all\n select\n claim_id\n , data_source\n , 'paid_amount' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where paid_amount is null\n union all\n select\n claim_id\n , data_source\n , 'allowed_amount' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where allowed_amount is null\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where data_source is null\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , pharmacy_claim_missing.claim_id\n , pharmacy_claim_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pharmacy_claim_missing\n left join test_catalog\n on test_catalog.test_name = pharmacy_claim_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n pharmacy_claim_missing.claim_id\n , pharmacy_claim_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_line_numbers", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_line_numbers.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_line_numbers.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_line_numbers"], "alias": "_int_claims_preprocessing_medical_claim_line_numbers", "checksum": {"name": "sha256", "checksum": "deef4d1bde66ded6dd64f62752f9897f3468af41277dde6023a1db235a7dbee0"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_line_numbers", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_line_numbers", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.65968, "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_line_numbers", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith medical_claim as (\n\n select\n claim_id\n , claim_line_number\n , data_source\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, add_row_num as (\n\n select\n claim_id\n , data_source\n , claim_line_number\n , row_number() over (\n partition by claim_id, data_source\n order by claim_line_number\n ) as expected_line_number\n from medical_claim\n\n)\n\n, line_num_check as (\n\n select\n add_row_num.claim_id\n , add_row_num.data_source\n , add_row_num.claim_line_number\n , add_row_num.expected_line_number\n from add_row_num\n left join medical_claim\n on add_row_num.claim_id = medical_claim.claim_id\n and add_row_num.data_source = medical_claim.data_source\n and add_row_num.expected_line_number = medical_claim.claim_line_number\n where medical_claim.claim_line_number is null\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom line_num_check\n left join test_catalog\n on test_catalog.test_name = 'claim_line_number non-sequential'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_line_numbers.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select\n claim_id\n , claim_line_number\n , data_source\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, add_row_num as (\n\n select\n claim_id\n , data_source\n , claim_line_number\n , row_number() over (\n partition by claim_id, data_source\n order by claim_line_number\n ) as expected_line_number\n from medical_claim\n\n)\n\n, line_num_check as (\n\n select\n add_row_num.claim_id\n , add_row_num.data_source\n , add_row_num.claim_line_number\n , add_row_num.expected_line_number\n from add_row_num\n left join medical_claim\n on add_row_num.claim_id = medical_claim.claim_id\n and add_row_num.data_source = medical_claim.data_source\n and add_row_num.expected_line_number = medical_claim.claim_line_number\n where medical_claim.claim_line_number is null\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom line_num_check\n left join test_catalog\n on test_catalog.test_name = 'claim_line_number non-sequential'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "alias": "_int_claims_preprocessing_test_detail_stage_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "15aa4ab74653536059fe3a74860ddba1dda096a19e3b91c99cc5dfd8dfa9a52a"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_detail_stage_pharmacy_claim", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_detail_stage_pharmacy_claim", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.6799, "relation_name": "raw.data_quality._int_claims_preprocessing_test_detail_stage_pharmacy_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_pharmacy_claim_duplicates') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_pharmacy_claim_missing_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_pharmacy_header_fail_details') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_pharmacy_claim_line_numbers') }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_pharmacy_claim_duplicates", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_pharmacy_claim_missing_values", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_pharmacy_header_fail_details", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_pharmacy_claim_duplicates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_pharmacy_claim_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_pharmacy_header_fail_details\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_pharmacy_claim_line_numbers", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_result_stage_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_medical_claim.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_medical_claim.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_result_stage_medical_claim"], "alias": "_int_claims_preprocessing_test_result_stage_medical_claim", "checksum": {"name": "sha256", "checksum": "b82452396dfd23506edfaf91e86b508fc39c9816457fa20ca576fd56e9fd2694"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_result_stage_medical_claim", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_result_stage_medical_claim", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.6674418, "relation_name": "raw.data_quality._int_claims_preprocessing_test_result_stage_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n/*\n Tests with the category 'invalid_values' are joined to the denominator model\n on test_name since that denominator logic is dependent on whether that\n specific field is populated or not.\n\n All other tests are joined to the denominator model on claim_type.\n*/\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__claims_preprocessing_test_detail') }} det\ninner join {{ ref('data_quality__claims_preprocessing_medical_claim_denominators') }} denom\n on det.claim_type = denom.test_denominator_name\nwhere source_table = 'normalized_input__medical_claim'\nand test_category <> 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator\n\nunion all\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__claims_preprocessing_test_detail') }} det\ninner join {{ ref('data_quality__claims_preprocessing_medical_claim_denominators') }} denom\n on det.test_name = denom.test_denominator_name\nwhere source_table = 'normalized_input__medical_claim'\nand test_category = 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_denominators", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_medical_claim_denominators", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_medical_claim.sql", "compiled": true, "compiled_code": "\n/*\n Tests with the category 'invalid_values' are joined to the denominator model\n on test_name since that denominator logic is dependent on whether that\n specific field is populated or not.\n\n All other tests are joined to the denominator model on claim_type.\n*/\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.data_quality.claims_preprocessing_test_detail det\ninner join raw.data_quality._int_claims_preprocessing_medical_claim_denominators denom\n on det.claim_type = denom.test_denominator_name\nwhere source_table = 'normalized_input__medical_claim'\nand test_category <> 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator\n\nunion all\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.data_quality.claims_preprocessing_test_detail det\ninner join raw.data_quality._int_claims_preprocessing_medical_claim_denominators denom\n on det.test_name = denom.test_denominator_name\nwhere source_table = 'normalized_input__medical_claim'\nand test_category = 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values": {"database": "raw", "schema": "data_quality", "name": "data_quality__claims_preprocessing_eligibility_invalid_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_invalid_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_invalid_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_eligibility_invalid_values"], "alias": "_int_claims_preprocessing_eligibility_invalid_values", "checksum": {"name": "sha256", "checksum": "9439c228ea9e3e4d6899e36323d5ffd13bc9245eb6aedf2dafa9a6880ccdaa86"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_eligibility_invalid_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "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": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_eligibility_invalid_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708461580.642947, "relation_name": "raw.data_quality._int_claims_preprocessing_eligibility_invalid_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith eligiblity as (\n\n select *\n from {{ ref('normalized_input__eligibility') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, valid_gender as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.gender\n , count(eligiblity.gender) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__gender') }} gender\n on eligiblity.gender = gender.gender\n left join test_catalog\n on test_catalog.test_name = 'gender invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where gender.gender is null\n and eligiblity.gender is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.gender\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_race as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.race\n , count(eligiblity.race) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__race') }} race\n on eligiblity.race = race.description\n left join test_catalog\n on test_catalog.test_name = 'race invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where race.description is null\n and eligiblity.race is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.race\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_payer_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.payer_type\n , count(eligiblity.payer_type) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__payer_type') }} payer\n on eligiblity.payer_type = payer.payer_type\n left join test_catalog\n on test_catalog.test_name = 'payer_type invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where payer.payer_type is null\n and eligiblity.payer_type is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.payer_type\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_orec as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.original_reason_entitlement_code\n , count(eligiblity.original_reason_entitlement_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__medicare_orec') }} orec\n on eligiblity.original_reason_entitlement_code = orec.original_reason_entitlement_code\n left join test_catalog\n on test_catalog.test_name = 'original_reason_entitlement_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where orec.original_reason_entitlement_code is null\n and eligiblity.original_reason_entitlement_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.original_reason_entitlement_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_dual_status_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.dual_status_code\n , count(eligiblity.dual_status_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__medicare_dual_eligibility') }} dual\n on eligiblity.dual_status_code = dual.dual_status_code\n left join test_catalog\n on test_catalog.test_name = 'dual_status_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where dual.dual_status_code is null\n and eligiblity.dual_status_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.dual_status_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_medicare_status_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.medicare_status_code\n , count(eligiblity.medicare_status_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__medicare_status') }} status\n on eligiblity.medicare_status_code = status.medicare_status_code\n left join test_catalog\n on test_catalog.test_name = 'medicare_status_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where status.medicare_status_code is null\n and eligiblity.medicare_status_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.medicare_status_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_gender\nunion all\nselect * from valid_race\nunion all\nselect * from valid_payer_type\nunion all\nselect * from valid_orec\nunion all\nselect * from valid_dual_status_code\nunion all\nselect * from valid_medicare_status_code", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}, {"name": "data_quality__test_catalog", "package": null, "version": null}, {"name": "terminology__gender", "package": null, "version": null}, {"name": "terminology__race", "package": null, "version": null}, {"name": "terminology__payer_type", "package": null, "version": null}, {"name": "terminology__medicare_orec", "package": null, "version": null}, {"name": "terminology__medicare_dual_eligibility", "package": null, "version": null}, {"name": "terminology__medicare_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__gender", "seed.the_tuva_project.terminology__race", "seed.the_tuva_project.terminology__payer_type", "seed.the_tuva_project.terminology__medicare_orec", "seed.the_tuva_project.terminology__medicare_dual_eligibility", "seed.the_tuva_project.terminology__medicare_status"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_invalid_values.sql", "compiled": true, "compiled_code": "\n\nwith eligiblity as (\n\n select *\n from raw.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, valid_gender as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.gender\n , count(eligiblity.gender) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.gender gender\n on eligiblity.gender = gender.gender\n left join test_catalog\n on test_catalog.test_name = 'gender invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where gender.gender is null\n and eligiblity.gender is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.gender\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_race as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.race\n , count(eligiblity.race) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.race race\n on eligiblity.race = race.description\n left join test_catalog\n on test_catalog.test_name = 'race invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where race.description is null\n and eligiblity.race is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.race\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_payer_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.payer_type\n , count(eligiblity.payer_type) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.payer_type payer\n on eligiblity.payer_type = payer.payer_type\n left join test_catalog\n on test_catalog.test_name = 'payer_type invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where payer.payer_type is null\n and eligiblity.payer_type is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.payer_type\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_orec as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.original_reason_entitlement_code\n , count(eligiblity.original_reason_entitlement_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.medicare_orec orec\n on eligiblity.original_reason_entitlement_code = orec.original_reason_entitlement_code\n left join test_catalog\n on test_catalog.test_name = 'original_reason_entitlement_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where orec.original_reason_entitlement_code is null\n and eligiblity.original_reason_entitlement_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.original_reason_entitlement_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_dual_status_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.dual_status_code\n , count(eligiblity.dual_status_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.medicare_dual_eligibility dual\n on eligiblity.dual_status_code = dual.dual_status_code\n left join test_catalog\n on test_catalog.test_name = 'dual_status_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where dual.dual_status_code is null\n and eligiblity.dual_status_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.dual_status_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_medicare_status_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.medicare_status_code\n , count(eligiblity.medicare_status_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.medicare_status status\n on eligiblity.medicare_status_code = status.medicare_status_code\n left join test_catalog\n on test_catalog.test_name = 'medicare_status_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where status.medicare_status_code is null\n and eligiblity.medicare_status_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.medicare_status_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_gender\nunion all\nselect * from valid_race\nunion all\nselect * from valid_payer_type\nunion all\nselect * from valid_orec\nunion all\nselect * from valid_dual_status_code\nunion all\nselect * from valid_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.ed_classification__stg_patient": {"database": "raw", "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": "30b001c3fe63f86b5238b8a4e5fce8c14208440e4b7c1946ac88cab63d6ecf34"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.701333, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\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 raw.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": "raw", "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": "1fe06aa48203595e38fc761b7637348e5538505e33cf0d53cd02badfbaffed19"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.700235, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect\r\n encounter_id\r\n , encounter_type\r\n , patient_id\r\n , encounter_end_date\r\n , facility_npi\r\n , primary_diagnosis_code_type\r\n , primary_diagnosis_code\r\n , primary_diagnosis_description\r\n , paid_amount\r\n , allowed_amount\r\n , charge_amount\r\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_npi\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom raw.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": "raw", "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": "aea95d899770ce28128dc7c441f257bc9e65ea173050f4b009ed4b9d5a9257ca"}, "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": null}, "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_npi": {"name": "facility_npi", "description": "The NPI 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": null}, "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}, "created_at": 1708461580.6962812, "relation_name": "raw.ed_classification.summary", "raw_code": "{{ config(\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 , cast({{ date_part(\"year\", \"class.encounter_end_date\") }} as {{ dbt.type_string() }}) \n || right('0'||cast({{ date_part(\"month\", \"class.encounter_end_date\") }} as {{ dbt.type_string() }}),2) \n 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_npi\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-- , null as facility_latitude\n-- , null as facility_longitude\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 using(classification)\nleft join {{ ref('terminology__provider') }} fac_prov \n on class.facility_npi = 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.type_string", "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 raw.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 , cast(date_part('year', class.encounter_end_date) as TEXT) \n || right('0'||cast(date_part('month', class.encounter_end_date) as TEXT),2) \n 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_npi\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-- , null as facility_latitude\n-- , null as facility_longitude\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 raw.ed_classification._int_filter_encounter_with_classification class\ninner join raw.ed_classification._value_set_categories cat\n using(classification)\nleft join raw.terminology.provider fac_prov \n on class.facility_npi = 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 raw.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": "raw", "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": "80676310168b37cbf053c00ae3c076e0ac2e0721c36fef1ca88fccda0b3059fc"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.697552, "relation_name": "raw.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)))\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 raw.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": "raw", "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": "e3cd9b0cdfc21a60c13cf98b333e67a500f9aa93c5f44d243ee1e8e8c844d33f"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.698824, "relation_name": "raw.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)))\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_npi\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom raw.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 raw.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 raw.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_npi\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom raw.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__condition": {"database": "raw", "schema": "jaffle_shop", "name": "readmissions__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/staging/readmissions__stg_core__condition.sql", "original_file_path": "models/readmissions/staging/readmissions__stg_core__condition.sql", "unique_id": "model.the_tuva_project.readmissions__stg_core__condition", "fqn": ["the_tuva_project", "readmissions", "staging", "readmissions__stg_core__condition"], "alias": "readmissions__stg_core__condition", "checksum": {"name": "sha256", "checksum": "a040a3440e44d4f4ce099ff084b2c766561b91097b6fe53dd23f59ddf996f245"}, "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": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.727078, "relation_name": null, "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n encounter_id\n, normalized_code\n, condition_rank\n, normalized_code_type\n, claim_id\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/readmissions/staging/readmissions__stg_core__condition.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n, normalized_code\n, condition_rank\n, normalized_code_type\n, claim_id\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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.readmissions__stg_core__encounter": {"database": "raw", "schema": "jaffle_shop", "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": "0e8b26d829a0d9f2ce05b6341873bd4ed7a347a3578412e75abb80510da6c163"}, "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": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.727964, "relation_name": null, "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_npi,\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_npi,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "schema": "jaffle_shop", "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": "1a0e7d8853a0b8062b61826a96fd9d17f5098f8fcab3f4358f1352060c4760d7"}, "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": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.728616, "relation_name": null, "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "8acb4f433d275d04d71fce1ceaa4b8684adb2d54587cacd59090577865357b91"}, "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": "#161a7d"}, "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_npi": {"name": "facility_npi", "description": "A name or ID for the facility where the 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": []}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.70573, "relation_name": "raw.readmissions.encounter_augmented", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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_npi,\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_npi,\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom\n raw.readmissions._int_encounter aa\n left join raw.readmissions._int_index_admission bb\n on aa.encounter_id = bb.encounter_id\n left join raw.readmissions._int_planned_encounter cc\n on aa.encounter_id = cc.encounter_id \n left join raw.readmissions._int_encounter_specialty_cohort dd\n on aa.encounter_id = dd.encounter_id\n left join raw.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": "raw", "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": "858de26396b984f5e2adda6855e80fe6a5593cc897ca8342462465859174b4cc"}, "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": "#161a7d"}, "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_npi": {"name": "facility_npi", "description": "A name or ID for the facility where the 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": []}, "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": []}, "total_paid_amount": {"name": "total_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_patient_id": {"name": "readmission_patient_id", "description": "The unique identifier for the patient", "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.709524, "relation_name": "raw.readmissions.readmission_summary", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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_npi,\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_npi 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 raw.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_npi,\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_npi 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-02-20 20:47:44.615990+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": "raw", "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": "48b64009c3102d94509d9e7cadabb92b55281dab968718216983a90ea7019145"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.7129622, "relation_name": "raw.readmissions._int_encounter_overlap", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.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-02-20 20:47:44.615990+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": "raw", "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": "9a59bc8886820ac96f6bb358a7141e6e3935746059b72b5b6f8f43ac28c70902"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.714122, "relation_name": "raw.readmissions._int_encounter_specialty_cohort", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 proc.encounter_id, 1 as c_rank\n from {{ ref('readmissions__procedure_ccs') }} proc\n left join {{ ref('readmissions__surgery_gynecology_cohort') }} sgc\n on proc.procedure_code = sgc.icd_10_pcs\n left join {{ ref('readmissions__specialty_cohort') }} sgsc\n on proc.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 proc.encounter_id, 1 as c_rank\n from raw.readmissions._int_procedure_ccs proc\n left join raw.readmissions._value_set_surgery_gynecology_cohort sgc\n on proc.procedure_code = sgc.icd_10_pcs\n left join raw.readmissions._value_set_specialty_cohort sgsc\n on proc.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 raw.readmissions._int_encounter_with_ccs diag\n inner join raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "37717cfd0573e09b8777034f35b5fa808f2f7b43c85511c9ccd3c89e0be18f0e"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.711453, "relation_name": "raw.readmissions._int_encounter_data_quality", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.readmissions._int_encounter_overlap )\n\t or\n\t aa.encounter_id in (select distinct encounter_id_B\n\t from raw.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 raw.readmissions._int_encounter_with_ccs aa\n left join raw.terminology.discharge_disposition bb\n on aa.discharge_disposition_code = bb.discharge_disposition_code\n left join raw.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-02-20 20:47:44.615990+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": "raw", "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": "db0b1ccfbdfa87302900ce66ce965ea395d50e0beaf321a5f84dab08e88e20bd"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.7164428, "relation_name": "raw.readmissions._int_exclusion", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.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 raw.readmissions._value_set_exclusion_ccs_diagnosis_category )\n)\n)\n\n\nselect *, '2024-02-20 20:47:44.615990+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": "raw", "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": "38fc51f07ea6674747976b72fd7050258d6f472437f3b3f290c9cbba92768288"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.717721, "relation_name": "raw.readmissions._int_index_admission", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.readmissions._int_encounter a\ninner join raw.readmissions._int_index_time_requirement b\n on a.encounter_id = b.encounter_id\ninner join raw.readmissions._int_index_discharge_requirement c\n on a.encounter_id = c.encounter_id\nleft join raw.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": "raw", "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": "15c3b8b384a9c1963185400e2990e1e273317848106f1ff9c8327211664c02e2"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.719956, "relation_name": "raw.readmissions._int_index_time_requirement", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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\n\nselect encounter_id, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__encounter') }}\nwhere discharge_date <= (select max(discharge_date)\n from {{ ref('readmissions__encounter') }} ) - 30", "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_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\n\nselect encounter_id, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.readmissions._int_encounter\nwhere discharge_date <= (select max(discharge_date)\n from raw.readmissions._int_encounter ) - 30", "extra_ctes_injected": true, "extra_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": "raw", "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": "5994adcd4d41b8fec01785252882bde419f5221b7df7f56a1deb5a80a2ed8e9d"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.721209, "relation_name": "raw.readmissions._int_planned_encounter", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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\nunion distinct\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from always_planned_dx\nunion distinct\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 raw.readmissions._int_procedure_ccs pccs\ninner join raw.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 raw.readmissions._int_encounter_with_ccs dccs\ninner join raw.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 raw.readmissions._int_procedure_ccs pccs\ninner join raw.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 raw.readmissions._int_procedure_ccs pcs\ninner join raw.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 raw.readmissions._int_encounter_with_ccs dccs\nleft join raw.readmissions._value_set_acute_diagnosis_icd_10_cm adi\n on dccs.primary_diagnosis_code = adi.icd_10_cm\nleft join raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run from always_planned_px\nunion distinct\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run from always_planned_dx\nunion distinct\nselect *, '2024-02-20 20:47:44.615990+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": "raw", "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": "d47d990a3ebb98b14acf75aca3525c2e0cf91f0d4c253a91423bd27dd7882fd7"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.7262259, "relation_name": "raw.readmissions._int_encounter", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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_npi as {{ dbt.type_string() }}) as facility_npi,\n cast(ms_drg_code as {{ dbt.type_string() }}) as ms_drg_code,\n cast(paid_amount as 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"], "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_npi,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_npi as TEXT) as facility_npi,\n cast(ms_drg_code as TEXT) as ms_drg_code,\n cast(paid_amount as numeric) as paid_amount,\n cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code,\n '2024-02-20 20:47:44.615990+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_npi,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "454bd26e9c7757935669745f67484c3cad454c109894c66a2a89254e7719e940"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.7244558, "relation_name": "raw.readmissions._int_readmission_crude", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 bb.admit_date - aa.discharge_date 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 raw.readmissions._int_encounter enc\nleft join raw.readmissions._int_encounter_overlap over_a\n on enc.encounter_id = over_a.encounter_id_A\nleft join raw.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 bb.admit_date - aa.discharge_date 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-02-20 20:47:44.615990+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": "raw", "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": "76e7c9d3546ce2e8d751fb68428a8830d4381a8439cf5a1fa9d9e1a8a809632f"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.722922, "relation_name": "raw.readmissions._int_procedure_ccs", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom\n __dbt__cte__readmissions__stg_core__procedure aa\n left join raw.terminology.icd_10_pcs bb\n on aa.normalized_code = bb.icd_10_pcs\n left join raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "fa6e0d7b51af58d7f3c449b4a8940be6889d8ae35f215cbc9eb4a9ecd6c0292e"}, "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": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.7153301, "relation_name": "raw.readmissions._int_encounter_with_ccs", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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_npi,\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_npi,\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-02-20 20:47:44.615990+00:00' as tuva_last_run\n\nfrom\n raw.readmissions._int_encounter aa\n left join raw.terminology.icd_10_cm bb\n on aa.primary_diagnosis_code = bb.icd_10_cm\n left join raw.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": "raw", "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": "a6d50fccefae6d851d6e9f2e0d1b7484a749c1154e123aa571149d178e5c493b"}, "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": "#161a7d"}, "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": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708461580.718838, "relation_name": "raw.readmissions._int_index_discharge_requirement", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "70d2e322d0454e7e6b4495d993e09ca0ae8ce6a187352f317e71736fea8886e8"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.750022, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "e7856238a902887befd29ec7e3bac11a7b4f47acd1c1fdfddfd2c399f96b08a0"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.753845, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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__medical_claim": {"database": "raw", "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": "ac9505314ff81401a8769ba8ca69e5b557247ffdf67064119e1761431e14ccec"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.7525918, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "b9477f45b603026a03efcbf99a649bc6c6efed51def11e7394ced446affafc0a"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.75122, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "2c279af2ee66d13d66fc3b476f1f05d50464c68cf1392a9cdf0372382d5f861d"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.731401, "relation_name": "raw.cms_hcc.patient_risk_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\nwith demographic_factors as (\n\n select\n patient_id\n /* concatenate demographic risk factors */\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 as description\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 , 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 , 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 , 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.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 , 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 as description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 , 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 , 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-02-20 20:47:44.615990+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": "raw", "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": "81f21b6b35a6a4252de5e54fa3ccba93cf7ddcdcf43ed091a1863d747987a5b1"}, "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": null}, "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_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": null}, "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}, "created_at": 1708461580.733588, "relation_name": "raw.cms_hcc.patient_risk_scores", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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, 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, 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 , cast(payment_year as integer) as payment_year\n from payment\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_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}], "sources": [], "metrics": [], "depends_on": {"macros": ["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"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/final/cms_hcc__patient_risk_scores.sql", "compiled": true, "compiled_code": "\nwith seed_adjustment_rates as (\n\n select\n model_version\n , payment_year\n , normalization_factor\n , ma_coding_pattern_adjustment\n from raw.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 raw.cms_hcc.patient_risk_factors\n\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, 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 , cast(payment_year as integer) as payment_year\n from payment\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_year\n , '2024-02-20 20:47:44.615990+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_disease_factors": {"database": "raw", "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": "fb967f6ddbb04b1dc9328cbf7b5d3a6329e6125c093c82b9d4bd7523e63ae23d"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.738944, "relation_name": "raw.cms_hcc._int_disease_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.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 raw.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 raw.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-02-20 20:47:44.615990+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": "raw", "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": "155bf30580bbc0a59066b57ba1438839023f6c4a9e0e9816ff93ae0ad9c158fd"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.741977, "relation_name": "raw.cms_hcc._int_eligible_conditions", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 extract(year from claim_end_date) = {{ collection_year }}\n and cpt_hcpcs_list.payment_year = {{ payment_year }}\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 and extract(year from claim_end_date) = {{ collection_year }}\n and left(bill_type_code,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 and extract(year from claim_end_date) = {{ collection_year }}\n and cpt_hcpcs_list.payment_year = {{ payment_year }}\n and left(bill_type_code,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.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 raw.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 extract(year from claim_end_date) = 2023\n and cpt_hcpcs_list.payment_year = 2024\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 and extract(year from claim_end_date) = 2023\n and left(bill_type_code,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 and extract(year from claim_end_date) = 2023\n and cpt_hcpcs_list.payment_year = 2024\n and left(bill_type_code,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-02-20 20:47:44.615990+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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "66e2be3239422654a01581544fc558481a152eb75bacf4ca278747aa129045e8"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.7405, "relation_name": "raw.cms_hcc._int_disease_interaction_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.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 raw.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 raw.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-02-20 20:47:44.615990+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": "raw", "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": "1a6c4c3a3a63cf23ca01edbe354f5dba6c649074ed36296c1600812a1dfd21a6"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.745719, "relation_name": "raw.cms_hcc._int_hcc_hierarchy", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.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 raw.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-02-20 20:47:44.615990+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": "raw", "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": "926a1b30a51cf5c1ad0366abe8d327667ef3ac3d8077e33c3c63614cbd037e30"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.7469819, "relation_name": "raw.cms_hcc._int_hcc_mapping", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.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 raw.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-02-20 20:47:44.615990+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": "raw", "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": "e25402973b98514d42132379e6d45084c4cdff563cd246bc0815d9cf5966b61d"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.7373571, "relation_name": "raw.cms_hcc._int_disabled_interaction_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.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 raw.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 raw.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-02-20 20:47:44.615990+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": "raw", "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": "e5e5caeb296422ea69a372c2d25c1e1c9e4cf51f42bfea64e2ad816dd9f170de"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.744392, "relation_name": "raw.cms_hcc._int_hcc_count_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.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 raw.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 raw.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-02-20 20:47:44.615990+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": "raw", "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": "560c71885b9179637391c384eeb8dd9caaf86b88aa2d24f1e682af0dfc1636a5"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.735984, "relation_name": "raw.cms_hcc._int_demographic_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 , 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 , 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 raw.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 raw.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 , 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 , 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-02-20 20:47:44.615990+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": "raw", "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": "7d9c481c57764727db112430c3ff3e81feb9803185fb23d48d72c49229fe9131"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.748605, "relation_name": "raw.cms_hcc._int_members", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 = collection_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 /* filter to members with eligibility in collection or payment year */\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 )\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 < '{{ collection_year_start }}'\n then '{{ collection_year_start }}'\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > '{{ collection_year_end }}'\n then '{{ collection_year_end }}'\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 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 )\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 , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\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 when dual_status_code is null then TRUE\n else FALSE\n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\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 end as orec_default\n /* Setting default true until institutional logic is added */\n , TRUE as institutional_status_default\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 , 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 , 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.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\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 /* filter to members with eligibility in collection or payment year */\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, 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 < '2023-01-01'\n then '2023-01-01'\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > '2023-12-31'\n then '2023-12-31'\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 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, 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 , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\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 when dual_status_code is null then TRUE\n else FALSE\n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\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 end as orec_default\n /* Setting default true until institutional logic is added */\n , TRUE as institutional_status_default\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 , 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 , 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-02-20 20:47:44.615990+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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "16e0fe646674ecb9ba8c68c730d5940dcd46f019fe123a75424a9d18069c38c4"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.7431931, "relation_name": "raw.cms_hcc._int_enrollment_interaction_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 raw.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 raw.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-02-20 20:47:44.615990+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.emergency_department__stg_eligibility": {"database": "raw", "schema": "jaffle_shop", "name": "emergency_department__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/staging/emergency_department__stg_eligibility.sql", "original_file_path": "models/claims_preprocessing/emergency_department/staging/emergency_department__stg_eligibility.sql", "unique_id": "model.the_tuva_project.emergency_department__stg_eligibility", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "staging", "emergency_department__stg_eligibility"], "alias": "emergency_department__stg_eligibility", "checksum": {"name": "sha256", "checksum": "1bd9ca7bf8cd5223c8899ea469f329321267b6eade053479c71ec8f908ac1cd8"}, "config": {"enabled": true, "alias": "emergency_department__stg_eligibility", "schema": null, "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "emergency_department__stg_eligibility", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false}, "created_at": 1708461580.789231, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect\r\n patient_id\r\n , birth_date\r\n , gender\r\n , race\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__eligibility') }}", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/staging/emergency_department__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , birth_date\n , gender\n , race\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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.emergency_department__stg_medical_claim": {"database": "raw", "schema": "jaffle_shop", "name": "emergency_department__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/staging/emergency_department__stg_medical_claim.sql", "original_file_path": "models/claims_preprocessing/emergency_department/staging/emergency_department__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.emergency_department__stg_medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "staging", "emergency_department__stg_medical_claim"], "alias": "emergency_department__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "4365a2093999ddc140f0034a80966ba040b8f647c4a61577381650fbfce367c5"}, "config": {"enabled": true, "alias": "emergency_department__stg_medical_claim", "schema": null, "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "emergency_department__stg_medical_claim", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false}, "created_at": 1708461580.789953, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect \r\n claim_id\r\n , claim_line_number\r\n , patient_id\r\n , claim_type\r\n , claim_start_date\r\n , claim_end_date\r\n , admission_date\r\n , discharge_date\r\n , facility_npi\r\n , ms_drg_code\r\n , apr_drg_code\r\n , admit_source_code\r\n , admit_type_code\r\n , discharge_disposition_code\r\n , paid_amount\r\n , allowed_amount\r\n , charge_amount\r\n , diagnosis_code_type\r\n , diagnosis_code_1\r\n , data_source\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__medical_claim') }}", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/staging/emergency_department__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.emergency_department__stg_service_category": {"database": "raw", "schema": "jaffle_shop", "name": "emergency_department__stg_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/staging/emergency_department__stg_service_category.sql", "original_file_path": "models/claims_preprocessing/emergency_department/staging/emergency_department__stg_service_category.sql", "unique_id": "model.the_tuva_project.emergency_department__stg_service_category", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "staging", "emergency_department__stg_service_category"], "alias": "emergency_department__stg_service_category", "checksum": {"name": "sha256", "checksum": "35c03761a4196a871dc44fc5a9b7a8e2cec88fde6a979d87d127cdcdb81ad7f8"}, "config": {"enabled": true, "alias": "emergency_department__stg_service_category", "schema": null, "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "emergency_department__stg_service_category", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false}, "created_at": 1708461580.7906508, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , claim_type\r\n , claim_line_number\r\n , service_category_2\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('service_category__service_category_grouper')}}", "language": "sql", "refs": [{"name": "service_category__service_category_grouper", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__service_category_grouper"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/staging/emergency_department__stg_service_category.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper", "extra_ctes_injected": true, "extra_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__summary": {"database": "raw", "schema": "claims_preprocessing", "name": "emergency_department__summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/final/emergency_department__summary.sql", "original_file_path": "models/claims_preprocessing/emergency_department/final/emergency_department__summary.sql", "unique_id": "model.the_tuva_project.emergency_department__summary", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "final", "emergency_department__summary"], "alias": "emergency_department_summary", "checksum": {"name": "sha256", "checksum": "8ebd499a3126efc3cee2bf74ba9ef7d569bb29e63d71db01f89a18215705e715"}, "config": {"enabled": true, "alias": "emergency_department_summary", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "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 the emergency_department encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the patient was admitted.", "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": []}, "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 as of their admission date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "/terminology/demographics/gender"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The race of the patient.", "meta": {"terminology": "/terminology/demographics/race"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "The NPI for the facility where the encounter occurred.", "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": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "The MS-DRG code associted with the inpatient visit", "meta": {"terminology": "/terminology/conditions-and-procedures/ms-drg"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "The MS-DRG description associted with the inpatient visit", "meta": {"terminology": "/terminology/conditions-and-procedures/ms-drg"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "Indicates whether the MS-DRG is medical or surgical in nature.", "meta": {"terminology": "/terminology/conditions-and-procedures/ms-drg"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "The APR-DRG code associted with the inpatient visit", "meta": {"terminology": "/terminology/conditions-and-procedures/apr-drg"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "The APR-DRG description associted with the inpatient visit", "meta": {"terminology": "/terminology/conditions-and-procedures/apr-drg"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Admission source code for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/admit-source"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Admission source description for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/admit-source"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Admission type code for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/admit-type"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Admission type description for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/admit-type"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Discharge disposition code for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/discharge-disposition"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Discharge disposition description for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/discharge-disposition"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total paid amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total allowed amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total charge amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "The length of stay for the encoujnter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "1 if a patient died during the encounter, 0 otherwise.", "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\").", "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": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "emergency_department_summary", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.779389, "relation_name": "raw.claims_preprocessing.emergency_department_summary", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith distinct_encounters as (\r\nselect distinct\r\n a.encounter_id\r\n, a.patient_id\r\n, b.encounter_start_date\r\n, b.encounter_end_date\r\nfrom {{ ref('emergency_department__int_encounter_id') }} a\r\ninner join {{ ref('emergency_department__int_encounter_start_and_end_dates') }} b\r\n on a.encounter_id = b.encounter_id\r\n)\r\n\r\n, institutional_claim_details as (\r\n select\r\n b.encounter_id\r\n , first.diagnosis_code_1\r\n , first.diagnosis_code_type\r\n , first.facility_npi as facility_npi\r\n , first.ms_drg_code as ms_drg_code\r\n , first.apr_drg_code as apr_drg_code\r\n , first.admit_source_code as admit_source_code\r\n , first.admit_type_code as admit_type_code\r\n , last.discharge_disposition_code as discharge_disposition_code\r\n , sum(paid_amount) as inst_paid_amount\r\n , sum(allowed_amount) as inst_allowed_amount\r\n , sum(charge_amount) as inst_charge_amount\r\n , max(data_source) as data_source\r\n from {{ ref('medical_claim') }} a\r\n inner join {{ ref('emergency_department__int_encounter_id') }} b\r\n on a.claim_id = b.claim_id\r\n and a.claim_line_number = b.claim_line_number\r\n and a.claim_type = 'institutional'\r\n inner join {{ ref('emergency_department__int_first_claim_values') }} first\r\n on b.encounter_id = first.encounter_id\r\n and first.claim_row = 1\r\n inner join {{ ref('emergency_department__int_last_claim_values') }} last\r\n on b.encounter_id = last.encounter_id\r\n and last.claim_row = 1\r\n group by\r\n b.encounter_id\r\n , first.diagnosis_code_1\r\n , first.diagnosis_code_type\r\n , first.facility_npi\r\n , first.ms_drg_code\r\n , first.apr_drg_code\r\n , first.admit_source_code\r\n , first.admit_type_code\r\n , last.discharge_disposition_code\r\n)\r\n\r\n, professional_claim_details as (\r\nselect\r\n b.encounter_id\r\n, sum(paid_amount) as prof_paid_amount\r\n, sum(allowed_amount) as prof_allowed_amount\r\n, sum(charge_amount) as prof_charge_amount\r\nfrom {{ ref('medical_claim') }} a\r\ninner join {{ ref('emergency_department__int_encounter_id') }} b\r\n on a.claim_id = b.claim_id\r\n and a.claim_line_number = b.claim_line_number\r\n and a.claim_type = 'professional'\r\ngroup by 1\r\n)\r\n\r\n, patient as (\r\nselect distinct\r\n patient_id\r\n, birth_date\r\n, gender\r\n, race\r\nfrom {{ ref('eligibility') }}\r\n)\r\n\r\n, provider as (\r\nselect\r\n a.encounter_id\r\n, max(a.facility_npi) as facility_npi\r\n, b.provider_first_name\r\n, b.provider_last_name\r\n, count(distinct facility_npi) as npi_count\r\nfrom {{ ref('emergency_department__int_institutional_encounter_id') }} a\r\nleft join {{ ref('terminology__provider') }} b\r\n on a.facility_npi = b.npi\r\ngroup by 1,3,4\r\n)\r\n\r\nselect\r\n a.encounter_id\r\n , a.encounter_start_date\r\n , a.encounter_end_date\r\n , a.patient_id\r\n , {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\r\n , e.gender\r\n , e.race\r\n , c.diagnosis_code_type as primary_diagnosis_code_type\r\n , c.diagnosis_code_1 as primary_diagnosis_code\r\n , coalesce(icd10cm.description, icd9cm.long_description) as primary_diagnosis_description\r\n , f.facility_npi\r\n , f.provider_first_name\r\n , f.provider_last_name\r\n , c.ms_drg_code\r\n , j.ms_drg_description\r\n , j.medical_surgical\r\n , c.apr_drg_code\r\n , k.apr_drg_description\r\n , c.admit_source_code\r\n , h.admit_source_description\r\n , c.admit_type_code\r\n , i.admit_type_description\r\n , c.discharge_disposition_code\r\n , g.discharge_disposition_description\r\n , c.inst_paid_amount + coalesce(d.prof_paid_amount,0) as total_paid_amount\r\n , c.inst_allowed_amount + coalesce(d.prof_allowed_amount,0) as total_allowed_amount\r\n , c.inst_charge_amount + coalesce(d.prof_charge_amount,0) as total_charge_amount\r\n , {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\r\n , case\r\n when c.discharge_disposition_code = '20' then 1\r\n else 0\r\n end mortality_flag\r\n , data_source\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom distinct_encounters a\r\nleft join institutional_claim_details c\r\n on a.encounter_id = c.encounter_id\r\nleft join professional_claim_details d\r\n on a.encounter_id = d.encounter_id\r\nleft join patient e\r\n on a.patient_id = e.patient_id\r\nleft join provider f\r\n on a.encounter_id = f.encounter_id\r\nleft join {{ ref('terminology__discharge_disposition') }} g\r\n on c.discharge_disposition_code = g.discharge_disposition_code\r\nleft join {{ ref('terminology__admit_source') }} h\r\n on c.admit_source_code = h.admit_source_code\r\nleft join {{ ref('terminology__admit_type') }} i\r\n on c.admit_type_code = i.admit_type_code\r\nleft join {{ ref('terminology__ms_drg') }} j\r\n on c.ms_drg_code = j.ms_drg_code\r\nleft join {{ ref('terminology__apr_drg') }} k\r\n on c.apr_drg_code = k.apr_drg_code\r\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\r\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\r\n and c.diagnosis_code_type = 'icd-10-cm'\r\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\r\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\r\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "emergency_department__int_encounter_id", "package": null, "version": null}, {"name": "emergency_department__int_encounter_start_and_end_dates", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "emergency_department__int_encounter_id", "package": null, "version": null}, {"name": "emergency_department__int_first_claim_values", "package": null, "version": null}, {"name": "emergency_department__int_last_claim_values", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "emergency_department__int_encounter_id", "package": null, "version": null}, {"name": "eligibility", "package": null, "version": null}, {"name": "emergency_department__int_institutional_encounter_id", "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.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "model.input_layer.medical_claim", "model.the_tuva_project.emergency_department__int_first_claim_values", "model.the_tuva_project.emergency_department__int_last_claim_values", "model.input_layer.eligibility", "model.the_tuva_project.emergency_department__int_institutional_encounter_id", "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/emergency_department/final/emergency_department__summary.sql", "compiled": true, "compiled_code": "\n\nwith distinct_encounters as (\nselect distinct\n a.encounter_id\n, a.patient_id\n, b.encounter_start_date\n, b.encounter_end_date\nfrom raw.claims_preprocessing._int_emergency_department_encounter_id a\ninner join raw.claims_preprocessing._int_emergency_department_encounter_start_and_end_dates b\n on a.encounter_id = b.encounter_id\n)\n\n, institutional_claim_details as (\n select\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi as facility_npi\n , first.ms_drg_code as ms_drg_code\n , first.apr_drg_code as apr_drg_code\n , first.admit_source_code as admit_source_code\n , first.admit_type_code as admit_type_code\n , last.discharge_disposition_code as discharge_disposition_code\n , sum(paid_amount) as inst_paid_amount\n , sum(allowed_amount) as inst_allowed_amount\n , sum(charge_amount) as inst_charge_amount\n , max(data_source) as data_source\n from tuva.input_layer.medical_claim a\n inner join raw.claims_preprocessing._int_emergency_department_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'institutional'\n inner join raw.claims_preprocessing._int_emergency_department_first_claim_values first\n on b.encounter_id = first.encounter_id\n and first.claim_row = 1\n inner join raw.claims_preprocessing._int_emergency_department_last_claim_values last\n on b.encounter_id = last.encounter_id\n and last.claim_row = 1\n group by\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi\n , first.ms_drg_code\n , first.apr_drg_code\n , first.admit_source_code\n , first.admit_type_code\n , last.discharge_disposition_code\n)\n\n, professional_claim_details as (\nselect\n b.encounter_id\n, sum(paid_amount) as prof_paid_amount\n, sum(allowed_amount) as prof_allowed_amount\n, sum(charge_amount) as prof_charge_amount\nfrom tuva.input_layer.medical_claim a\ninner join raw.claims_preprocessing._int_emergency_department_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'professional'\ngroup by 1\n)\n\n, patient as (\nselect distinct\n patient_id\n, birth_date\n, gender\n, race\nfrom tuva.input_layer.eligibility\n)\n\n, provider as (\nselect\n a.encounter_id\n, max(a.facility_npi) as facility_npi\n, b.provider_first_name\n, b.provider_last_name\n, count(distinct facility_npi) as npi_count\nfrom raw.claims_preprocessing._int_emergency_department_institutional_encounter_id a\nleft join raw.terminology.provider b\n on a.facility_npi = b.npi\ngroup by 1,3,4\n)\n\nselect\n a.encounter_id\n , a.encounter_start_date\n , a.encounter_end_date\n , a.patient_id\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.description, icd9cm.long_description) as primary_diagnosis_description\n , f.facility_npi\n , f.provider_first_name\n , f.provider_last_name\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 , c.inst_paid_amount + coalesce(d.prof_paid_amount,0) as total_paid_amount\n , c.inst_allowed_amount + coalesce(d.prof_allowed_amount,0) as total_allowed_amount\n , c.inst_charge_amount + coalesce(d.prof_charge_amount,0) as total_charge_amount\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 , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom distinct_encounters a\nleft join institutional_claim_details c\n on a.encounter_id = c.encounter_id\nleft join professional_claim_details d\n on a.encounter_id = d.encounter_id\nleft join patient e\n on a.patient_id = e.patient_id\nleft join provider f\n on a.encounter_id = f.encounter_id\nleft join raw.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join raw.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join raw.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join raw.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join raw.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join raw.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 raw.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.emergency_department__int_encounter_id": {"database": "raw", "schema": "claims_preprocessing", "name": "emergency_department__int_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_id.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_id.sql", "unique_id": "model.the_tuva_project.emergency_department__int_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_encounter_id"], "alias": "_int_emergency_department_encounter_id", "checksum": {"name": "sha256", "checksum": "1b1e06a7a4058ce1bc75f70df18fdc14cdee1e4b5fb5b91d69f9425d613c4174"}, "config": {"enabled": true, "alias": "_int_emergency_department_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Fix encounter_id so each professional claim can only belong to one encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_encounter_id", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "view", "enabled": true, "bind": false}, "created_at": 1708461580.780589, "relation_name": "raw.claims_preprocessing._int_emergency_department_encounter_id", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n inst.patient_id,\r\n inst.claim_id,\r\n med.claim_line_number,\r\n inst.encounter_id,\r\n '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('emergency_department__int_institutional_encounter_id') }} inst\r\nleft join {{ ref('emergency_department__stg_medical_claim') }} med\r\n on inst.claim_id = med.claim_id\r\n\r\nunion distinct\r\n\r\nselect\r\n patient_id,\r\n claim_id,\r\n claim_line_number,\r\n encounter_id,\r\n '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('emergency_department__int_professional_encounter_id') }}\r\nwhere (orphan_claim_flag = 0) and (encounter_count = 1)", "language": "sql", "refs": [{"name": "emergency_department__int_institutional_encounter_id", "package": null, "version": null}, {"name": "emergency_department__stg_medical_claim", "package": null, "version": null}, {"name": "emergency_department__int_professional_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__int_institutional_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.emergency_department__int_professional_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select\n inst.patient_id,\n inst.claim_id,\n med.claim_line_number,\n inst.encounter_id,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_emergency_department_institutional_encounter_id inst\nleft join __dbt__cte__emergency_department__stg_medical_claim med\n on inst.claim_id = med.claim_id\n\nunion distinct\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n encounter_id,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_emergency_department_professional_encounter_id\nwhere (orphan_claim_flag = 0) and (encounter_count = 1)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.emergency_department__stg_medical_claim", "sql": " __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.emergency_department__int_first_claim_values": {"database": "raw", "schema": "claims_preprocessing", "name": "emergency_department__int_first_claim_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_first_claim_values.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_first_claim_values.sql", "unique_id": "model.the_tuva_project.emergency_department__int_first_claim_values", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_first_claim_values"], "alias": "_int_emergency_department_first_claim_values", "checksum": {"name": "sha256", "checksum": "fe3253288286bf928d309ef00ffb92bb14102ceee899756613101a644051c6f7"}, "config": {"enabled": true, "alias": "_int_emergency_department_first_claim_values", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Orders claims to pull out encounter details (admit type, drg, etc)", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_first_claim_values", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.783207, "relation_name": "raw.claims_preprocessing._int_emergency_department_first_claim_values", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith first_claim_values as(\r\n select distinct\r\n e.encounter_id\r\n , coalesce(claim_start_date, admission_date) as claim_start\r\n , diagnosis_code_1\r\n , diagnosis_code_type\r\n , admit_source_code\r\n , admit_type_code\r\n , facility_npi\r\n , ms_drg_code\r\n , apr_drg_code\r\n from {{ ref('emergency_department__int_encounter_id')}} e\r\n inner join {{ ref('emergency_department__stg_medical_claim') }} m\r\n on e.claim_id = m.claim_id\r\n where claim_type = 'institutional'\r\n)\r\n\r\nselect\r\n encounter_id\r\n , claim_start\r\n , diagnosis_code_1\r\n , diagnosis_code_type\r\n , admit_source_code\r\n , admit_type_code\r\n , facility_npi\r\n , ms_drg_code\r\n , apr_drg_code\r\n , row_number() over (partition by encounter_id order by claim_start) as claim_row\r\nfrom first_claim_values", "language": "sql", "refs": [{"name": "emergency_department__int_encounter_id", "package": null, "version": null}, {"name": "emergency_department__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_first_claim_values.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n from raw.claims_preprocessing._int_emergency_department_encounter_id e\n inner join __dbt__cte__emergency_department__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , row_number() over (partition by encounter_id order by claim_start) as claim_row\nfrom first_claim_values", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.emergency_department__stg_medical_claim", "sql": " __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.emergency_department__int_institutional_claims": {"database": "raw", "schema": "claims_preprocessing", "name": "emergency_department__int_institutional_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_claims.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_claims.sql", "unique_id": "model.the_tuva_project.emergency_department__int_institutional_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_institutional_claims"], "alias": "_int_emergency_department_institutional_claims", "checksum": {"name": "sha256", "checksum": "d7a8dab04353842b385f21fddfdf9f559a42df81bdac6682afd7454d3747e5ea"}, "config": {"enabled": true, "alias": "_int_emergency_department_institutional_claims", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "description": "All emergency_department institutional claim_ids with header values and data quality flags", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_institutional_claims", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.784508, "relation_name": "raw.claims_preprocessing._int_emergency_department_institutional_claims", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith emergency_department_claim_lines as (\r\nselect\r\n mc.patient_id,\r\n mc.claim_id,\r\n mc.claim_line_number,\r\n mc.claim_start_date,\r\n mc.claim_end_date,\r\n mc.admission_date,\r\n mc.discharge_date,\r\n mc.admit_source_code,\r\n mc.admit_type_code,\r\n mc.discharge_disposition_code,\r\n mc.facility_npi,\r\n mc.claim_type,\r\n mc.data_source\r\nfrom {{ ref('emergency_department__stg_medical_claim') }} mc\r\ninner join {{ ref('emergency_department__stg_service_category')}} sc\r\n on mc.claim_id = sc.claim_id\r\nwhere mc.claim_type = 'institutional'\r\n and sc.service_category_2 = 'Emergency Department'\r\n),\r\n\r\ndata_quality_flags as (\r\nselect\r\n claim_id,\r\n-- patient_id_not_unique:\r\n case\r\n when count(distinct patient_id) > 1 then 1\r\n else 0\r\n end as patient_id_not_unique,\r\n-- patient_id_missing: \r\n case\r\n when max(patient_id) is null then 1\r\n else 0\r\n end as patient_id_missing, \r\n-- claim_start_date_not_unique:\r\n case\r\n when count(distinct claim_start_date) > 1 then 1\r\n else 0\r\n end as claim_start_date_not_unique,\r\n-- claim_start_date_missing: \r\n case\r\n when max(claim_start_date) is null then 1\r\n else 0\r\n end as claim_start_date_missing,\r\n-- claim_end_date_not_unique:\r\n case\r\n when count(distinct claim_end_date) > 1 then 1\r\n else 0\r\n end as claim_end_date_not_unique,\r\n-- claim_end_date_missing: \r\n case\r\n when max(claim_end_date) is null then 1\r\n else 0\r\n end as claim_end_date_missing,\r\n-- claim_start_date_after_claim_end_date:\r\n case\r\n when min(claim_start_date) > max(claim_end_date) then 1\r\n else 0\r\n end as claim_start_date_after_claim_end_date,\r\n-- admission_date_not_unique:\r\n case\r\n when count(distinct admission_date) > 1 then 1\r\n else 0\r\n end as admission_date_not_unique,\r\n-- admission_date_missing: \r\n case\r\n when max(admission_date) is null then 1\r\n else 0\r\n end as admission_date_missing,\r\n-- discharge_date_not_unique:\r\n case\r\n when count(distinct discharge_date) > 1 then 1\r\n else 0\r\n end as discharge_date_not_unique,\r\n-- discharge_date_missing: \r\n case\r\n when max(discharge_date) is null then 1\r\n else 0\r\n end as discharge_date_missing,\r\n-- admission_date_after_discharge_date:\r\n case\r\n when min(admission_date) > max(discharge_date) then 1\r\n else 0\r\n end as admission_date_after_discharge_date,\r\n-- admit_type_code_not_unique:\r\n case\r\n when count(distinct admit_type_code) > 1 then 1\r\n else 0\r\n end as admit_type_code_not_unique,\r\n-- admit_type_code_missing: \r\n case\r\n when max(admit_type_code) is null then 1\r\n else 0\r\n end as admit_type_code_missing, \r\n-- admit_source_code_not_unique:\r\n case\r\n when count(distinct admit_source_code) > 1 then 1\r\n else 0\r\n end as admit_source_code_not_unique,\r\n-- admit_source_code_missing: \r\n case\r\n when max(admit_source_code) is null then 1\r\n else 0\r\n end as admit_source_code_missing, \r\n-- discharge_disposition_code_not_unique:\r\n case\r\n when count(distinct discharge_disposition_code) > 1 then 1\r\n else 0\r\n end as discharge_disposition_code_not_unique,\r\n-- discharge_disposition_code_missing: \r\n case\r\n when max(discharge_disposition_code) is null then 1\r\n else 0\r\n end as discharge_disposition_code_missing,\r\n-- facility_npi_not_unique:\r\n case\r\n when count(distinct facility_npi) > 1 then 1\r\n else 0\r\n end as facility_npi_not_unique,\r\n-- facility_npi_missing: \r\n case\r\n when max(facility_npi) is null then 1\r\n else 0\r\n end as facility_npi_missing,\r\n-- claim_type_not_unique:\r\n case\r\n when count(distinct claim_type) > 1 then 1\r\n else 0\r\n end as claim_type_not_unique,\r\n-- claim_type_missing: \r\n case\r\n when max(claim_type) is null then 1\r\n else 0\r\n end as claim_type_missing,\r\n-- claim_type_not_institutional:\r\n case\r\n when max(claim_type) <> 'institutional'\r\n and min(claim_type) <> 'institutional' then 1\r\n else 0\r\n end as claim_type_not_institutional\r\nfrom emergency_department_claim_lines\r\ngroup by claim_id\r\n),\r\n\r\n\r\nheader_level_values as (\r\nselect\r\n claim_id,\r\n max(patient_id) as patient_id,\r\n min(claim_start_date) as claim_start_date,\r\n max(claim_end_date) as claim_end_date,\r\n min(admission_date) as admission_date,\r\n max(discharge_date) as discharge_date,\r\n max(admit_source_code) as admit_source_code,\r\n max(admit_type_code) as admit_type_code,\r\n max(discharge_disposition_code) as discharge_disposition_code,\r\n max(facility_npi) as facility_npi,\r\n max(claim_type) as claim_type,\r\n coalesce(min(admission_date),\r\n min(claim_start_date)) as start_date,\r\n coalesce(max(discharge_date),\r\n max(claim_end_date)) as end_date,\r\n case\r\n when min(admission_date) is not null then 'admission_date'\r\n when min(claim_start_date) is not null then 'claim_start_date'\r\n else null\r\n end as date_used_as_start_date,\r\n case\r\n when max(discharge_date) is not null then 'discharge_date'\r\n when max(claim_end_date) is not null then 'claim_end_date'\r\n else null\r\n end as date_used_as_end_date,\r\n data_source\r\nfrom emergency_department_claim_lines\r\ngroup by claim_id, data_source\r\n)\r\n\r\nselect\r\n h.patient_id as patient_id,\r\n h.claim_id as claim_id, \r\n h.claim_start_date as claim_start_date,\r\n h.claim_end_date as claim_end_date,\r\n h.admission_date as admission_date,\r\n h.discharge_date as discharge_date,\r\n h.admit_source_code as admit_source_code,\r\n h.admit_type_code as admit_type_code,\r\n h.discharge_disposition_code as discharge_disposition_code,\r\n h.facility_npi as facility_npi,\r\n h.claim_type as claim_type,\r\n h.start_date as start_date,\r\n h.end_date as end_date,\r\n h.date_used_as_start_date,\r\n h.date_used_as_end_date, \r\n\r\n case\r\n when\r\n ( (dq.patient_id_not_unique = 1) or\r\n (dq.patient_id_missing = 1) or\r\n (dq.discharge_disposition_code_not_unique = 1) or\r\n (dq.discharge_disposition_code_missing = 1) or\r\n (dq.facility_npi_not_unique = 1) or\r\n (dq.facility_npi_missing = 1) or\r\n (h.date_used_as_start_date is null) or\r\n\t(h.date_used_as_end_date is null) or\r\n\t(h.start_date > h.end_date) ) then 1\r\n else 0\r\n end as dq_problem,\r\n\r\n case\r\n when\r\n ( (dq.claim_start_date_not_unique = 1) or\r\n\t(dq.claim_start_date_missing = 1) or\r\n (dq.claim_end_date_not_unique = 1) or\r\n (dq.claim_end_date_missing = 1) or\r\n (dq.claim_start_date_after_claim_end_date = 1) or\r\n (dq.admission_date_not_unique = 1) or\r\n (dq.admission_date_missing = 1) or\r\n (dq.discharge_date_not_unique = 1) or\r\n (dq.discharge_date_missing = 1) or\r\n (dq.admission_date_after_discharge_date = 1) or\r\n (dq.admit_type_code_not_unique = 1) or\r\n (dq.admit_type_code_missing = 1) or\r\n (dq.admit_source_code_not_unique = 1) or\r\n (dq.admit_source_code_missing = 1) or\t\r\n (dq.claim_type_not_unique = 1) or\r\n (dq.claim_type_missing = 1) or\r\n (dq.claim_type_not_institutional = 1) ) then 1\r\n else 0\r\n end as dq_insight,\r\n\r\n case\r\n when (h.date_used_as_start_date is null) then 1\r\n else 0\r\n end as start_date_not_determined,\r\n \r\n case\r\n when (h.date_used_as_end_date is null) then 1\r\n else 0\r\n end as end_date_not_determined,\r\n\r\n case\r\n when (h.start_date > h.end_date) then 1\r\n else 0\r\n end as start_date_after_end_date,\r\n \r\n dq.patient_id_not_unique as patient_id_not_unique,\r\n dq.patient_id_missing as patient_id_missing,\r\n dq.claim_start_date_not_unique as claim_start_date_not_unique,\r\n dq.claim_start_date_missing as claim_start_date_missing,\r\n dq.claim_end_date_not_unique as claim_end_date_not_unique,\r\n dq.claim_end_date_missing as claim_end_date_missing,\r\n dq.claim_start_date_after_claim_end_date\r\n as claim_start_date_after_claim_end_date,\r\n dq.admission_date_not_unique as admission_date_not_unique,\r\n dq.admission_date_missing as admission_date_missing,\r\n dq.discharge_date_not_unique as discharge_date_not_unique,\r\n dq.discharge_date_missing as discharge_date_missing,\r\n dq.admission_date_after_discharge_date\r\n as admission_date_after_discharge_date,\r\n dq.admit_type_code_not_unique\r\n as admit_type_code_not_unique,\r\n dq.admit_type_code_missing\r\n as admit_type_code_missing,\r\n dq.admit_source_code_not_unique\r\n as admit_source_code_not_unique,\r\n dq.admit_source_code_missing\r\n as admit_source_code_missing,\r\n dq.discharge_disposition_code_not_unique\r\n as discharge_disposition_code_not_unique,\r\n dq.discharge_disposition_code_missing\r\n as discharge_disposition_code_missing,\r\n dq.facility_npi_not_unique as facility_npi_not_unique,\r\n dq.facility_npi_missing as facility_npi_missing,\r\n dq.claim_type_not_unique as claim_type_not_unique,\r\n dq.claim_type_missing as claim_type_missing,\r\n dq.claim_type_not_institutional as claim_type_not_institutional,\r\n h.data_source,\r\n '{{ var('tuva_last_run')}}' as tuva_last_run\r\n\r\nfrom header_level_values h\r\nleft join data_quality_flags dq\r\n on h.claim_id = dq.claim_id", "language": "sql", "refs": [{"name": "emergency_department__stg_medical_claim", "package": null, "version": null}, {"name": "emergency_department__stg_service_category", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.emergency_department__stg_service_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_claims.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), __dbt__cte__emergency_department__stg_service_category as (\n\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n), emergency_department_claim_lines as (\nselect\n mc.patient_id,\n mc.claim_id,\n mc.claim_line_number,\n mc.claim_start_date,\n mc.claim_end_date,\n mc.admission_date,\n mc.discharge_date,\n mc.admit_source_code,\n mc.admit_type_code,\n mc.discharge_disposition_code,\n mc.facility_npi,\n mc.claim_type,\n mc.data_source\nfrom __dbt__cte__emergency_department__stg_medical_claim mc\ninner join __dbt__cte__emergency_department__stg_service_category sc\n on mc.claim_id = sc.claim_id\nwhere mc.claim_type = 'institutional'\n and sc.service_category_2 = 'Emergency Department'\n),\n\ndata_quality_flags as (\nselect\n claim_id,\n-- patient_id_not_unique:\n case\n when count(distinct patient_id) > 1 then 1\n else 0\n end as patient_id_not_unique,\n-- patient_id_missing: \n case\n when max(patient_id) is null then 1\n else 0\n end as patient_id_missing, \n-- claim_start_date_not_unique:\n case\n when count(distinct claim_start_date) > 1 then 1\n else 0\n end as claim_start_date_not_unique,\n-- claim_start_date_missing: \n case\n when max(claim_start_date) is null then 1\n else 0\n end as claim_start_date_missing,\n-- claim_end_date_not_unique:\n case\n when count(distinct claim_end_date) > 1 then 1\n else 0\n end as claim_end_date_not_unique,\n-- claim_end_date_missing: \n case\n when max(claim_end_date) is null then 1\n else 0\n end as claim_end_date_missing,\n-- claim_start_date_after_claim_end_date:\n case\n when min(claim_start_date) > max(claim_end_date) then 1\n else 0\n end as claim_start_date_after_claim_end_date,\n-- admission_date_not_unique:\n case\n when count(distinct admission_date) > 1 then 1\n else 0\n end as admission_date_not_unique,\n-- admission_date_missing: \n case\n when max(admission_date) is null then 1\n else 0\n end as admission_date_missing,\n-- discharge_date_not_unique:\n case\n when count(distinct discharge_date) > 1 then 1\n else 0\n end as discharge_date_not_unique,\n-- discharge_date_missing: \n case\n when max(discharge_date) is null then 1\n else 0\n end as discharge_date_missing,\n-- admission_date_after_discharge_date:\n case\n when min(admission_date) > max(discharge_date) then 1\n else 0\n end as admission_date_after_discharge_date,\n-- admit_type_code_not_unique:\n case\n when count(distinct admit_type_code) > 1 then 1\n else 0\n end as admit_type_code_not_unique,\n-- admit_type_code_missing: \n case\n when max(admit_type_code) is null then 1\n else 0\n end as admit_type_code_missing, \n-- admit_source_code_not_unique:\n case\n when count(distinct admit_source_code) > 1 then 1\n else 0\n end as admit_source_code_not_unique,\n-- admit_source_code_missing: \n case\n when max(admit_source_code) is null then 1\n else 0\n end as admit_source_code_missing, \n-- discharge_disposition_code_not_unique:\n case\n when count(distinct discharge_disposition_code) > 1 then 1\n else 0\n end as discharge_disposition_code_not_unique,\n-- discharge_disposition_code_missing: \n case\n when max(discharge_disposition_code) is null then 1\n else 0\n end as discharge_disposition_code_missing,\n-- facility_npi_not_unique:\n case\n when count(distinct facility_npi) > 1 then 1\n else 0\n end as facility_npi_not_unique,\n-- facility_npi_missing: \n case\n when max(facility_npi) is null then 1\n else 0\n end as facility_npi_missing,\n-- claim_type_not_unique:\n case\n when count(distinct claim_type) > 1 then 1\n else 0\n end as claim_type_not_unique,\n-- claim_type_missing: \n case\n when max(claim_type) is null then 1\n else 0\n end as claim_type_missing,\n-- claim_type_not_institutional:\n case\n when max(claim_type) <> 'institutional'\n and min(claim_type) <> 'institutional' then 1\n else 0\n end as claim_type_not_institutional\nfrom emergency_department_claim_lines\ngroup by claim_id\n),\n\n\nheader_level_values as (\nselect\n claim_id,\n max(patient_id) as patient_id,\n min(claim_start_date) as claim_start_date,\n max(claim_end_date) as claim_end_date,\n min(admission_date) as admission_date,\n max(discharge_date) as discharge_date,\n max(admit_source_code) as admit_source_code,\n max(admit_type_code) as admit_type_code,\n max(discharge_disposition_code) as discharge_disposition_code,\n max(facility_npi) as facility_npi,\n max(claim_type) as claim_type,\n coalesce(min(admission_date),\n min(claim_start_date)) as start_date,\n coalesce(max(discharge_date),\n max(claim_end_date)) as end_date,\n case\n when min(admission_date) is not null then 'admission_date'\n when min(claim_start_date) is not null then 'claim_start_date'\n else null\n end as date_used_as_start_date,\n case\n when max(discharge_date) is not null then 'discharge_date'\n when max(claim_end_date) is not null then 'claim_end_date'\n else null\n end as date_used_as_end_date,\n data_source\nfrom emergency_department_claim_lines\ngroup by claim_id, data_source\n)\n\nselect\n h.patient_id as patient_id,\n h.claim_id as claim_id, \n h.claim_start_date as claim_start_date,\n h.claim_end_date as claim_end_date,\n h.admission_date as admission_date,\n h.discharge_date as discharge_date,\n h.admit_source_code as admit_source_code,\n h.admit_type_code as admit_type_code,\n h.discharge_disposition_code as discharge_disposition_code,\n h.facility_npi as facility_npi,\n h.claim_type as claim_type,\n h.start_date as start_date,\n h.end_date as end_date,\n h.date_used_as_start_date,\n h.date_used_as_end_date, \n\n case\n when\n ( (dq.patient_id_not_unique = 1) or\n (dq.patient_id_missing = 1) or\n (dq.discharge_disposition_code_not_unique = 1) or\n (dq.discharge_disposition_code_missing = 1) or\n (dq.facility_npi_not_unique = 1) or\n (dq.facility_npi_missing = 1) or\n (h.date_used_as_start_date is null) or\n\t(h.date_used_as_end_date is null) or\n\t(h.start_date > h.end_date) ) then 1\n else 0\n end as dq_problem,\n\n case\n when\n ( (dq.claim_start_date_not_unique = 1) or\n\t(dq.claim_start_date_missing = 1) or\n (dq.claim_end_date_not_unique = 1) or\n (dq.claim_end_date_missing = 1) or\n (dq.claim_start_date_after_claim_end_date = 1) or\n (dq.admission_date_not_unique = 1) or\n (dq.admission_date_missing = 1) or\n (dq.discharge_date_not_unique = 1) or\n (dq.discharge_date_missing = 1) or\n (dq.admission_date_after_discharge_date = 1) or\n (dq.admit_type_code_not_unique = 1) or\n (dq.admit_type_code_missing = 1) or\n (dq.admit_source_code_not_unique = 1) or\n (dq.admit_source_code_missing = 1) or\t\n (dq.claim_type_not_unique = 1) or\n (dq.claim_type_missing = 1) or\n (dq.claim_type_not_institutional = 1) ) then 1\n else 0\n end as dq_insight,\n\n case\n when (h.date_used_as_start_date is null) then 1\n else 0\n end as start_date_not_determined,\n \n case\n when (h.date_used_as_end_date is null) then 1\n else 0\n end as end_date_not_determined,\n\n case\n when (h.start_date > h.end_date) then 1\n else 0\n end as start_date_after_end_date,\n \n dq.patient_id_not_unique as patient_id_not_unique,\n dq.patient_id_missing as patient_id_missing,\n dq.claim_start_date_not_unique as claim_start_date_not_unique,\n dq.claim_start_date_missing as claim_start_date_missing,\n dq.claim_end_date_not_unique as claim_end_date_not_unique,\n dq.claim_end_date_missing as claim_end_date_missing,\n dq.claim_start_date_after_claim_end_date\n as claim_start_date_after_claim_end_date,\n dq.admission_date_not_unique as admission_date_not_unique,\n dq.admission_date_missing as admission_date_missing,\n dq.discharge_date_not_unique as discharge_date_not_unique,\n dq.discharge_date_missing as discharge_date_missing,\n dq.admission_date_after_discharge_date\n as admission_date_after_discharge_date,\n dq.admit_type_code_not_unique\n as admit_type_code_not_unique,\n dq.admit_type_code_missing\n as admit_type_code_missing,\n dq.admit_source_code_not_unique\n as admit_source_code_not_unique,\n dq.admit_source_code_missing\n as admit_source_code_missing,\n dq.discharge_disposition_code_not_unique\n as discharge_disposition_code_not_unique,\n dq.discharge_disposition_code_missing\n as discharge_disposition_code_missing,\n dq.facility_npi_not_unique as facility_npi_not_unique,\n dq.facility_npi_missing as facility_npi_missing,\n dq.claim_type_not_unique as claim_type_not_unique,\n dq.claim_type_missing as claim_type_missing,\n dq.claim_type_not_institutional as claim_type_not_institutional,\n h.data_source,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n\nfrom header_level_values h\nleft join data_quality_flags dq\n on h.claim_id = dq.claim_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.emergency_department__stg_medical_claim", "sql": " __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n)"}, {"id": "model.the_tuva_project.emergency_department__stg_service_category", "sql": " __dbt__cte__emergency_department__stg_service_category as (\n\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n)"}], "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__int_encounter_start_and_end_dates": {"database": "raw", "schema": "claims_preprocessing", "name": "emergency_department__int_encounter_start_and_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_start_and_end_dates.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_start_and_end_dates.sql", "unique_id": "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_encounter_start_and_end_dates"], "alias": "_int_emergency_department_encounter_start_and_end_dates", "checksum": {"name": "sha256", "checksum": "c6198db2ad63e51b43014186d7ad479d96bafa44413d6dbd8f3f461a05bfca8a"}, "config": {"enabled": true, "alias": "_int_emergency_department_encounter_start_and_end_dates", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Defines encounter start and end dates for emergency_department encounters", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_encounter_start_and_end_dates", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.781842, "relation_name": "raw.claims_preprocessing._int_emergency_department_encounter_start_and_end_dates", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith add_encounter_id_to_emergency_department_encounters as (\r\nselect\r\n aip.claim_id as claim_id,\r\n aip.patient_id as patient_id,\r\n aip.start_date as start_date,\r\n aip.end_date as end_date,\r\n eid.encounter_id as encounter_id\r\nfrom {{ ref('emergency_department__int_institutional_claims') }} aip\r\nleft join {{ ref('emergency_department__int_institutional_encounter_id') }} eid\r\n on aip.patient_id = eid.patient_id\r\n and aip.claim_id = eid.claim_id\r\n),\r\n\r\nencounter_start_and_end_dates as (\r\nselect\r\n patient_id,\r\n encounter_id,\r\n min(start_date) as encounter_start_date,\r\n max(end_date) as encounter_end_date\r\nfrom add_encounter_id_to_emergency_department_encounters\r\ngroup by patient_id, encounter_id\r\n)\r\n\r\nselect \r\n patient_id\r\n , encounter_id\r\n , encounter_start_date\r\n , encounter_end_date\r\n , coalesce(encounter_start_date, encounter_end_date) as determined_encounter_start_date\r\n , coalesce(encounter_end_date, encounter_start_date) as determined_encounter_end_date\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom encounter_start_and_end_dates", "language": "sql", "refs": [{"name": "emergency_department__int_institutional_claims", "package": null, "version": null}, {"name": "emergency_department__int_institutional_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__int_institutional_claims", "model.the_tuva_project.emergency_department__int_institutional_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_start_and_end_dates.sql", "compiled": true, "compiled_code": "\n\n\nwith add_encounter_id_to_emergency_department_encounters as (\nselect\n aip.claim_id as claim_id,\n aip.patient_id as patient_id,\n aip.start_date as start_date,\n aip.end_date as end_date,\n eid.encounter_id as encounter_id\nfrom raw.claims_preprocessing._int_emergency_department_institutional_claims aip\nleft join raw.claims_preprocessing._int_emergency_department_institutional_encounter_id eid\n on aip.patient_id = eid.patient_id\n and aip.claim_id = eid.claim_id\n),\n\nencounter_start_and_end_dates as (\nselect\n patient_id,\n encounter_id,\n min(start_date) as encounter_start_date,\n max(end_date) as encounter_end_date\nfrom add_encounter_id_to_emergency_department_encounters\ngroup by patient_id, encounter_id\n)\n\nselect \n patient_id\n , encounter_id\n , encounter_start_date\n , encounter_end_date\n , coalesce(encounter_start_date, encounter_end_date) as determined_encounter_start_date\n , coalesce(encounter_end_date, encounter_start_date) as determined_encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom encounter_start_and_end_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.emergency_department__int_last_claim_values": {"database": "raw", "schema": "claims_preprocessing", "name": "emergency_department__int_last_claim_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_last_claim_values.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_last_claim_values.sql", "unique_id": "model.the_tuva_project.emergency_department__int_last_claim_values", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_last_claim_values"], "alias": "_int_emergency_department_last_claim_values", "checksum": {"name": "sha256", "checksum": "f215c9d66cca6d1dc1acc22c77c1f2b5e2c8fd8202f6c8b1a34c2d1a4c2f38af"}, "config": {"enabled": true, "alias": "_int_emergency_department_last_claim_values", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Orders claims to pull out encounter details (discharge disposition, etc)", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_last_claim_values", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.788518, "relation_name": "raw.claims_preprocessing._int_emergency_department_last_claim_values", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith first_claim_values as(\r\n select distinct\r\n e.encounter_id\r\n , coalesce(claim_start_date, admission_date) as claim_start\r\n , discharge_disposition_code\r\n from {{ ref('emergency_department__int_encounter_id')}} e\r\n inner join {{ ref('emergency_department__stg_medical_claim') }} m\r\n on e.claim_id = m.claim_id\r\n where claim_type = 'institutional'\r\n)\r\n\r\nselect\r\n encounter_id\r\n , claim_start\r\n , discharge_disposition_code\r\n , row_number() over (partition by encounter_id order by claim_start desc) as claim_row\r\nfrom first_claim_values", "language": "sql", "refs": [{"name": "emergency_department__int_encounter_id", "package": null, "version": null}, {"name": "emergency_department__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_last_claim_values.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , discharge_disposition_code\n from raw.claims_preprocessing._int_emergency_department_encounter_id e\n inner join __dbt__cte__emergency_department__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , discharge_disposition_code\n , row_number() over (partition by encounter_id order by claim_start desc) as claim_row\nfrom first_claim_values", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.emergency_department__stg_medical_claim", "sql": " __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.emergency_department__int_professional_encounter_id": {"database": "raw", "schema": "claims_preprocessing", "name": "emergency_department__int_professional_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_professional_encounter_id.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_professional_encounter_id.sql", "unique_id": "model.the_tuva_project.emergency_department__int_professional_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_professional_encounter_id"], "alias": "_int_emergency_department_professional_encounter_id", "checksum": {"name": "sha256", "checksum": "b4cc8feaebc9b41f4a6eae448b3a2fd8fc4f1d53fc94c01b269dc50ea64141ea"}, "config": {"enabled": true, "alias": "_int_emergency_department_professional_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Assigns encounter_id to every emergency_department professional claim", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_professional_encounter_id", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.7872581, "relation_name": "raw.claims_preprocessing._int_emergency_department_professional_encounter_id", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith emergency_department_professional_claim_ids as (\r\nselect \r\n claim_id\r\n , claim_line_number\r\nfrom {{ ref('emergency_department__stg_service_category') }} \r\nwhere claim_type = 'professional'\r\n and service_category_2 = 'Emergency Department'\r\n),\r\n\r\nemergency_department_professional_claim_lines as (\r\nselect\r\n mc.claim_id\r\n , mc.claim_line_number\r\n , mc.patient_id\r\n , mc.claim_start_date as start_date\r\n , mc.claim_end_date as end_date\t \r\nfrom {{ ref('emergency_department__stg_medical_claim') }} mc\r\ninner join emergency_department_professional_claim_ids prof\r\n on mc.claim_id = prof.claim_id\r\n and mc.claim_line_number = prof.claim_line_number\r\n),\r\n\r\n\r\nemergency_department_professional_claim_dates as (\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , patient_id\r\n , min(start_date) as start_date\r\n , max(end_date) as end_date\r\nfrom emergency_department_professional_claim_lines\r\ngroup by \r\n claim_id\r\n , claim_line_number\r\n , patient_id\r\n),\r\n\r\n\r\nroll_up_professional_claims_to_institutional_claims as (\r\n select\r\n aa.patient_id\r\n , aa.claim_id\r\n , aa.claim_line_number\r\n , aa.start_date\r\n , aa.end_date\r\n , bb.encounter_id\r\n , case\r\n when bb.encounter_id is null then 1\r\n else 0\r\n end as orphan_claim_flag\r\n from emergency_department_professional_claim_dates aa\r\n left join {{ ref('emergency_department__int_encounter_start_and_end_dates') }} bb\r\n on aa.patient_id = bb.patient_id\r\n and (coalesce(aa.start_date, aa.end_date) between coalesce(bb.encounter_start_date, bb.determined_encounter_start_date) and coalesce(bb.encounter_end_date, bb.determined_encounter_end_date))\r\n and (coalesce(aa.end_date, aa.start_date) between coalesce(bb.encounter_start_date, bb.determined_encounter_start_date) and coalesce(bb.encounter_end_date, bb.determined_encounter_end_date))\r\n),\r\n\r\nprofessional_claims_in_more_than_one_encounter as (\r\nselect\r\n patient_id\r\n , claim_id\r\n , claim_line_number\r\n , min(start_date) as start_date\r\n , max(end_date) as end_date\r\n , count(distinct encounter_id) as encounter_count\r\nfrom roll_up_professional_claims_to_institutional_claims\r\ngroup by patient_id, claim_id, claim_line_number\r\nhaving count(distinct encounter_id) > 1\r\n),\r\n\r\n\r\nprofessional_claims_not_in_more_than_one_encounter as (\r\nselect\r\n aa.patient_id,\r\n aa.claim_id,\r\n aa.claim_line_number,\r\n aa.start_date,\r\n aa.end_date,\r\n aa.encounter_id,\r\n aa.orphan_claim_flag,\r\n case\r\n when (aa.orphan_claim_flag = 1) then 0\r\n else 1\r\n end as encounter_count\r\nfrom roll_up_professional_claims_to_institutional_claims aa\r\nleft join professional_claims_in_more_than_one_encounter bb\r\non aa.claim_id = bb.claim_id\r\nand aa.claim_line_number = bb.claim_line_number\r\nand aa.patient_id = bb.patient_id\r\nwhere (bb.patient_id is null) and (bb.claim_id is null)\r\n),\r\n\r\n\r\nall_emergency_department_professional_claims as (\r\nselect\r\n patient_id,\r\n claim_id,\r\n claim_line_number,\r\n start_date,\r\n end_date,\r\n encounter_id,\r\n orphan_claim_flag,\r\n encounter_count\r\nfrom professional_claims_not_in_more_than_one_encounter\r\n\r\nunion all\r\n\r\nselect\r\n patient_id,\r\n claim_id,\r\n claim_line_number,\r\n start_date,\r\n end_date,\r\n null as encounter_id,\r\n 0 as orphan_claim_count,\r\n encounter_count\r\nfrom professional_claims_in_more_than_one_encounter\r\n)\r\n\r\n\r\n\r\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom all_emergency_department_professional_claims", "language": "sql", "refs": [{"name": "emergency_department__stg_service_category", "package": null, "version": null}, {"name": "emergency_department__stg_medical_claim", "package": null, "version": null}, {"name": "emergency_department__int_encounter_start_and_end_dates", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__stg_service_category", "model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_professional_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__emergency_department__stg_service_category as (\n\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n), __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), emergency_department_professional_claim_ids as (\nselect \n claim_id\n , claim_line_number\nfrom __dbt__cte__emergency_department__stg_service_category \nwhere claim_type = 'professional'\n and service_category_2 = 'Emergency Department'\n),\n\nemergency_department_professional_claim_lines as (\nselect\n mc.claim_id\n , mc.claim_line_number\n , mc.patient_id\n , mc.claim_start_date as start_date\n , mc.claim_end_date as end_date\t \nfrom __dbt__cte__emergency_department__stg_medical_claim mc\ninner join emergency_department_professional_claim_ids prof\n on mc.claim_id = prof.claim_id\n and mc.claim_line_number = prof.claim_line_number\n),\n\n\nemergency_department_professional_claim_dates as (\nselect\n claim_id\n , claim_line_number\n , patient_id\n , min(start_date) as start_date\n , max(end_date) as end_date\nfrom emergency_department_professional_claim_lines\ngroup by \n claim_id\n , claim_line_number\n , patient_id\n),\n\n\nroll_up_professional_claims_to_institutional_claims as (\n select\n aa.patient_id\n , aa.claim_id\n , aa.claim_line_number\n , aa.start_date\n , aa.end_date\n , bb.encounter_id\n , case\n when bb.encounter_id is null then 1\n else 0\n end as orphan_claim_flag\n from emergency_department_professional_claim_dates aa\n left join raw.claims_preprocessing._int_emergency_department_encounter_start_and_end_dates bb\n on aa.patient_id = bb.patient_id\n and (coalesce(aa.start_date, aa.end_date) between coalesce(bb.encounter_start_date, bb.determined_encounter_start_date) and coalesce(bb.encounter_end_date, bb.determined_encounter_end_date))\n and (coalesce(aa.end_date, aa.start_date) between coalesce(bb.encounter_start_date, bb.determined_encounter_start_date) and coalesce(bb.encounter_end_date, bb.determined_encounter_end_date))\n),\n\nprofessional_claims_in_more_than_one_encounter as (\nselect\n patient_id\n , claim_id\n , claim_line_number\n , min(start_date) as start_date\n , max(end_date) as end_date\n , count(distinct encounter_id) as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims\ngroup by patient_id, claim_id, claim_line_number\nhaving count(distinct encounter_id) > 1\n),\n\n\nprofessional_claims_not_in_more_than_one_encounter as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.orphan_claim_flag,\n case\n when (aa.orphan_claim_flag = 1) then 0\n else 1\n end as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims aa\nleft join professional_claims_in_more_than_one_encounter bb\non aa.claim_id = bb.claim_id\nand aa.claim_line_number = bb.claim_line_number\nand aa.patient_id = bb.patient_id\nwhere (bb.patient_id is null) and (bb.claim_id is null)\n),\n\n\nall_emergency_department_professional_claims as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n encounter_id,\n orphan_claim_flag,\n encounter_count\nfrom professional_claims_not_in_more_than_one_encounter\n\nunion all\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n null as encounter_id,\n 0 as orphan_claim_count,\n encounter_count\nfrom professional_claims_in_more_than_one_encounter\n)\n\n\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom all_emergency_department_professional_claims", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.emergency_department__stg_service_category", "sql": " __dbt__cte__emergency_department__stg_service_category as (\n\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n)"}, {"id": "model.the_tuva_project.emergency_department__stg_medical_claim", "sql": " __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.emergency_department__int_institutional_encounter_id": {"database": "raw", "schema": "claims_preprocessing", "name": "emergency_department__int_institutional_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_encounter_id.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_encounter_id.sql", "unique_id": "model.the_tuva_project.emergency_department__int_institutional_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_institutional_encounter_id"], "alias": "_int_emergency_department_institutional_encounter_id", "checksum": {"name": "sha256", "checksum": "f5e142e3003664c277529855522fac3f30f4dc727909af167874ba418bd69484"}, "config": {"enabled": true, "alias": "_int_emergency_department_institutional_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Assigns encounter_id to every emergency_department institutional claim", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_institutional_encounter_id", "tags": ["emergency_department", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.785761, "relation_name": "raw.claims_preprocessing._int_emergency_department_institutional_encounter_id", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith add_row_num as (\r\nselect\r\n patient_id,\r\n claim_id,\r\n start_date,\r\n end_date,\r\n discharge_disposition_code,\r\n facility_npi,\r\n row_number() over (partition by patient_id order by end_date, start_date, claim_id) as row_num\r\nfrom {{ ref('emergency_department__int_institutional_claims') }}\r\n),\r\n\r\ncheck_for_merges_with_larger_row_num as (\r\nselect\r\n aa.patient_id,\r\n aa.claim_id as claim_id_a,\r\n bb.claim_id as claim_id_b,\r\n aa.row_num as row_num_a,\r\n bb.row_num as row_num_b,\r\n case\r\n -- Claims with same end_date and same facility_npi should be merged:\r\n when (aa.end_date = bb.end_date\r\n and aa.facility_npi = bb.facility_npi) then 1\r\n -- Claims with different end_date \r\n -- should be merged if they overlap:\r\n when ( (aa.end_date <> bb.end_date) and \r\n (aa.end_date >= bb.start_date) and --overlap requirement\r\n (aa.facility_npi = bb.facility_npi)\r\n\t )then 1\r\n else 0\r\n end as merge_flag\r\nfrom add_row_num aa\r\n inner join add_row_num bb\r\n on aa.patient_id = bb.patient_id\r\n and aa.row_num < bb.row_num\r\n),\r\n\r\nmerges_with_larger_row_num as (\r\nselect\r\n patient_id,\r\n claim_id_a,\r\n claim_id_b,\r\n row_num_a,\r\n row_num_b,\r\n merge_flag\r\nfrom check_for_merges_with_larger_row_num\r\nwhere merge_flag = 1\r\n),\r\n\r\n\r\nclaim_ids_that_merge_with_larger_row_num as (\r\nselect distinct claim_id_a as claim_id\r\nfrom merges_with_larger_row_num\r\n),\r\n\r\n\r\nclaim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\r\nselect distinct aa.claim_id as claim_id\r\nfrom add_row_num aa\r\n inner join\r\n merges_with_larger_row_num bb\r\n on aa.patient_id = bb.patient_id\r\n and bb.row_num_a < aa.row_num\r\n and bb.row_num_b > aa.row_num\r\n),\r\n\r\n\r\nclose_flags as (\r\nselect\r\n aa.patient_id,\r\n aa.claim_id,\r\n aa.start_date,\r\n aa.end_date,\r\n aa.discharge_disposition_code,\r\n aa.facility_npi,\r\n aa.row_num,\r\n case when (bb.claim_id is null and cc.claim_id is null) then 1\r\n else 0\r\n end as close_flag\r\n\r\nfrom add_row_num aa\r\n\r\nleft join claim_ids_that_merge_with_larger_row_num bb\r\non aa.claim_id = bb.claim_id\r\n\r\nleft join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num cc\r\non aa.claim_id = cc.claim_id\r\n),\r\n\r\n\r\njoin_every_row_to_later_closes as (\r\nselect\r\n aa.patient_id as patient_id,\r\n aa.claim_id as claim_id,\r\n aa.row_num as row_num,\r\n bb.row_num as row_num_b\r\nfrom close_flags aa inner join close_flags bb\r\n on aa.patient_id = bb.patient_id\r\n and aa.row_num <= bb.row_num\r\nwhere bb.close_flag = 1\r\n),\r\n\r\n\r\nfind_min_closing_row_num_for_every_claim as (\r\nselect\r\n patient_id,\r\n claim_id,\r\n min(row_num_b) as min_closing_row\r\nfrom join_every_row_to_later_closes\r\ngroup by patient_id, claim_id\r\n),\r\n\r\n\r\nadd_min_closing_row_to_every_claim as (\r\nselect\r\n aa.patient_id as patient_id,\r\n aa.claim_id as claim_id,\r\n aa.start_date as start_date,\r\n aa.end_date as end_date,\r\n aa.discharge_disposition_code as discharge_disposition_code,\r\n aa.facility_npi as facility_npi,\r\n aa.row_num as row_num,\r\n aa.close_flag as close_flag,\r\n bb.min_closing_row as min_closing_row\r\nfrom close_flags aa\r\n left join find_min_closing_row_num_for_every_claim bb\r\n on aa.patient_id = bb.patient_id\r\n and aa.claim_id = bb.claim_id\r\n),\r\n\r\n\r\nadd_encounter_id as (\r\nselect\r\n aa.patient_id as patient_id,\r\n aa.claim_id as claim_id,\r\n aa.start_date as start_date,\r\n aa.end_date as end_date,\r\n aa.discharge_disposition_code as discharge_disposition_code,\r\n aa.facility_npi as facility_npi,\r\n aa.row_num as row_num,\r\n aa.close_flag as close_flag,\r\n aa.min_closing_row as min_closing_row,\r\n bb.claim_id as encounter_id\r\nfrom add_min_closing_row_to_every_claim aa\r\n left join add_min_closing_row_to_every_claim bb\r\n on aa.patient_id = bb.patient_id\r\n and aa.min_closing_row = bb.row_num\r\n)\r\n\r\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "emergency_department__int_institutional_claims", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__int_institutional_claims"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nwith add_row_num as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_npi,\n row_number() over (partition by patient_id order by end_date, start_date, claim_id) as row_num\nfrom raw.claims_preprocessing._int_emergency_department_institutional_claims\n),\n\ncheck_for_merges_with_larger_row_num as (\nselect\n aa.patient_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_npi should be merged:\n when (aa.end_date = bb.end_date\n and aa.facility_npi = bb.facility_npi) then 1\n -- Claims with different end_date \n -- should be merged if they overlap:\n when ( (aa.end_date <> bb.end_date) and \n (aa.end_date >= bb.start_date) and --overlap requirement\n (aa.facility_npi = bb.facility_npi)\n\t )then 1\n else 0\n end as merge_flag\nfrom add_row_num aa\n inner join add_row_num bb\n on aa.patient_id = bb.patient_id\n and aa.row_num < bb.row_num\n),\n\nmerges_with_larger_row_num as (\nselect\n patient_id,\n claim_id_a,\n claim_id_b,\n row_num_a,\n row_num_b,\n merge_flag\nfrom check_for_merges_with_larger_row_num\nwhere merge_flag = 1\n),\n\n\nclaim_ids_that_merge_with_larger_row_num as (\nselect distinct claim_id_a as claim_id\nfrom merges_with_larger_row_num\n),\n\n\nclaim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\nselect distinct aa.claim_id as claim_id\nfrom add_row_num aa\n inner join\n merges_with_larger_row_num bb\n on aa.patient_id = bb.patient_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n),\n\n\nclose_flags as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.discharge_disposition_code,\n aa.facility_npi,\n aa.row_num,\n case when (bb.claim_id is null and cc.claim_id is null) then 1\n else 0\n end as close_flag\n\nfrom add_row_num aa\n\nleft join claim_ids_that_merge_with_larger_row_num bb\non aa.claim_id = bb.claim_id\n\nleft join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num cc\non aa.claim_id = cc.claim_id\n),\n\n\njoin_every_row_to_later_closes as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.row_num as row_num,\n bb.row_num as row_num_b\nfrom close_flags aa inner join close_flags bb\n on aa.patient_id = bb.patient_id\n and aa.row_num <= bb.row_num\nwhere bb.close_flag = 1\n),\n\n\nfind_min_closing_row_num_for_every_claim as (\nselect\n patient_id,\n claim_id,\n min(row_num_b) as min_closing_row\nfrom join_every_row_to_later_closes\ngroup by patient_id, claim_id\n),\n\n\nadd_min_closing_row_to_every_claim as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n bb.min_closing_row as min_closing_row\nfrom close_flags aa\n left join find_min_closing_row_num_for_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.claim_id = bb.claim_id\n),\n\n\nadd_encounter_id as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n aa.min_closing_row as min_closing_row,\n bb.claim_id as encounter_id\nfrom add_min_closing_row_to_every_claim aa\n left join add_min_closing_row_to_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\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.normalized_input__stg_medical_claim": {"database": "raw", "schema": "jaffle_shop", "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": "eaf70f97b4939050012ee673ec5483aa0bd65bbec55daedd76e52722d1c10f79"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.881449, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , claim_type\r\n , patient_id\r\n , member_id\r\n , payer\r\n , plan\r\n , claim_start_date\r\n , claim_end_date\r\n , claim_line_start_date\r\n , claim_line_end_date\r\n , admission_date\r\n , discharge_date\r\n , admit_source_code\r\n , admit_type_code\r\n , discharge_disposition_code\r\n , place_of_service_code\r\n , bill_type_code\r\n , ms_drg_code\r\n , apr_drg_code\r\n , revenue_center_code\r\n , service_unit_quantity\r\n , hcpcs_code\r\n , hcpcs_modifier_1\r\n , hcpcs_modifier_2\r\n , hcpcs_modifier_3\r\n , hcpcs_modifier_4\r\n , hcpcs_modifier_5\r\n , rendering_npi\r\n , billing_npi\r\n , facility_npi\r\n , paid_date\r\n , paid_amount\r\n , allowed_amount\r\n , charge_amount\r\n , coinsurance_amount\r\n , copayment_amount\r\n , deductible_amount\r\n , total_cost_amount\r\n , diagnosis_code_type\r\n , diagnosis_code_1\r\n , diagnosis_code_2\r\n , diagnosis_code_3\r\n , diagnosis_code_4\r\n , diagnosis_code_5\r\n , diagnosis_code_6\r\n , diagnosis_code_7\r\n , diagnosis_code_8\r\n , diagnosis_code_9\r\n , diagnosis_code_10\r\n , diagnosis_code_11\r\n , diagnosis_code_12\r\n , diagnosis_code_13\r\n , diagnosis_code_14\r\n , diagnosis_code_15\r\n , diagnosis_code_16\r\n , diagnosis_code_17\r\n , diagnosis_code_18\r\n , diagnosis_code_19\r\n , diagnosis_code_20\r\n , diagnosis_code_21\r\n , diagnosis_code_22\r\n , diagnosis_code_23\r\n , diagnosis_code_24\r\n , diagnosis_code_25\r\n , diagnosis_poa_1\r\n , diagnosis_poa_2\r\n , diagnosis_poa_3\r\n , diagnosis_poa_4\r\n , diagnosis_poa_5\r\n , diagnosis_poa_6\r\n , diagnosis_poa_7\r\n , diagnosis_poa_8\r\n , diagnosis_poa_9\r\n , diagnosis_poa_10\r\n , diagnosis_poa_11\r\n , diagnosis_poa_12\r\n , diagnosis_poa_13\r\n , diagnosis_poa_14\r\n , diagnosis_poa_15\r\n , diagnosis_poa_16\r\n , diagnosis_poa_17\r\n , diagnosis_poa_18\r\n , diagnosis_poa_19\r\n , diagnosis_poa_20\r\n , diagnosis_poa_21\r\n , diagnosis_poa_22\r\n , diagnosis_poa_23\r\n , diagnosis_poa_24\r\n , diagnosis_poa_25\r\n , procedure_code_type\r\n , procedure_code_1\r\n , procedure_code_2\r\n , procedure_code_3\r\n , procedure_code_4\r\n , procedure_code_5\r\n , procedure_code_6\r\n , procedure_code_7\r\n , procedure_code_8\r\n , procedure_code_9\r\n , procedure_code_10\r\n , procedure_code_11\r\n , procedure_code_12\r\n , procedure_code_13\r\n , procedure_code_14\r\n , procedure_code_15\r\n , procedure_code_16\r\n , procedure_code_17\r\n , procedure_code_18\r\n , procedure_code_19\r\n , procedure_code_20\r\n , procedure_code_21\r\n , procedure_code_22\r\n , procedure_code_23\r\n , procedure_code_24\r\n , procedure_code_25\r\n , procedure_date_1\r\n , procedure_date_2\r\n , procedure_date_3\r\n , procedure_date_4\r\n , procedure_date_5\r\n , procedure_date_6\r\n , procedure_date_7\r\n , procedure_date_8\r\n , procedure_date_9\r\n , procedure_date_10\r\n , procedure_date_11\r\n , procedure_date_12\r\n , procedure_date_13\r\n , procedure_date_14\r\n , procedure_date_15\r\n , procedure_date_16\r\n , procedure_date_17\r\n , procedure_date_18\r\n , procedure_date_19\r\n , procedure_date_20\r\n , procedure_date_21\r\n , procedure_date_22\r\n , procedure_date_23\r\n , procedure_date_24\r\n , procedure_date_25\r\n , data_source\r\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_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 , billing_npi\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 , 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": "raw", "schema": "jaffle_shop", "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": "1ee6891e10952c2c81f3f999533b13b161c75aad32abd5040dbb32668298f510"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.882137, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , patient_id\r\n , member_id\r\n , payer\r\n , plan\r\n , prescribing_provider_npi\r\n , dispensing_provider_npi\r\n , dispensing_date\r\n , ndc_code\r\n , quantity\r\n , days_supply\r\n , refills\r\n , paid_date\r\n , paid_amount\r\n , allowed_amount\r\n , coinsurance_amount\r\n , copayment_amount\r\n , deductible_amount\r\n , data_source\r\nfrom {{ 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/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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\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": "raw", "schema": "jaffle_shop", "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": "5eafa446e34549f9a1f2152ff1a82cb433d39fe6697ca4b8e91f867f05ca982d"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.880765, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n patient_id\r\n , patient_id||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\r\n , member_id\r\n , gender\r\n , race\r\n , birth_date\r\n , death_date\r\n , death_flag\r\n , enrollment_start_date\r\n , enrollment_end_date\r\n , payer\r\n , payer_type\r\n , plan\r\n , original_reason_entitlement_code\r\n , dual_status_code\r\n , medicare_status_code\r\n , first_name\r\n , last_name\r\n , address\r\n , city\r\n , state\r\n , zip_code\r\n , phone\r\n , data_source\r\nfrom {{ 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/claims_preprocessing/normalized_input/staging/normalized_input__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\n\nselect\n patient_id\n , patient_id||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\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": "raw", "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": "4ab0ce1fb9d88b24759c4366b3923b56849e6d64fe70a35e2950f3e9e835fb2c"}, "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": null}, "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": []}, "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": []}, "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": []}, "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": null}, "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}, "created_at": 1708461580.838125, "relation_name": "raw.claims_preprocessing.normalized_input_eligibility", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n cast(elig.patient_id as {{ dbt.type_string() }} ) as patient_id\r\n , cast(elig.member_id as {{ dbt.type_string() }} ) as member_id\r\n , cast(elig.gender as {{ dbt.type_string() }} ) as gender\r\n , cast(elig.race as {{ dbt.type_string() }} ) as race\r\n , cast(date_norm.normalized_birth_date as date ) as birth_date\r\n , cast(date_norm.normalized_death_date as date ) as death_date\r\n , cast(elig.death_flag as int ) as death_flag\r\n , cast(date_norm.normalized_enrollment_start_date as date ) as enrollment_start_date\r\n , cast(date_norm.normalized_enrollment_end_date as date ) as enrollment_end_date\r\n , cast(elig.payer as {{ dbt.type_string() }} ) as payer\r\n , cast(elig.payer_type as {{ dbt.type_string() }} ) as payer_type\r\n , cast(elig.plan as {{ dbt.type_string() }} ) as plan\r\n , cast(elig.original_reason_entitlement_code as {{ dbt.type_string() }} ) as original_reason_entitlement_code\r\n , cast(elig.dual_status_code as {{ dbt.type_string() }} ) as dual_status_code\r\n , cast(elig.medicare_status_code as {{ dbt.type_string() }} ) as medicare_status_code\r\n , cast(elig.first_name as {{ dbt.type_string() }} ) as first_name\r\n , cast(elig.last_name as {{ dbt.type_string() }} ) as last_name\r\n , cast(elig.address as {{ dbt.type_string() }} ) as address\r\n , cast(elig.city as {{ dbt.type_string() }} ) as city\r\n , cast(elig.state as {{ dbt.type_string() }} ) as state\r\n , cast(elig.zip_code as {{ dbt.type_string() }} ) as zip_code\r\n , cast(elig.phone as {{ dbt.type_string() }} ) as phone\r\n , cast(elig.data_source as {{ dbt.type_string() }} ) as data_source\r\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_eligibility') }} elig\r\nleft join {{ ref('normalized_input__int_eligibility_dates_normalize') }} date_norm\r\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"], "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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\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.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.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-02-20 20:47:44.615990+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join raw.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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\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": "raw", "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": "5af915af398c991d649a9b70bd7c951c8db80c16d046e144037e2b9faf12aad0"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8419242, "relation_name": "raw.claims_preprocessing.normalized_input_pharmacy_claim", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n cast(claim_id as {{ dbt.type_string() }} ) as claim_id\r\n , cast(claim_line_number as int ) as claim_line_number\r\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\r\n , cast(member_id as {{ dbt.type_string() }} ) as member_id\r\n , cast(payer as {{ dbt.type_string() }} ) as payer\r\n , cast(plan as {{ dbt.type_string() }} ) as plan\r\n , cast(prescribing_provider_npi as {{ dbt.type_string() }} ) as prescribing_provider_npi\r\n , cast(dispensing_provider_npi as {{ dbt.type_string() }} ) as dispensing_provider_npi\r\n , cast(dispensing_date as date ) as dispensing_date\r\n , cast(ndc_code as {{ dbt.type_string() }} ) as ndc_code\r\n , cast(quantity as int ) as quantity\r\n , cast(days_supply as int ) as days_supply\r\n , cast(refills as int ) as refills\r\n , cast(paid_date as date ) as paid_date\r\n , cast(paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\r\n , cast(allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\r\n , cast(coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\r\n , cast(copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\r\n , cast(deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\r\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\r\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_pharmacy_claim') }}", "language": "sql", "refs": [{"name": "normalized_input__stg_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.normalized_input__stg_pharmacy_claim"]}, "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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\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_npi\n , cast(dispensing_provider_npi as TEXT ) as dispensing_provider_npi\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\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(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(data_source as TEXT ) as data_source\n , cast('2024-02-20 20:47:44.615990+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_pharmacy_claim", "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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\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": "raw", "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": "bd927c8e5ef3c254f37581eafeb94d6e6615ffc20eedd940e0e4cd48256a2019"}, "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": null}, "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": "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": []}, "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": []}, "encounter_type": {"name": "encounter_type", "description": "The type of encounter this claim belongs to.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "The encounter_id for the encounter that this claims belongs to.\n", "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": []}, "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": null}, "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}, "created_at": 1708461580.840331, "relation_name": "raw.claims_preprocessing.normalized_input_medical_claim", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n\tcast(med.claim_id as {{ dbt.type_string() }} ) as claim_id\r\n\t, cast(med.claim_line_number as int ) as claim_line_number\r\n\t, cast(med.claim_type as {{ dbt.type_string() }} ) as claim_type\r\n\t, cast(med.patient_id as {{ dbt.type_string() }} ) as patient_id\r\n\t, cast(med.member_id as {{ dbt.type_string() }} ) as member_id\r\n\t, cast(med.payer as {{ dbt.type_string() }} ) as payer\r\n\t, cast(med.plan as {{ dbt.type_string() }} ) as plan\r\n\t, cast(coalesce(dates.minimum_claim_start_date, undetermined.claim_start_date) as date ) as claim_start_date\r\n\t, cast(coalesce(dates.maximum_claim_end_date, undetermined.claim_start_date) as date ) as claim_end_date\r\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_start_date, undetermined.claim_line_start_date) as date ) as claim_line_start_date\r\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_end_date, undetermined.claim_line_end_date) as date ) as claim_line_end_date\r\n\t, cast(coalesce(dates.minimum_admission_date, undetermined.admission_date) as date ) as admission_date\r\n\t, cast(coalesce(dates.maximum_discharge_date, undetermined.discharge_date) as date ) as discharge_date\r\n\t, cast(coalesce(ad_source.normalized_code, undetermined.admit_source_code) as {{ dbt.type_string() }} ) as admit_source_code\r\n\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as {{ dbt.type_string() }} ) as admit_type_code\r\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as {{ dbt.type_string() }} ) as discharge_disposition_code\r\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as {{ dbt.type_string() }} ) as place_of_service_code\r\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as {{ dbt.type_string() }} ) as bill_type_code\r\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as {{ dbt.type_string() }} ) as ms_drg_code\r\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as {{ dbt.type_string() }} ) as apr_drg_code\r\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as {{ dbt.type_string() }} ) as revenue_center_code\r\n\t, cast(med.service_unit_quantity as {{ dbt.type_string() }} ) as service_unit_quantity\r\n\t, cast(med.hcpcs_code as {{ dbt.type_string() }} ) as hcpcs_code\r\n\t, cast(med.hcpcs_modifier_1 as {{ dbt.type_string() }} ) as hcpcs_modifier_1\r\n\t, cast(med.hcpcs_modifier_2 as {{ dbt.type_string() }} ) as hcpcs_modifier_2\r\n\t, cast(med.hcpcs_modifier_3 as {{ dbt.type_string() }} ) as hcpcs_modifier_3\r\n\t, cast(med.hcpcs_modifier_4 as {{ dbt.type_string() }} ) as hcpcs_modifier_4\r\n\t, cast(med.hcpcs_modifier_5 as {{ dbt.type_string() }} ) as hcpcs_modifier_5\r\n\t, cast(coalesce(med_npi.normalized_rendering_npi, undetermined.rendering_npi) as {{ dbt.type_string() }} ) as rendering_npi\r\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as {{ dbt.type_string() }} ) as billing_npi\r\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as {{ dbt.type_string() }} ) as facility_npi\r\n\t, cast(med.paid_date as date ) as paid_date\r\n\t, cast(med.paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\r\n\t, cast(med.allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\r\n\t, cast(med.charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\r\n\t, cast(med.coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\r\n\t, cast(med.copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\r\n\t, cast(med.deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\r\n\t, cast(med.total_cost_amount as {{ dbt.type_numeric() }} ) as total_cost_amount\r\n\t, cast(med.diagnosis_code_type as {{ dbt.type_string() }} ) as diagnosis_code_type\r\n\t, cast(coalesce(dx_code.diagnosis_code_1, undetermined.diagnosis_code_1) as {{ dbt.type_string() }} ) as diagnosis_code_1\r\n\t, cast(coalesce(dx_code.diagnosis_code_2, undetermined.diagnosis_code_2) as {{ dbt.type_string() }} ) as diagnosis_code_2\r\n\t, cast(coalesce(dx_code.diagnosis_code_3, undetermined.diagnosis_code_3) as {{ dbt.type_string() }} ) as diagnosis_code_3\r\n\t, cast(coalesce(dx_code.diagnosis_code_4, undetermined.diagnosis_code_4) as {{ dbt.type_string() }} ) as diagnosis_code_4\r\n\t, cast(coalesce(dx_code.diagnosis_code_5, undetermined.diagnosis_code_5) as {{ dbt.type_string() }} ) as diagnosis_code_5\r\n\t, cast(coalesce(dx_code.diagnosis_code_6, undetermined.diagnosis_code_6) as {{ dbt.type_string() }} ) as diagnosis_code_6\r\n\t, cast(coalesce(dx_code.diagnosis_code_7, undetermined.diagnosis_code_7) as {{ dbt.type_string() }} ) as diagnosis_code_7\r\n\t, cast(coalesce(dx_code.diagnosis_code_8, undetermined.diagnosis_code_8) as {{ dbt.type_string() }} ) as diagnosis_code_8\r\n\t, cast(coalesce(dx_code.diagnosis_code_9, undetermined.diagnosis_code_9) as {{ dbt.type_string() }} ) as diagnosis_code_9\r\n\t, cast(coalesce(dx_code.diagnosis_code_10, undetermined.diagnosis_code_10) as {{ dbt.type_string() }} ) as diagnosis_code_10\r\n\t, cast(coalesce(dx_code.diagnosis_code_11, undetermined.diagnosis_code_11) as {{ dbt.type_string() }} ) as diagnosis_code_11\r\n\t, cast(coalesce(dx_code.diagnosis_code_12, undetermined.diagnosis_code_12) as {{ dbt.type_string() }} ) as diagnosis_code_12\r\n\t, cast(coalesce(dx_code.diagnosis_code_13, undetermined.diagnosis_code_13) as {{ dbt.type_string() }} ) as diagnosis_code_13\r\n\t, cast(coalesce(dx_code.diagnosis_code_14, undetermined.diagnosis_code_14) as {{ dbt.type_string() }} ) as diagnosis_code_14\r\n\t, cast(coalesce(dx_code.diagnosis_code_15, undetermined.diagnosis_code_15) as {{ dbt.type_string() }} ) as diagnosis_code_15\r\n\t, cast(coalesce(dx_code.diagnosis_code_16, undetermined.diagnosis_code_16) as {{ dbt.type_string() }} ) as diagnosis_code_16\r\n\t, cast(coalesce(dx_code.diagnosis_code_17, undetermined.diagnosis_code_17) as {{ dbt.type_string() }} ) as diagnosis_code_17\r\n\t, cast(coalesce(dx_code.diagnosis_code_18, undetermined.diagnosis_code_18) as {{ dbt.type_string() }} ) as diagnosis_code_18\r\n\t, cast(coalesce(dx_code.diagnosis_code_19, undetermined.diagnosis_code_19) as {{ dbt.type_string() }} ) as diagnosis_code_19\r\n\t, cast(coalesce(dx_code.diagnosis_code_20, undetermined.diagnosis_code_20) as {{ dbt.type_string() }} ) as diagnosis_code_20\r\n\t, cast(coalesce(dx_code.diagnosis_code_21, undetermined.diagnosis_code_21) as {{ dbt.type_string() }} ) as diagnosis_code_21\r\n\t, cast(coalesce(dx_code.diagnosis_code_22, undetermined.diagnosis_code_22) as {{ dbt.type_string() }} ) as diagnosis_code_22\r\n\t, cast(coalesce(dx_code.diagnosis_code_23, undetermined.diagnosis_code_23) as {{ dbt.type_string() }} ) as diagnosis_code_23\r\n\t, cast(coalesce(dx_code.diagnosis_code_24, undetermined.diagnosis_code_24) as {{ dbt.type_string() }} ) as diagnosis_code_24\r\n\t, cast(coalesce(dx_code.diagnosis_code_25, undetermined.diagnosis_code_25) as {{ dbt.type_string() }} ) as diagnosis_code_25\r\n\t, cast(coalesce(poa.diagnosis_poa_1, undetermined.diagnosis_poa_1) as {{ dbt.type_string() }} ) as diagnosis_poa_1\r\n\t, cast(coalesce(poa.diagnosis_poa_2, undetermined.diagnosis_poa_2) as {{ dbt.type_string() }} ) as diagnosis_poa_2\r\n\t, cast(coalesce(poa.diagnosis_poa_3, undetermined.diagnosis_poa_3) as {{ dbt.type_string() }} ) as diagnosis_poa_3\r\n\t, cast(coalesce(poa.diagnosis_poa_4, undetermined.diagnosis_poa_4) as {{ dbt.type_string() }} ) as diagnosis_poa_4\r\n\t, cast(coalesce(poa.diagnosis_poa_5, undetermined.diagnosis_poa_5) as {{ dbt.type_string() }} ) as diagnosis_poa_5\r\n\t, cast(coalesce(poa.diagnosis_poa_6, undetermined.diagnosis_poa_6) as {{ dbt.type_string() }} ) as diagnosis_poa_6\r\n\t, cast(coalesce(poa.diagnosis_poa_7, undetermined.diagnosis_poa_7) as {{ dbt.type_string() }} ) as diagnosis_poa_7\r\n\t, cast(coalesce(poa.diagnosis_poa_8, undetermined.diagnosis_poa_8) as {{ dbt.type_string() }} ) as diagnosis_poa_8\r\n\t, cast(coalesce(poa.diagnosis_poa_9, undetermined.diagnosis_poa_9) as {{ dbt.type_string() }} ) as diagnosis_poa_9\r\n\t, cast(coalesce(poa.diagnosis_poa_10, undetermined.diagnosis_poa_10) as {{ dbt.type_string() }} ) as diagnosis_poa_10\r\n\t, cast(coalesce(poa.diagnosis_poa_11, undetermined.diagnosis_poa_11) as {{ dbt.type_string() }} ) as diagnosis_poa_11\r\n\t, cast(coalesce(poa.diagnosis_poa_12, undetermined.diagnosis_poa_12) as {{ dbt.type_string() }} ) as diagnosis_poa_12\r\n\t, cast(coalesce(poa.diagnosis_poa_13, undetermined.diagnosis_poa_13) as {{ dbt.type_string() }} ) as diagnosis_poa_13\r\n\t, cast(coalesce(poa.diagnosis_poa_14, undetermined.diagnosis_poa_14) as {{ dbt.type_string() }} ) as diagnosis_poa_14\r\n\t, cast(coalesce(poa.diagnosis_poa_15, undetermined.diagnosis_poa_15) as {{ dbt.type_string() }} ) as diagnosis_poa_15\r\n\t, cast(coalesce(poa.diagnosis_poa_16, undetermined.diagnosis_poa_16) as {{ dbt.type_string() }} ) as diagnosis_poa_16\r\n\t, cast(coalesce(poa.diagnosis_poa_17, undetermined.diagnosis_poa_17) as {{ dbt.type_string() }} ) as diagnosis_poa_17\r\n\t, cast(coalesce(poa.diagnosis_poa_18, undetermined.diagnosis_poa_18) as {{ dbt.type_string() }} ) as diagnosis_poa_18\r\n\t, cast(coalesce(poa.diagnosis_poa_19, undetermined.diagnosis_poa_19) as {{ dbt.type_string() }} ) as diagnosis_poa_19\r\n\t, cast(coalesce(poa.diagnosis_poa_20, undetermined.diagnosis_poa_20) as {{ dbt.type_string() }} ) as diagnosis_poa_20\r\n\t, cast(coalesce(poa.diagnosis_poa_21, undetermined.diagnosis_poa_21) as {{ dbt.type_string() }} ) as diagnosis_poa_21\r\n\t, cast(coalesce(poa.diagnosis_poa_22, undetermined.diagnosis_poa_22) as {{ dbt.type_string() }} ) as diagnosis_poa_22\r\n\t, cast(coalesce(poa.diagnosis_poa_23, undetermined.diagnosis_poa_23) as {{ dbt.type_string() }} ) as diagnosis_poa_23\r\n\t, cast(coalesce(poa.diagnosis_poa_24, undetermined.diagnosis_poa_24) as {{ dbt.type_string() }} ) as diagnosis_poa_24\r\n\t, cast(coalesce(poa.diagnosis_poa_25, undetermined.diagnosis_poa_25) as {{ dbt.type_string() }} ) as diagnosis_poa_25\r\n\t, cast(med.procedure_code_type as {{ dbt.type_string() }} ) as procedure_code_type\r\n\t, cast(coalesce(px_code.procedure_code_1, undetermined.procedure_code_1) as {{ dbt.type_string() }} ) as procedure_code_1\r\n\t, cast(coalesce(px_code.procedure_code_2, undetermined.procedure_code_2) as {{ dbt.type_string() }} ) as procedure_code_2\r\n\t, cast(coalesce(px_code.procedure_code_3, undetermined.procedure_code_3) as {{ dbt.type_string() }} ) as procedure_code_3\r\n\t, cast(coalesce(px_code.procedure_code_4, undetermined.procedure_code_4) as {{ dbt.type_string() }} ) as procedure_code_4\r\n\t, cast(coalesce(px_code.procedure_code_5, undetermined.procedure_code_5) as {{ dbt.type_string() }} ) as procedure_code_5\r\n\t, cast(coalesce(px_code.procedure_code_6, undetermined.procedure_code_6) as {{ dbt.type_string() }} ) as procedure_code_6\r\n\t, cast(coalesce(px_code.procedure_code_7, undetermined.procedure_code_7) as {{ dbt.type_string() }} ) as procedure_code_7\r\n\t, cast(coalesce(px_code.procedure_code_8, undetermined.procedure_code_8) as {{ dbt.type_string() }} ) as procedure_code_8\r\n\t, cast(coalesce(px_code.procedure_code_9, undetermined.procedure_code_9) as {{ dbt.type_string() }} ) as procedure_code_9\r\n\t, cast(coalesce(px_code.procedure_code_10, undetermined.procedure_code_10) as {{ dbt.type_string() }} ) as procedure_code_10\r\n\t, cast(coalesce(px_code.procedure_code_11, undetermined.procedure_code_11) as {{ dbt.type_string() }} ) as procedure_code_11\r\n\t, cast(coalesce(px_code.procedure_code_12, undetermined.procedure_code_12) as {{ dbt.type_string() }} ) as procedure_code_12\r\n\t, cast(coalesce(px_code.procedure_code_13, undetermined.procedure_code_13) as {{ dbt.type_string() }} ) as procedure_code_13\r\n\t, cast(coalesce(px_code.procedure_code_14, undetermined.procedure_code_14) as {{ dbt.type_string() }} ) as procedure_code_14\r\n\t, cast(coalesce(px_code.procedure_code_15, undetermined.procedure_code_15) as {{ dbt.type_string() }} ) as procedure_code_15\r\n\t, cast(coalesce(px_code.procedure_code_16, undetermined.procedure_code_16) as {{ dbt.type_string() }} ) as procedure_code_16\r\n\t, cast(coalesce(px_code.procedure_code_17, undetermined.procedure_code_17) as {{ dbt.type_string() }} ) as procedure_code_17\r\n\t, cast(coalesce(px_code.procedure_code_18, undetermined.procedure_code_18) as {{ dbt.type_string() }} ) as procedure_code_18\r\n\t, cast(coalesce(px_code.procedure_code_19, undetermined.procedure_code_19) as {{ dbt.type_string() }} ) as procedure_code_19\r\n\t, cast(coalesce(px_code.procedure_code_20, undetermined.procedure_code_20) as {{ dbt.type_string() }} ) as procedure_code_20\r\n\t, cast(coalesce(px_code.procedure_code_21, undetermined.procedure_code_21) as {{ dbt.type_string() }} ) as procedure_code_21\r\n\t, cast(coalesce(px_code.procedure_code_22, undetermined.procedure_code_22) as {{ dbt.type_string() }} ) as procedure_code_22\r\n\t, cast(coalesce(px_code.procedure_code_23, undetermined.procedure_code_23) as {{ dbt.type_string() }} ) as procedure_code_23\r\n\t, cast(coalesce(px_code.procedure_code_24, undetermined.procedure_code_24) as {{ dbt.type_string() }} ) as procedure_code_24\r\n\t, cast(coalesce(px_code.procedure_code_25, undetermined.procedure_code_25) as {{ dbt.type_string() }} ) as procedure_code_25\r\n\t, cast(coalesce(px_date.procedure_date_1, undetermined.procedure_date_1) as date ) as procedure_date_1\r\n\t, cast(coalesce(px_date.procedure_date_2, undetermined.procedure_date_2) as date ) as procedure_date_2\r\n\t, cast(coalesce(px_date.procedure_date_3, undetermined.procedure_date_3) as date ) as procedure_date_3\r\n\t, cast(coalesce(px_date.procedure_date_4, undetermined.procedure_date_4) as date ) as procedure_date_4\r\n\t, cast(coalesce(px_date.procedure_date_5, undetermined.procedure_date_5) as date ) as procedure_date_5\r\n\t, cast(coalesce(px_date.procedure_date_6, undetermined.procedure_date_6) as date ) as procedure_date_6\r\n\t, cast(coalesce(px_date.procedure_date_7, undetermined.procedure_date_7) as date ) as procedure_date_7\r\n\t, cast(coalesce(px_date.procedure_date_8, undetermined.procedure_date_8) as date ) as procedure_date_8\r\n\t, cast(coalesce(px_date.procedure_date_9, undetermined.procedure_date_9) as date ) as procedure_date_9\r\n\t, cast(coalesce(px_date.procedure_date_10, undetermined.procedure_date_10) as date ) as procedure_date_10\r\n\t, cast(coalesce(px_date.procedure_date_11, undetermined.procedure_date_11) as date ) as procedure_date_11\r\n\t, cast(coalesce(px_date.procedure_date_12, undetermined.procedure_date_12) as date ) as procedure_date_12\r\n\t, cast(coalesce(px_date.procedure_date_13, undetermined.procedure_date_13) as date ) as procedure_date_13\r\n\t, cast(coalesce(px_date.procedure_date_14, undetermined.procedure_date_14) as date ) as procedure_date_14\r\n\t, cast(coalesce(px_date.procedure_date_15, undetermined.procedure_date_15) as date ) as procedure_date_15\r\n\t, cast(coalesce(px_date.procedure_date_16, undetermined.procedure_date_16) as date ) as procedure_date_16\r\n\t, cast(coalesce(px_date.procedure_date_17, undetermined.procedure_date_17) as date ) as procedure_date_17\r\n\t, cast(coalesce(px_date.procedure_date_18, undetermined.procedure_date_18) as date ) as procedure_date_18\r\n\t, cast(coalesce(px_date.procedure_date_19, undetermined.procedure_date_19) as date ) as procedure_date_19\r\n\t, cast(coalesce(px_date.procedure_date_20, undetermined.procedure_date_20) as date ) as procedure_date_20\r\n\t, cast(coalesce(px_date.procedure_date_21, undetermined.procedure_date_21) as date ) as procedure_date_21\r\n\t, cast(coalesce(px_date.procedure_date_22, undetermined.procedure_date_22) as date ) as procedure_date_22\r\n\t, cast(coalesce(px_date.procedure_date_23, undetermined.procedure_date_23) as date ) as procedure_date_23\r\n\t, cast(coalesce(px_date.procedure_date_24, undetermined.procedure_date_24) as date ) as procedure_date_24\r\n\t, cast(coalesce(px_date.procedure_date_25, undetermined.procedure_date_25) as date ) as procedure_date_25\r\n\t, cast(med.data_source as {{ dbt.type_string() }} ) as data_source\r\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\r\nleft join {{ref('normalized_input__int_admit_source_final') }} ad_source\r\n on med.claim_id = ad_source.claim_id\r\n and med.data_source = ad_source.data_source\r\nleft join {{ref('normalized_input__int_admit_type_final') }} ad_type\r\n on med.claim_id = ad_type.claim_id\r\n and med.data_source = ad_type.data_source\r\nleft join {{ref('normalized_input__int_apr_drg_final') }} apr\r\n on med.claim_id = apr.claim_id\r\n and med.data_source = apr.data_source\r\nleft join {{ref('normalized_input__int_bill_type_final') }} bill\r\n on med.claim_id = bill.claim_id\r\n and med.data_source = bill.data_source\r\nleft join {{ref('normalized_input__int_medical_claim_date_normalize') }} claim_line_dates\r\n on med.claim_id = claim_line_dates.claim_id\r\n and med.claim_line_number = claim_line_dates.claim_line_number\r\n and med.data_source = claim_line_dates.data_source\r\nleft join {{ref('normalized_input__int_medical_date_aggregation') }} dates\r\n on med.claim_id = dates.claim_id\r\n and med.data_source = dates.data_source\r\nleft join {{ref('normalized_input__int_medical_npi_normalize') }} med_npi\r\n on med.claim_id = med_npi.claim_id\r\n and med.claim_line_number = med_npi.claim_line_number\r\n and med.data_source = med_npi.data_source\r\nleft join {{ref('normalized_input__int_discharge_disposition_final') }} disch_disp\r\n on med.claim_id = disch_disp.claim_id\r\n and med.data_source = disch_disp.data_source\r\nleft join {{ref('normalized_input__int_ms_drg_final') }} ms\r\n on med.claim_id = ms.claim_id\r\n and med.data_source = ms.data_source\r\nleft join {{ref('normalized_input__int_place_of_service_normalize') }} pos\r\n on med.claim_id = pos.claim_id\r\n and med.claim_line_number = pos.claim_line_number\r\n and med.data_source = pos.data_source\r\nleft join {{ref('normalized_input__int_diagnosis_code_final') }} dx_code\r\n on med.claim_id = dx_code.claim_id\r\n and med.data_source = dx_code.data_source\r\nleft join {{ref('normalized_input__int_present_on_admit_final') }} poa\r\n on med.claim_id = poa.claim_id\r\n and med.data_source = poa.data_source\r\nleft join {{ref('normalized_input__int_procedure_code_final') }} px_code\r\n on med.claim_id = px_code.claim_id\r\n and med.data_source = px_code.data_source\r\nleft join {{ref('normalized_input__int_procedure_date_final') }} px_date\r\n on med.claim_id = px_date.claim_id\r\n and med.data_source = px_date.data_source\r\nleft join {{ref('normalized_input__int_revenue_center_normalize') }} rev\r\n on med.claim_id = rev.claim_id\r\n and med.claim_line_number = rev.claim_line_number\r\n and med.data_source = rev.data_source\r\nleft join {{ref('normalized_input__int_undetermined_claim_type') }} undetermined\r\n on med.claim_id = undetermined.claim_id\r\n and med.claim_line_number = undetermined.claim_line_number\r\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.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 , billing_npi\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 , 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\t, 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\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as TEXT ) as admit_type_code\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as TEXT ) as discharge_disposition_code\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as TEXT ) as place_of_service_code\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as TEXT ) as bill_type_code\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as TEXT ) as ms_drg_code\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as TEXT ) as apr_drg_code\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as TEXT ) as revenue_center_code\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_npi\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as TEXT ) as billing_npi\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as TEXT ) as facility_npi\n\t, 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('2024-02-20 20:47:44.615990+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 , billing_npi\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 , 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": "raw", "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": "9d3a39508a7585596a1395c9f828313fdf5fe61a1312b59f4468ba652527e7eb"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.878547, "relation_name": "raw.claims_preprocessing._int_normalized_input_revenue_center_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , data_source\r\n , rev.revenue_center_code as normalized_code\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\r\nleft join {{ ref('terminology__revenue_center') }} rev\r\n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\r\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 , billing_npi\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 , 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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join raw.terminology.revenue_center rev\n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\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 , billing_npi\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 , 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": "raw", "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": "9e956a80bc67c42e0c25e31dcad4eb03c5067497399a71131146272fde36c846"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.85978, "relation_name": "raw.claims_preprocessing._int_normalized_input_medical_claim_date_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect distinct\r\n med.claim_id\r\n , med.claim_line_number\r\n , med.claim_type\r\n , med.data_source\r\n , cal_claim_start.full_date as normalized_claim_start_date\r\n , cal_claim_end.full_date as normalized_claim_end_date\r\n , cal_claim_line_start.full_date as normalized_claim_line_start_date\r\n , cal_claim_line_end.full_date as normalized_claim_line_end_date\r\n , cal_admission.full_date as normalized_admission_date\r\n , cal_discharge.full_date as normalized_discharge_date\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\r\nleft join {{ ref('terminology__calendar') }} cal_claim_start\r\n on med.claim_start_date = cal_claim_start.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_claim_end\r\n on med.claim_end_Date = cal_claim_end.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_claim_line_start\r\n on med.claim_line_start_date = cal_claim_line_start.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_claim_line_end\r\n on med.claim_line_end_date = cal_claim_line_end.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_admission\r\n on med.admission_date = cal_admission.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_discharge\r\n on med.discharge_date = cal_discharge.full_date", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__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 , billing_npi\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 , 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join raw.terminology.calendar cal_claim_start\n on med.claim_start_date = cal_claim_start.full_date\nleft join raw.terminology.calendar cal_claim_end\n on med.claim_end_Date = cal_claim_end.full_date\nleft join raw.terminology.calendar cal_claim_line_start\n on med.claim_line_start_date = cal_claim_line_start.full_date\nleft join raw.terminology.calendar cal_claim_line_end\n on med.claim_line_end_date = cal_claim_line_end.full_date\nleft join raw.terminology.calendar cal_admission\n on med.admission_date = cal_admission.full_date\nleft join raw.terminology.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 , billing_npi\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 , 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": "raw", "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": "9cbf9b7508ec14d11e2f92daac9395852e98fdbb2436fe689f03d7f889406eb8"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8609111, "relation_name": "raw.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\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "304a071cf4de6809044353fc708384a99a18d0b364a6bd66e9b39b3c8e7b07c8"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8773818, "relation_name": "raw.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 )\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.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_code_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_code_normalize", "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-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.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.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "cd4234ff913908b2b0d196d6150245cd2455fb6ff6138f9bd218158ac5a1b57b"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.867649, "relation_name": "raw.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\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "2c28690e3137992d723a90f2f4618c5811d3546aec4cc983083bec63e090f7d4"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.847757, "relation_name": "raw.claims_preprocessing._int_normalized_input_apr_drg_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_apr_drg_voting') }}\r\nwhere (occurrence_row_count = 1\r\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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "12164226bf781f5b7aa766243c8a8b957f7558a3bf10c13cb6a3078439fe199b"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.845456, "relation_name": "raw.claims_preprocessing._int_normalized_input_admit_type_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_admit_type_voting') }}\r\nwhere (occurrence_row_count = 1\r\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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "17a7cb7168578fdf2f0d7c73c62f60761f888e93eca226f77cb72a8147fe3b45"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.84305, "relation_name": "raw.claims_preprocessing._int_normalized_input_admit_source_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_admit_source_voting') }}\r\nwhere (occurrence_row_count = 1\r\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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "66daf381a7f007c86c837a50f0a2ade7380c712eaa36d129f0d8741d4ac9d278"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.858662, "relation_name": "raw.claims_preprocessing._int_normalized_input_eligibility_dates_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect distinct\r\n elig.patient_id\r\n , elig.patient_id||elig.data_source||elig.payer||elig.plan||elig.enrollment_start_date||elig.enrollment_end_date as patient_id_key\r\n , cal_dob.full_date as normalized_birth_date\r\n , cal_death.full_date as normalized_death_date\r\n , cal_enroll_start.full_date as normalized_enrollment_start_date\r\n , cal_enroll_end.full_date as normalized_enrollment_end_date\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_eligibility') }} elig\r\nleft join {{ ref('terminology__calendar') }} cal_dob\r\n on elig.birth_date = cal_dob.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_death\r\n on elig.death_date = cal_death.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_enroll_start\r\n on elig.enrollment_start_date = cal_enroll_start.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_enroll_end\r\n on elig.enrollment_end_date = cal_enroll_end.full_date", "language": "sql", "refs": [{"name": "normalized_input__stg_eligibility", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}, {"name": "terminology__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_eligibility", "seed.the_tuva_project.terminology__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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\nfrom tuva.input_layer.eligibility\n) select distinct\n elig.patient_id\n , elig.patient_id||elig.data_source||elig.payer||elig.plan||elig.enrollment_start_date||elig.enrollment_end_date 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join raw.terminology.calendar cal_dob\n on elig.birth_date = cal_dob.full_date\nleft join raw.terminology.calendar cal_death\n on elig.death_date = cal_death.full_date\nleft join raw.terminology.calendar cal_enroll_start\n on elig.enrollment_start_date = cal_enroll_start.full_date\nleft join raw.terminology.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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\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": "raw", "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": "f40a899a84de820391256602e3643c1547058d8d950fe41919beda218c4ede36"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8441532, "relation_name": "raw.claims_preprocessing._int_normalized_input_admit_source_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , admit.admit_source_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__admit_source') }} admit\r\n on med.admit_source_code = admit.admit_source_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , admit_source_code\r\n , count(*) as admit_source_occurrence_count\r\n from normalize\r\n where admit_source_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , admit_source_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'admit_source_code' as column_name\r\n , admit_source_code as normalized_code\r\n , admit_source_occurrence_count as occurrence_count\r\n , coalesce(lead(admit_source_occurrence_count) \r\n over (partition by claim_id, data_source order by admit_source_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by admit_source_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\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\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_source_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.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 , count(*) as admit_source_occurrence_count\n from normalize\n where admit_source_code is not null\n group by \n claim_id\n , data_source\n , admit_source_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+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 , billing_npi\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 , 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": "raw", "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": "da9fdbd807eea2707b65cea07732b41f5109df30ea6645d5dab36cbbdd1eb95e"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.864854, "relation_name": "raw.claims_preprocessing._int_normalized_input_ms_drg_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , ms.ms_drg_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__ms_drg') }} ms\r\n on med.ms_drg_code = ms.ms_drg_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , ms_drg_code\r\n , count(*) as ms_drg_occurrence_count\r\n from normalize\r\n where ms_drg_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , ms_drg_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'ms_drg_code' as column_name\r\n , ms_drg_code as normalized_code\r\n , ms_drg_occurrence_count as occurrence_count\r\n , coalesce(lead(ms_drg_occurrence_count) \r\n over (partition by claim_id, data_source order by ms_drg_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by ms_drg_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , ms.ms_drg_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.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 , count(*) as ms_drg_occurrence_count\n from normalize\n where ms_drg_code is not null\n group by \n claim_id\n , data_source\n , ms_drg_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+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 , billing_npi\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 , 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": "raw", "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": "d0a6e4f1a257ff8e6de8ec8e8badbcafc39cf564c8d4ee3b49c20479e37b489a"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.857524, "relation_name": "raw.claims_preprocessing._int_normalized_input_discharge_disposition_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , disch.discharge_disposition_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__discharge_disposition') }} disch\r\n on med.discharge_disposition_code = disch.discharge_disposition_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , discharge_disposition_code\r\n , count(*) as discharge_disposition_occurrence_count\r\n from normalize\r\n where discharge_disposition_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , discharge_disposition_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'discharge_disposition_code' as column_name\r\n , discharge_disposition_code as normalized_code\r\n , discharge_disposition_occurrence_count as occurrence_count\r\n , coalesce(lead(discharge_disposition_occurrence_count) \r\n over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , disch.discharge_disposition_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.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 , count(*) as discharge_disposition_occurrence_count\n from normalize\n where discharge_disposition_code is not null\n group by \n claim_id\n , data_source\n , discharge_disposition_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+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 , billing_npi\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 , 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": "raw", "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": "2400b286d1d3482ce59f7f943bc5a61578e41d6a85c83d93a9592e7ac4eef438"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8561769, "relation_name": "raw.claims_preprocessing._int_normalized_input_discharge_disposition_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_discharge_disposition_voting') }}\r\nwhere (occurrence_row_count = 1\r\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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "5821debac2d4385a548764da8eb4a90453b6abfae5fe985294d3489f5b69d282"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.854953, "relation_name": "raw.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\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-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "4e2fc490025b435a5e30b1dd40103cdc12728965c8e59b89faaaad3d646bcb97"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8538501, "relation_name": "raw.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\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 , billing_npi\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 , 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pivot_diagnosis piv\nleft join raw.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 raw.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 , billing_npi\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 , 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": "raw", "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": "a5277f6a929fc4773879cef62c4215915c0f91de7c728828657c4dcc72dbedc1"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.876199, "relation_name": "raw.claims_preprocessing._int_normalized_input_procedure_date_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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_date_1' as procedure_column\r\n , procedure_date_1 as procedure_date\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_date_2' as procedure_column\r\n , procedure_date_2 as procedure_date\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_date_3' as procedure_column\r\n , procedure_date_3 as procedure_date\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_date_4' as procedure_column\r\n , procedure_date_4 as procedure_date\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_date_5' as procedure_column\r\n , procedure_date_5 as procedure_date\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_date_6' as procedure_column\r\n , procedure_date_6 as procedure_date\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_date_7' as procedure_column\r\n , procedure_date_7 as procedure_date\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_date_8' as procedure_column\r\n , procedure_date_8 as procedure_date\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_date_9' as procedure_column\r\n , procedure_date_9 as procedure_date\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_date_10' as procedure_column\r\n , procedure_date_10 as procedure_date\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_date_11' as procedure_column\r\n , procedure_date_11 as procedure_date\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_date_12' as procedure_column\r\n , procedure_date_12 as procedure_date\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_date_13' as procedure_column\r\n , procedure_date_13 as procedure_date\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_date_14' as procedure_column\r\n , procedure_date_14 as procedure_date\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_date_15' as procedure_column\r\n , procedure_date_15 as procedure_date\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_date_16' as procedure_column\r\n , procedure_date_16 as procedure_date\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_date_17' as procedure_column\r\n , procedure_date_17 as procedure_date\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_date_18' as procedure_column\r\n , procedure_date_18 as procedure_date\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_date_19' as procedure_column\r\n , procedure_date_19 as procedure_date\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_date_20' as procedure_column\r\n , procedure_date_20 as procedure_date\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_date_21' as procedure_column\r\n , procedure_date_21 as procedure_date\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_date_22' as procedure_column\r\n , procedure_date_22 as procedure_date\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_date_23' as procedure_column\r\n , procedure_date_24 as procedure_date\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_date_24' as procedure_column\r\n , procedure_date_24 as procedure_date\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_date_25' as procedure_column\r\n , procedure_date_25 as procedure_date\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_column\r\n , cal.full_date as procedure_date\r\n , count(*) as procedure_date_occurrence_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom pivot_procedure piv\r\nleft join {{ ref('terminology__calendar') }} cal\r\n on piv.procedure_date = cal.full_date\r\nwhere claim_type = 'institutional'\r\ngroup by \r\n claim_id\r\n , data_source\r\n , procedure_column\r\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": "terminology__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__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 , billing_npi\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 , 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_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_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join raw.terminology.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 , billing_npi\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 , 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": "raw", "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": "1e1007a03a83eb45173da14639e96a8bd7bcd23b6717ec6de962d2a94b495f09"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8750122, "relation_name": "raw.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 )\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_14' 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_14' then normalized_code else null end) as procedure_date_25\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "0c92eb7d6c2a1f41ce01492444d104a6979f15b75bacfacece09d06bf2235cad"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.880065, "relation_name": "raw.claims_preprocessing._int_normalized_input_undetermined_claim_type", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , claim_type\r\n , patient_id\r\n , member_id\r\n , payer\r\n , plan\r\n , claim_start_date\r\n , claim_end_date\r\n , claim_line_start_date\r\n , claim_line_end_date\r\n , admission_date\r\n , discharge_date\r\n , admit_source_code\r\n , admit_type_code\r\n , discharge_disposition_code\r\n , place_of_service_code\r\n , bill_type_code\r\n , ms_drg_code\r\n , apr_drg_code\r\n , revenue_center_code\r\n , service_unit_quantity\r\n , hcpcs_code\r\n , hcpcs_modifier_1\r\n , hcpcs_modifier_2\r\n , hcpcs_modifier_3\r\n , hcpcs_modifier_4\r\n , hcpcs_modifier_5\r\n , rendering_npi\r\n , billing_npi\r\n , facility_npi\r\n , paid_date\r\n , paid_amount\r\n , allowed_amount\r\n , charge_amount\r\n , coinsurance_amount\r\n , copayment_amount\r\n , deductible_amount\r\n , total_cost_amount\r\n , diagnosis_code_type\r\n , diagnosis_code_1\r\n , diagnosis_code_2\r\n , diagnosis_code_3\r\n , diagnosis_code_4\r\n , diagnosis_code_5\r\n , diagnosis_code_6\r\n , diagnosis_code_7\r\n , diagnosis_code_8\r\n , diagnosis_code_9\r\n , diagnosis_code_10\r\n , diagnosis_code_11\r\n , diagnosis_code_12\r\n , diagnosis_code_13\r\n , diagnosis_code_14\r\n , diagnosis_code_15\r\n , diagnosis_code_16\r\n , diagnosis_code_17\r\n , diagnosis_code_18\r\n , diagnosis_code_19\r\n , diagnosis_code_20\r\n , diagnosis_code_21\r\n , diagnosis_code_22\r\n , diagnosis_code_23\r\n , diagnosis_code_24\r\n , diagnosis_code_25\r\n , diagnosis_poa_1\r\n , diagnosis_poa_2\r\n , diagnosis_poa_3\r\n , diagnosis_poa_4\r\n , diagnosis_poa_5\r\n , diagnosis_poa_6\r\n , diagnosis_poa_7\r\n , diagnosis_poa_8\r\n , diagnosis_poa_9\r\n , diagnosis_poa_10\r\n , diagnosis_poa_11\r\n , diagnosis_poa_12\r\n , diagnosis_poa_13\r\n , diagnosis_poa_14\r\n , diagnosis_poa_15\r\n , diagnosis_poa_16\r\n , diagnosis_poa_17\r\n , diagnosis_poa_18\r\n , diagnosis_poa_19\r\n , diagnosis_poa_20\r\n , diagnosis_poa_21\r\n , diagnosis_poa_22\r\n , diagnosis_poa_23\r\n , diagnosis_poa_24\r\n , diagnosis_poa_25\r\n , procedure_code_type\r\n , procedure_code_1\r\n , procedure_code_2\r\n , procedure_code_3\r\n , procedure_code_4\r\n , procedure_code_5\r\n , procedure_code_6\r\n , procedure_code_7\r\n , procedure_code_8\r\n , procedure_code_9\r\n , procedure_code_10\r\n , procedure_code_11\r\n , procedure_code_12\r\n , procedure_code_13\r\n , procedure_code_14\r\n , procedure_code_15\r\n , procedure_code_16\r\n , procedure_code_17\r\n , procedure_code_18\r\n , procedure_code_19\r\n , procedure_code_20\r\n , procedure_code_21\r\n , procedure_code_22\r\n , procedure_code_23\r\n , procedure_code_24\r\n , procedure_code_25\r\n , procedure_date_1\r\n , procedure_date_2\r\n , procedure_date_3\r\n , procedure_date_4\r\n , procedure_date_5\r\n , procedure_date_6\r\n , procedure_date_7\r\n , procedure_date_8\r\n , procedure_date_9\r\n , procedure_date_10\r\n , procedure_date_11\r\n , procedure_date_12\r\n , procedure_date_13\r\n , procedure_date_14\r\n , procedure_date_15\r\n , procedure_date_16\r\n , procedure_date_17\r\n , procedure_date_18\r\n , procedure_date_19\r\n , procedure_date_20\r\n , procedure_date_21\r\n , procedure_date_22\r\n , procedure_date_23\r\n , procedure_date_24\r\n , procedure_date_25\r\n , data_source\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }}\r\nwhere claim_type in ('undetermined')", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim"]}, "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 , billing_npi\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 , 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 , 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 , billing_npi\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 , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim\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 , billing_npi\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 , 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": "raw", "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": "097462fff450a8bae20fdbae6bc36cb9ecfedfd3be3a86e7eb6c524b7988e904"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.871339, "relation_name": "raw.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 )\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_14' 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_14' then normalized_code else null end) as procedure_code_25\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "bf6834f3874beba22539014b13acb3c38305237ddd0560a230a1886a9bc3d0b2"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.848948, "relation_name": "raw.claims_preprocessing._int_normalized_input_apr_drg_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , apr.apr_drg_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__apr_drg') }} apr\r\n on med.apr_drg_code = apr.apr_drg_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , apr_drg_code\r\n , count(*) as apr_drg_occurrence_count\r\n from normalize\r\n where apr_drg_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , apr_drg_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'apr_drg_code' as column_name\r\n , apr_drg_code as normalized_code\r\n , apr_drg_occurrence_count as occurrence_count\r\n , coalesce(lead(apr_drg_occurrence_count) \r\n over (partition by claim_id, data_source order by apr_drg_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by apr_drg_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\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\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , apr.apr_drg_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.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 , count(*) as apr_drg_occurrence_count\n from normalize\n where apr_drg_code is not null\n group by \n claim_id\n , data_source\n , apr_drg_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+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 , billing_npi\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 , 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": "raw", "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": "245252ab22177d0c9bc003c951fdf23bb24d817aae9757151e54201677c22d7d"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.863571, "relation_name": "raw.claims_preprocessing._int_normalized_input_ms_drg_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_ms_drg_voting') }}\r\nwhere (occurrence_row_count = 1\r\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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "79f36e1dd41392587aa1017ffc492d4548d17e6c1cb02ef3afae8abe7f6c9686"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.846617, "relation_name": "raw.claims_preprocessing._int_normalized_input_admit_type_normalize_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , admit.admit_type_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__admit_type') }} admit\r\n on med.admit_type_code = admit.admit_type_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , admit_type_code\r\n , count(*) as admit_type_occurrence_count\r\n from normalize\r\n where admit_type_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , admit_type_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'admit_type_code' as column_name\r\n , admit_type_code as normalized_code\r\n , admit_type_occurrence_count as occurrence_count\r\n , coalesce(lead(admit_type_occurrence_count) \r\n over (partition by claim_id, data_source order by admit_type_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by admit_type_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_type_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.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 , count(*) as admit_type_occurrence_count\n from normalize\n where admit_type_code is not null\n group by \n claim_id\n , data_source\n , admit_type_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+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 , billing_npi\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 , 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": "raw", "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": "8e4a982e97a1d755bf910c60681e50b5e5819e130b913dc53b0c40988d27f4bd"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.869971, "relation_name": "raw.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\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-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "dcdffb2c8c3b11d97e191de119277714560c0e78a4afd0ac823e1f3b5b0b81cc"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.872504, "relation_name": "raw.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 )\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_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_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 , billing_npi\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 , 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_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_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join raw.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 raw.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 , billing_npi\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 , 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": "raw", "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": "b16902fc33d80b498f1d912e164c90f832a958b73d0aa18f160ffe5eba45305d"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.850241, "relation_name": "raw.claims_preprocessing._int_normalized_input_bill_type_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_bill_type_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)", "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_normalized_input_bill_type_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_bill_type_voting": {"database": "raw", "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": "b0be29a7229507ec00c128b8cbd10012e01b8050d5f658152cd25168f26da085"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.851431, "relation_name": "raw.claims_preprocessing._int_normalized_input_bill_type_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , bill.bill_type_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__bill_type') }} bill\r\n on med.bill_type_code = bill.bill_type_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , bill_type_code\r\n , count(*) as bill_type_occurrence_count\r\n from normalize\r\n where bill_type_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , bill_type_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'bill_type_code' as column_name\r\n , bill_type_code as normalized_code\r\n , bill_type_occurrence_count as occurrence_count\r\n , coalesce(lead(bill_type_occurrence_count) \r\n over (partition by claim_id, data_source order by bill_type_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by bill_type_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\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": [], "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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , bill.bill_type_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.terminology.bill_type bill\n on med.bill_type_code = 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 , count(*) as bill_type_occurrence_count\n from normalize\n where bill_type_code is not null\n group by \n claim_id\n , data_source\n , bill_type_code\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_occurrence_count as occurrence_count\n , coalesce(lead(bill_type_occurrence_count) \n over (partition by claim_id, data_source order by bill_type_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by bill_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+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 , billing_npi\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 , 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": "raw", "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": "542e9d1021ce7a94505a22f9a918996c7967fe7ab8c4240a3c755559af4362aa"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.868789, "relation_name": "raw.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\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 , billing_npi\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 , 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pivot_poa piv\nleft join raw.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 , billing_npi\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 , 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": "raw", "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": "481b460bd1fe4add4fea5adeb375783c07f6f52df54da992b508bcc9b10e9230"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8664691, "relation_name": "raw.claims_preprocessing._int_normalized_input_place_of_service_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , data_source\r\n , pos.place_of_service_code as normalized_code\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\r\nleft join {{ ref('terminology__place_of_service') }} pos\r\n on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\r\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 , billing_npi\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 , 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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join raw.terminology.place_of_service pos\n on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\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 , billing_npi\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 , 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": "raw", "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": "e398ec28bf7f358013b41c209730f4ea3c9921d9c11977e42364c027f4ca33f2"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.862262, "relation_name": "raw.claims_preprocessing._int_normalized_input_medical_npi_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect distinct\r\n med.claim_id\r\n , med.claim_line_number\r\n , med.claim_type\r\n , med.data_source\r\n , rend_prov.npi as normalized_rendering_npi\r\n , bill_prov.npi as normalized_billing_npi\r\n , fac_prov.npi as normalized_facility_npi\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\r\nleft join {{ ref('terminology__provider') }} rend_prov\r\n on med.rendering_npi = rend_prov.npi\r\n and rend_prov.entity_type_description = 'Individual'\r\nleft join {{ ref('terminology__provider') }} bill_prov\r\n on med.billing_npi = bill_prov.npi\r\nleft join {{ ref('terminology__provider') }} fac_prov\r\n on med.facility_npi = fac_prov.npi\r\n and fac_prov.entity_type_description = 'Organization'\r\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": [], "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 , billing_npi\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 , 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 , bill_prov.npi as normalized_billing_npi\n , fac_prov.npi as normalized_facility_npi\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join raw.terminology.provider rend_prov\n on med.rendering_npi = rend_prov.npi\n and rend_prov.entity_type_description = 'Individual'\nleft join raw.terminology.provider bill_prov\n on med.billing_npi = bill_prov.npi\nleft join raw.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 , billing_npi\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 , 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": "raw", "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": "5c8863b1cd997ce1b20470b7fc27d4419ac09f2f5b132d6179e90549c1d9a223"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8525949, "relation_name": "raw.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\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "757d7a1c6ae50c1fa759619309f3133f98b10abc966e5eaea9bf2540d8429d00"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8736799, "relation_name": "raw.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\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-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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.service_category__stg_medical_claim": {"database": "raw", "schema": "jaffle_shop", "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": "b26c844757968eeea28c6395551b8a0cd13c66e4d598efaef28f1555216553b2"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "Staging med claims for sc grouper", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "ephemeral", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.8308392, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }}", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim"]}, "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\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__dq_input_layer_results": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__dq_input_layer_results", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_results.sql", "original_file_path": "models/claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_results.sql", "unique_id": "model.the_tuva_project.service_category__dq_input_layer_results", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "data_quality", "service_category__dq_input_layer_results"], "alias": "_dq_input_layer_results", "checksum": {"name": "sha256", "checksum": "0153d75e226c9f3d5403c0ce0ca022c42b397004ae6111cbd5701d98c79138dc"}, "config": {"enabled": true, "alias": "_dq_input_layer_results", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_dq_input_layer_results", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.8329742, "relation_name": "raw.claims_preprocessing._dq_input_layer_results", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n dq_problem\n, count(distinct claim_id) as distinct_claims\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__dq_input_layer_tests') }}\ngroup by 1", "language": "sql", "refs": [{"name": "service_category__dq_input_layer_tests", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__dq_input_layer_tests"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_results.sql", "compiled": true, "compiled_code": "\n\nselect\n dq_problem\n, count(distinct claim_id) as distinct_claims\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._dq_input_layer_tests\ngroup by 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__dq_multiple_service_categories_professional": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__dq_multiple_service_categories_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_professional.sql", "unique_id": "model.the_tuva_project.service_category__dq_multiple_service_categories_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "data_quality", "service_category__dq_multiple_service_categories_professional"], "alias": "_dq_multiple_service_categories_professional", "checksum": {"name": "sha256", "checksum": "75b2b979b8bd7d1d1251a7aa90f4f765b47d1a463596be3dd21570537d35d9ff"}, "config": {"enabled": true, "alias": "_dq_multiple_service_categories_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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_dq_multiple_service_categories_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.8366542, "relation_name": "raw.claims_preprocessing._dq_multiple_service_categories_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n claim_id\n, claim_line_number\n, count(distinct service_category_2) as distinct_service_category_count\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__combined_professional') }}\ngroup by 1,2\nhaving count(distinct service_category_2) > 1", "language": "sql", "refs": [{"name": "service_category__combined_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__combined_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_professional.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n, claim_line_number\n, count(distinct service_category_2) as distinct_service_category_count\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_combined_professional\ngroup by 1,2\nhaving count(distinct service_category_2) > 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__dq_multiple_service_categories_institutional": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__dq_multiple_service_categories_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_institutional.sql", "unique_id": "model.the_tuva_project.service_category__dq_multiple_service_categories_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "data_quality", "service_category__dq_multiple_service_categories_institutional"], "alias": "_dq_multiple_service_categories_institutional", "checksum": {"name": "sha256", "checksum": "b0aa09f9d0ba10b8b974ed8890e0a5791f3a7607dff0d7ef10b2dbf41f51541f"}, "config": {"enabled": true, "alias": "_dq_multiple_service_categories_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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_dq_multiple_service_categories_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.835435, "relation_name": "raw.claims_preprocessing._dq_multiple_service_categories_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n claim_id\n, count(distinct service_category_2) as distinct_service_category_count\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__combined_institutional') }}\ngroup by 1\nhaving count(distinct service_category_2) > 1", "language": "sql", "refs": [{"name": "service_category__combined_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__combined_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_institutional.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n, count(distinct service_category_2) as distinct_service_category_count\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_combined_institutional\ngroup by 1\nhaving count(distinct service_category_2) > 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__dq_input_layer_tests": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__dq_input_layer_tests", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_tests.sql", "original_file_path": "models/claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_tests.sql", "unique_id": "model.the_tuva_project.service_category__dq_input_layer_tests", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "data_quality", "service_category__dq_input_layer_tests"], "alias": "_dq_input_layer_tests", "checksum": {"name": "sha256", "checksum": "fc16e6bfa3c2a7c10ae467283d062e71fc0d35fb9da979b6a8c65fdd76f7782a"}, "config": {"enabled": true, "alias": "_dq_input_layer_tests", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_dq_input_layer_tests", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.83412, "relation_name": "raw.claims_preprocessing._dq_input_layer_tests", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Multiple claim_type' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\ngroup by 1\nhaving count(distinct claim_type) > 1\n\nunion all\n\nselect distinct \n claim_id\n, 'Multiple bill_type_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\ngroup by 1\nhaving count(distinct bill_type_code) > 1\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing claim_type' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing place_of_service_code' as dq_problem\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 is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing bill_type_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and bill_type_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing revenue_center_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and revenue_center_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing hcpcs_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and hcpcs_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid claim_type' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__claim_type') }} b\n on a.claim_type = b.claim_type\nwhere b.claim_type is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid place_of_service_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__place_of_service') }} b\n on a.place_of_service_code = b.place_of_service_code\nwhere a.claim_type = 'professional'\n and b.place_of_service_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid bill_type_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__bill_type') }} b\n on a.bill_type_code = b.bill_type_code\nwhere a.claim_type = 'institutional'\n and b.bill_type_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid revenue_center_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__revenue_center') }} b\n on a.revenue_center_code = b.revenue_center_code\nwhere a.claim_type = 'institutional'\n and b.revenue_center_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid hcpcs_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__hcpcs_level_2') }} b\n on a.hcpcs_code = b.hcpcs\nwhere a.claim_type = 'professional'\n and b.hcpcs is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid ms_drg_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__ms_drg') }} b\n on a.ms_drg_code = b.ms_drg_code\nwhere a.claim_type = 'institutional'\n and b.ms_drg_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid apr_drg_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__apr_drg') }} b\n on a.apr_drg_code = b.apr_drg_code\nwhere a.claim_type = 'institutional'\n and b.apr_drg_code is null", "language": "sql", "refs": [{"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}, {"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}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__claim_type", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "service_category__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.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__claim_type", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__revenue_center", "seed.the_tuva_project.terminology__hcpcs_level_2", "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/data_quality/service_category__dq_input_layer_tests.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Multiple claim_type' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\ngroup by 1\nhaving count(distinct claim_type) > 1\n\nunion all\n\nselect distinct \n claim_id\n, 'Multiple bill_type_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\ngroup by 1\nhaving count(distinct bill_type_code) > 1\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing claim_type' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing place_of_service_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing bill_type_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and bill_type_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing revenue_center_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and revenue_center_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing hcpcs_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and hcpcs_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid claim_type' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.claim_type b\n on a.claim_type = b.claim_type\nwhere b.claim_type is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid place_of_service_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.place_of_service b\n on a.place_of_service_code = b.place_of_service_code\nwhere a.claim_type = 'professional'\n and b.place_of_service_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid bill_type_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.bill_type b\n on a.bill_type_code = b.bill_type_code\nwhere a.claim_type = 'institutional'\n and b.bill_type_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid revenue_center_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.revenue_center b\n on a.revenue_center_code = b.revenue_center_code\nwhere a.claim_type = 'institutional'\n and b.revenue_center_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid hcpcs_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.hcpcs_level_2 b\n on a.hcpcs_code = b.hcpcs\nwhere a.claim_type = 'professional'\n and b.hcpcs is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid ms_drg_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.ms_drg b\n on a.ms_drg_code = b.ms_drg_code\nwhere a.claim_type = 'institutional'\n and b.ms_drg_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid apr_drg_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.apr_drg b\n on a.apr_drg_code = b.apr_drg_code\nwhere a.claim_type = 'institutional'\n and b.apr_drg_code is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__service_category_grouper": {"database": "raw", "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": "ef849e362fb992c82a4c7e60e3a7d9fac20c8be30de7d767fb7b5844e2e4d218"}, "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": null}, "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": []}, "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": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.7921522, "relation_name": "raw.claims_preprocessing.service_category_grouper", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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\n when service_category_2 = 'Acute Inpatient' then 'Inpatient'\n when service_category_2 = 'Ambulance' then 'Ancillary'\n when service_category_2 = 'Ambulatory Surgery' then 'Outpatient'\n when service_category_2 = 'Dialysis' then 'Outpatient'\n when service_category_2 = 'Durable Medical Equipment' then 'Ancillary'\n when service_category_2 = 'Emergency Department' then 'Outpatient'\n when service_category_2 = 'Home Health' then 'Outpatient'\n when service_category_2 = 'Hospice' then 'Outpatient'\n when service_category_2 = 'Inpatient Psychiatric' then 'Inpatient'\n when service_category_2 = 'Inpatient Rehabilitation' then 'Inpatient'\n when service_category_2 = 'Lab' then 'Ancillary'\n when service_category_2 = 'Office Visit' then 'Office Visit'\n when service_category_2 = 'Outpatient Hospital or Clinic' then 'Outpatient'\n when service_category_2 = 'Outpatient Psychiatric' then 'Outpatient'\n when service_category_2 = 'Outpatient Rehabilitation' then 'Outpatient'\n when service_category_2 = 'Skilled Nursing' then 'Inpatient'\n when service_category_2 = 'Urgent Care' then 'Outpatient'\n when service_category_2 is null then 'Other'\n end service_category_1\n , case\n when service_category_2 is null then 'Other'\n else service_category_2\n end service_category_2\n , '{{ var('tuva_last_run')}}' as tuva_last_run\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 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\n when service_category_2 = 'Acute Inpatient' then 'Inpatient'\n when service_category_2 = 'Ambulatory Surgery' then 'Outpatient'\n when service_category_2 = 'Dialysis' then 'Outpatient'\n when service_category_2 = 'Emergency Department' then 'Outpatient'\n when service_category_2 = 'Home Health' then 'Outpatient'\n when service_category_2 = 'Hospice' then 'Outpatient'\n when service_category_2 = 'Inpatient Psychiatric' then 'Inpatient'\n when service_category_2 = 'Inpatient Rehabilitation' then 'Inpatient'\n when service_category_2 = 'Lab' then 'Ancillary'\n when service_category_2 = 'Office Visit' then 'Office Visit'\n when service_category_2 = 'Outpatient Hospital or Clinic' then 'Outpatient'\n when service_category_2 = 'Outpatient Psychiatric' then 'Outpatient'\n when service_category_2 = 'Skilled Nursing' then 'Inpatient'\n when service_category_2 = 'Urgent Care' then 'Outpatient'\n when service_category_2 is null then 'Other'\n end service_category_1\n , case\n when service_category_2 is null then 'Other'\n else service_category_2\n end service_category_2\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} a\n left join {{ ref('service_category__combined_institutional') }} b\n on a.claim_id = b.claim_id\n where a.claim_type = 'institutional'\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 , row_number() over (partition by claim_id, claim_line_number order by \n case\n when service_category_2 = 'Acute Inpatient' then 3\n when service_category_2 = 'Ambulance' then 7\n when service_category_2 = 'Ambulatory Surgery' then 8\n when service_category_2 = 'Dialysis' then 17\n when service_category_2 = 'Durable Medical Equipment' then 1\n when service_category_2 = 'Emergency Department' then 5\n when service_category_2 = 'Home Health' then 9\n when service_category_2 = 'Hospice' then 10\n when service_category_2 = 'Inpatient Psychiatric' then 11\n when service_category_2 = 'Inpatient Rehabilitation' then 12\n when service_category_2 = 'Lab' then 13\n when service_category_2 = 'Office Visit' then 4\n when service_category_2 = 'Outpatient Hospital or Clinic' then 14\n when service_category_2 = 'Outpatient Psychiatric' then 15\n when service_category_2 = 'Outpatient Rehabilitation' then 16\n when service_category_2 = 'Skilled Nursing' then 6\n when service_category_2 = 'Urgent Care' then 2\n when service_category_2 is null then 18\n else 99 end) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\nfrom service_category_2_deduplication\nwhere 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__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__combined_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__combined_professional", "model.the_tuva_project.service_category__combined_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/final/service_category__service_category_grouper.sql", "compiled": true, "compiled_code": "\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), service_category_1_mapping as(\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case\n when service_category_2 = 'Acute Inpatient' then 'Inpatient'\n when service_category_2 = 'Ambulance' then 'Ancillary'\n when service_category_2 = 'Ambulatory Surgery' then 'Outpatient'\n when service_category_2 = 'Dialysis' then 'Outpatient'\n when service_category_2 = 'Durable Medical Equipment' then 'Ancillary'\n when service_category_2 = 'Emergency Department' then 'Outpatient'\n when service_category_2 = 'Home Health' then 'Outpatient'\n when service_category_2 = 'Hospice' then 'Outpatient'\n when service_category_2 = 'Inpatient Psychiatric' then 'Inpatient'\n when service_category_2 = 'Inpatient Rehabilitation' then 'Inpatient'\n when service_category_2 = 'Lab' then 'Ancillary'\n when service_category_2 = 'Office Visit' then 'Office Visit'\n when service_category_2 = 'Outpatient Hospital or Clinic' then 'Outpatient'\n when service_category_2 = 'Outpatient Psychiatric' then 'Outpatient'\n when service_category_2 = 'Outpatient Rehabilitation' then 'Outpatient'\n when service_category_2 = 'Skilled Nursing' then 'Inpatient'\n when service_category_2 = 'Urgent Care' then 'Outpatient'\n when service_category_2 is null then 'Other'\n end service_category_1\n , case\n when service_category_2 is null then 'Other'\n else service_category_2\n end service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from __dbt__cte__service_category__stg_medical_claim a\n left join raw.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 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\n when service_category_2 = 'Acute Inpatient' then 'Inpatient'\n when service_category_2 = 'Ambulatory Surgery' then 'Outpatient'\n when service_category_2 = 'Dialysis' then 'Outpatient'\n when service_category_2 = 'Emergency Department' then 'Outpatient'\n when service_category_2 = 'Home Health' then 'Outpatient'\n when service_category_2 = 'Hospice' then 'Outpatient'\n when service_category_2 = 'Inpatient Psychiatric' then 'Inpatient'\n when service_category_2 = 'Inpatient Rehabilitation' then 'Inpatient'\n when service_category_2 = 'Lab' then 'Ancillary'\n when service_category_2 = 'Office Visit' then 'Office Visit'\n when service_category_2 = 'Outpatient Hospital or Clinic' then 'Outpatient'\n when service_category_2 = 'Outpatient Psychiatric' then 'Outpatient'\n when service_category_2 = 'Skilled Nursing' then 'Inpatient'\n when service_category_2 = 'Urgent Care' then 'Outpatient'\n when service_category_2 is null then 'Other'\n end service_category_1\n , case\n when service_category_2 is null then 'Other'\n else service_category_2\n end service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from __dbt__cte__service_category__stg_medical_claim a\n left join raw.claims_preprocessing._int_combined_institutional b\n on a.claim_id = b.claim_id\n where a.claim_type = 'institutional'\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 , row_number() over (partition by claim_id, claim_line_number order by \n case\n when service_category_2 = 'Acute Inpatient' then 3\n when service_category_2 = 'Ambulance' then 7\n when service_category_2 = 'Ambulatory Surgery' then 8\n when service_category_2 = 'Dialysis' then 17\n when service_category_2 = 'Durable Medical Equipment' then 1\n when service_category_2 = 'Emergency Department' then 5\n when service_category_2 = 'Home Health' then 9\n when service_category_2 = 'Hospice' then 10\n when service_category_2 = 'Inpatient Psychiatric' then 11\n when service_category_2 = 'Inpatient Rehabilitation' then 12\n when service_category_2 = 'Lab' then 13\n when service_category_2 = 'Office Visit' then 4\n when service_category_2 = 'Outpatient Hospital or Clinic' then 14\n when service_category_2 = 'Outpatient Psychiatric' then 15\n when service_category_2 = 'Outpatient Rehabilitation' then 16\n when service_category_2 = 'Skilled Nursing' then 6\n when service_category_2 = 'Urgent Care' then 2\n when service_category_2 is null then 18\n else 99 end) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\nfrom service_category_2_deduplication\nwhere duplicate_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__hospice_professional": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__hospice_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__hospice_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__hospice_professional.sql", "unique_id": "model.the_tuva_project.service_category__hospice_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__hospice_professional"], "alias": "_int_hospice_professional", "checksum": {"name": "sha256", "checksum": "0849ed9fefd848360e2ba84e2e3b67e2233c06e8ba0c7d82e1273715267dca31"}, "config": {"enabled": true, "alias": "_int_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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_hospice_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.81169, "relation_name": "raw.claims_preprocessing._int_hospice_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Hospice' as service_category_2\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 ('34')", "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__hospice_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Hospice' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('34')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__ambulatory_surgery_professional": {"database": "raw", "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": "a436c587da1c3c136440ebcfbd6601b73f13bb2c2e7ac18268f3f31c66ee29e9"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.8006241, "relation_name": "raw.claims_preprocessing._int_ambulatory_surgery_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n a.claim_id\n, a.claim_line_number\n, 'Ambulatory Surgery' as service_category_2\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 a.claim_type = 'professional'\n and a.place_of_service_code in ('24')\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__ambulatory_surgery_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n a.claim_id\n, a.claim_line_number\n, 'Ambulatory Surgery' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join raw.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 a.claim_type = 'professional'\n and a.place_of_service_code in ('24')\n and (b.claim_id is null and b.claim_line_number is null)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__home_health_professional": {"database": "raw", "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": "38e31f8d999aa71d65097982d7e04728980c4da6651a522cf2538d1a0e8257a2"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.809259, "relation_name": "raw.claims_preprocessing._int_home_health_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n a.claim_id\n, a.claim_line_number\n, 'Home Health' as service_category_2\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 a.claim_type = 'professional'\n and a.place_of_service_code in ('12')\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__home_health_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n a.claim_id\n, a.claim_line_number\n, 'Home Health' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join raw.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 a.claim_type = 'professional'\n and a.place_of_service_code in ('12')\n and (b.claim_id is null and b.claim_line_number is null)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__urgent_care_professional": {"database": "raw", "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": "12539d6e3ff3bd9377447e928586480d5abec9469ae483fba2679c180d9d0695"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.828662, "relation_name": "raw.claims_preprocessing._int_urgent_care_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Urgent Care' as service_category_2\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')", "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__urgent_care_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Urgent Care' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('20')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__duplicate_bill_types": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__duplicate_bill_types", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__duplicate_bill_types.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__duplicate_bill_types.sql", "unique_id": "model.the_tuva_project.service_category__duplicate_bill_types", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__duplicate_bill_types"], "alias": "_int_duplicate_bill_types", "checksum": {"name": "sha256", "checksum": "18f8d12e785b1774510a0dfbac2e5f68d8796690d63c726bab111863630bc3b9"}, "config": {"enabled": true, "alias": "_int_duplicate_bill_types", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_duplicate_bill_types", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.8298, "relation_name": "raw.claims_preprocessing._int_duplicate_bill_types", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct\n claim_id\n, count(distinct bill_type_code) as cnt\nfrom {{ ref('service_category__stg_medical_claim') }}\ngroup by 1\nhaving count(distinct bill_type_code) > 1", "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__duplicate_bill_types.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct\n claim_id\n, count(distinct bill_type_code) as cnt\nfrom __dbt__cte__service_category__stg_medical_claim\ngroup by 1\nhaving count(distinct bill_type_code) > 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__dialysis_professional": {"database": "raw", "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": "a1103666e1955236a3a92c6080e228b8f77b83e68635f29bcb914e1cd52d9b9d"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.803068, "relation_name": "raw.claims_preprocessing._int_dialysis_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Dialysis' as service_category_2\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 ('65')", "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__dialysis_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Dialysis' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('65')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__lab_institutional": {"database": "raw", "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": "00d1a133350a480370210b6fd38c18f11dfe34eeb8186adfa98433dd31088c9b"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.815485, "relation_name": "raw.claims_preprocessing._int_lab_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Lab' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('14')", "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__lab_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Lab' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('14')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__inpatient_rehab_professional": {"database": "raw", "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": "f7cdbee3bc0c6cd211896663eaad9bb24cdc6529a9380588c4cbb2eb2f9a5e8c"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.8142872, "relation_name": "raw.claims_preprocessing._int_inpatient_rehab_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Inpatient Rehabilitation' as service_category_2\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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Inpatient Rehabilitation' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('61')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__dialysis_institutional": {"database": "raw", "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": "e87b3fb04157060b754b143bb632437e5c3d8f337db49ab996c625800681516c"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.801897, "relation_name": "raw.claims_preprocessing._int_dialysis_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Dialysis' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('72')", "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__dialysis_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Dialysis' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('72')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__dme_professional": {"database": "raw", "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": "3da976d802838832089da97b1cb25ea0840a6847fa3cfc6b9606a10059051a8a"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.804199, "relation_name": "raw.claims_preprocessing._int_dme_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Durable Medical Equipment' as service_category_2\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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Durable Medical Equipment' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and hcpcs_code between 'E0100' and 'E8002'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__home_health_institutional": {"database": "raw", "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": "77a4486d50c971f389fab51b12ab709e2d8ebe82b5fbd043d034a19e5fc2812f"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.807879, "relation_name": "raw.claims_preprocessing._int_home_health_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Home Health' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Home Health' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('31','32','33')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__emergency_department_professional": {"database": "raw", "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": "cf9780868cac6827175f1d20fd1bb0640515ac5363adb43911d262bdb53479e9"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.806724, "relation_name": "raw.claims_preprocessing._int_emergency_department_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Emergency Department' as service_category_2\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 = '23'", "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__emergency_department_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Emergency Department' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code = '23'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__inpatient_psychiatric_professional": {"database": "raw", "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": "5a40ccbeee23816a3870f286c3f05096708bf70b82d4d5439e706fe5139a0578"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.812872, "relation_name": "raw.claims_preprocessing._int_inpatient_psychiatric_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Inpatient Psychiatric' as service_category_2\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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Inpatient Psychiatric' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__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": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__skilled_nursing_institutional": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__skilled_nursing_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__skilled_nursing_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__skilled_nursing_institutional.sql", "unique_id": "model.the_tuva_project.service_category__skilled_nursing_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__skilled_nursing_institutional"], "alias": "_int_skilled_nursing_institutional", "checksum": {"name": "sha256", "checksum": "abd4b9e63ac055443fdb99fd9f5c63599b60714b3cb43e7ead9078ab78e699c8"}, "config": {"enabled": true, "alias": "_int_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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_skilled_nursing_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.825196, "relation_name": "raw.claims_preprocessing._int_skilled_nursing_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Skilled Nursing' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,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__skilled_nursing_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Skilled Nursing' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('21','22')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__hospice_institutional": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__hospice_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__hospice_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__hospice_institutional.sql", "unique_id": "model.the_tuva_project.service_category__hospice_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__hospice_institutional"], "alias": "_int_hospice_institutional", "checksum": {"name": "sha256", "checksum": "da772e2317bfec7bcc63e298d964292d904b609db5249ff912cc70bec6b98474"}, "config": {"enabled": true, "alias": "_int_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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_hospice_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.810524, "relation_name": "raw.claims_preprocessing._int_hospice_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Hospice' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('81','82')", "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__hospice_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Hospice' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('81','82')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__outpatient_hospital_or_clinic_professional": {"database": "raw", "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": "c848d3c7c4de938000dd2406919e5527c0ba5d74aa404f81fdabf3dbdaa9c68a"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.820506, "relation_name": "raw.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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Outpatient Hospital or Clinic' as service_category_2\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 ('15','17','19','22','49','50','60','71','72')", "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_hospital_or_clinic_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Outpatient Hospital or Clinic' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('15','17','19','22','49','50','60','71','72')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__skilled_nursing_professional": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__skilled_nursing_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__skilled_nursing_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__skilled_nursing_professional.sql", "unique_id": "model.the_tuva_project.service_category__skilled_nursing_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__skilled_nursing_professional"], "alias": "_int_skilled_nursing_professional", "checksum": {"name": "sha256", "checksum": "debea2d60c300d893d9bc199b921647cbb01b50419be3464128efab5b43b464e"}, "config": {"enabled": true, "alias": "_int_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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_skilled_nursing_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.826446, "relation_name": "raw.claims_preprocessing._int_skilled_nursing_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n a.claim_id\n, a.claim_line_number\n, 'Skilled Nursing' as service_category_2\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__skilled_nursing_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n a.claim_id\n, a.claim_line_number\n, 'Skilled Nursing' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join raw.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": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__lab_professional": {"database": "raw", "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": "68f546244a6804a163d287689b2972bd5b19383b159ef818e650facfd897ca5b"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.816695, "relation_name": "raw.claims_preprocessing._int_lab_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Lab' as service_category_2\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 = '81'", "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__lab_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Lab' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code = '81'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__combined_institutional": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__combined_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__combined_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional.sql", "unique_id": "model.the_tuva_project.service_category__combined_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__combined_institutional"], "alias": "_int_combined_institutional", "checksum": {"name": "sha256", "checksum": "8377a660dddc3d14e32abe964be532dac9dd6be19bd7163689d5e51c19db3d4f"}, "config": {"enabled": true, "alias": "_int_combined_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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_combined_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.7945962, "relation_name": "raw.claims_preprocessing._int_combined_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith duplicate_bill_types as (\nselect distinct\n claim_id\n, 'Other' as service_category_2\nfrom {{ ref('service_category__duplicate_bill_types') }}\n)\n\n, combine as (\nselect *\nfrom {{ ref('service_category__acute_inpatient_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__dialysis_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__emergency_department_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__home_health_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__hospice_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__lab_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__outpatient_hospital_or_clinic_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__outpatient_psychiatric_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__skilled_nursing_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__urgent_care_institutional') }}\n)\n\nselect\n claim_id\n, service_category_2\nfrom duplicate_bill_types\n\nunion all\n\nselect\n a.claim_id\n, a.service_category_2\nfrom combine a\nleft join duplicate_bill_types b\n on a.claim_id = b.claim_id\nwhere b.claim_id is null", "language": "sql", "refs": [{"name": "service_category__duplicate_bill_types", "package": null, "version": null}, {"name": "service_category__acute_inpatient_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__hospice_institutional", "package": null, "version": null}, {"name": "service_category__lab_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_hospital_or_clinic_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_psychiatric_institutional", "package": null, "version": null}, {"name": "service_category__skilled_nursing_institutional", "package": null, "version": null}, {"name": "service_category__urgent_care_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__duplicate_bill_types", "model.the_tuva_project.service_category__acute_inpatient_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__hospice_institutional", "model.the_tuva_project.service_category__lab_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__skilled_nursing_institutional", "model.the_tuva_project.service_category__urgent_care_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional.sql", "compiled": true, "compiled_code": "\n\nwith duplicate_bill_types as (\nselect distinct\n claim_id\n, 'Other' as service_category_2\nfrom raw.claims_preprocessing._int_duplicate_bill_types\n)\n\n, combine as (\nselect *\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_dialysis_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_emergency_department_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_home_health_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_hospice_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_lab_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_outpatient_psychiatric_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_skilled_nursing_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_urgent_care_institutional\n)\n\nselect\n claim_id\n, service_category_2\nfrom duplicate_bill_types\n\nunion all\n\nselect\n a.claim_id\n, a.service_category_2\nfrom combine a\nleft join duplicate_bill_types b\n on a.claim_id = b.claim_id\nwhere b.claim_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__urgent_care_institutional": {"database": "raw", "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": "a898cce0b160386f3a8535ff38c663c51149e9bfb6efc42530b126bc204859ae"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.8275561, "relation_name": "raw.claims_preprocessing._int_urgent_care_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n a.claim_id\n, 'Urgent Care' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nleft join {{ ref('service_category__emergency_department_institutional') }} b\n on a.claim_id = b.claim_id\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and left(bill_type_code,2) in ('13','71','73')\n and b.claim_id is null", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__emergency_department_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__emergency_department_institutional"]}, "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 __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n a.claim_id\n, 'Urgent Care' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join raw.claims_preprocessing._int_emergency_department_institutional b\n on a.claim_id = b.claim_id\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and left(bill_type_code,2) in ('13','71','73')\n and b.claim_id is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__acute_inpatient_institutional": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__acute_inpatient_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional.sql", "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__acute_inpatient_institutional"], "alias": "_int_acute_inpatient_institutional", "checksum": {"name": "sha256", "checksum": "102b98bfad308a4b15a56e009424b8cb75e94d87ac512dff9d6b400066ca685c"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.796, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith room_and_board_requirement as (\nselect distinct \n claim_id\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and revenue_center_code in\n ('0100','0101',\n '0110','0111','0112','0113','0114','0116','0117','0118','0119',\n '0120','0121','0122','0123','0124','0126','0127','0128','0129',\n '0130','0131','0132','0133','0134','0136','0137','0138','0139',\n '0140','0141','0142','0143','0144','0146','0147','0148','0149',\n '0150','0151','0152','0153','0154','0156','0157','0158','0159',\n '0160','0164','0167','0169',\n '0170','0171','0172','0173','0174','0179',\n '0190','0191','0192','0193','0194','0199',\n '0200','0201','0202','0203','0204','0206','0207','0208','0209',\n '0210','0211','0212','0213','0214','0219',\n '1000','1001','1002')\n)\n\n, drg_requirement as (\nselect distinct \n mc.claim_id\nfrom {{ ref('service_category__stg_medical_claim') }} mc\nleft join {{ ref('terminology__ms_drg')}} msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\nleft join {{ ref('terminology__apr_drg')}} aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\nwhere claim_type = 'institutional'\n and (msdrg.ms_drg_code is not null or aprdrg.apr_drg_code is not null)\n)\n\n, bill_type_requirement as (\nselect distinct \n claim_id\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('11','12') \n)\n\nselect distinct \n a.claim_id\n, 'Acute Inpatient' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join room_and_board_requirement b\n on a.claim_id = b.claim_id\ninner join drg_requirement c\n on a.claim_id = c.claim_id\ninner join bill_type_requirement d\n on a.claim_id = d.claim_id", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"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}], "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/intermediate/service_category__acute_inpatient_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), room_and_board_requirement as (\nselect distinct \n claim_id\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and revenue_center_code in\n ('0100','0101',\n '0110','0111','0112','0113','0114','0116','0117','0118','0119',\n '0120','0121','0122','0123','0124','0126','0127','0128','0129',\n '0130','0131','0132','0133','0134','0136','0137','0138','0139',\n '0140','0141','0142','0143','0144','0146','0147','0148','0149',\n '0150','0151','0152','0153','0154','0156','0157','0158','0159',\n '0160','0164','0167','0169',\n '0170','0171','0172','0173','0174','0179',\n '0190','0191','0192','0193','0194','0199',\n '0200','0201','0202','0203','0204','0206','0207','0208','0209',\n '0210','0211','0212','0213','0214','0219',\n '1000','1001','1002')\n)\n\n, drg_requirement as (\nselect distinct \n mc.claim_id\nfrom __dbt__cte__service_category__stg_medical_claim mc\nleft join raw.terminology.ms_drg msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\nleft join raw.terminology.apr_drg aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\nwhere claim_type = 'institutional'\n and (msdrg.ms_drg_code is not null or aprdrg.apr_drg_code is not null)\n)\n\n, bill_type_requirement as (\nselect distinct \n claim_id\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('11','12') \n)\n\nselect distinct \n a.claim_id\n, 'Acute Inpatient' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join room_and_board_requirement b\n on a.claim_id = b.claim_id\ninner join drg_requirement c\n on a.claim_id = c.claim_id\ninner join bill_type_requirement d\n on a.claim_id = d.claim_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__office_visit_professional": {"database": "raw", "schema": "claims_preprocessing", "name": "service_category__office_visit_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_visit_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_visit_professional.sql", "unique_id": "model.the_tuva_project.service_category__office_visit_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_visit_professional"], "alias": "_int_office_visit_professional", "checksum": {"name": "sha256", "checksum": "714362d9d5e7713ddc40d1bfff85985858e9dd312724820f6e7ad4196b495c7f"}, "config": {"enabled": true, "alias": "_int_office_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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_office_visit_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708461580.8180852, "relation_name": "raw.claims_preprocessing._int_office_visit_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Office Visit' as service_category_2\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 ('11','02')", "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__office_visit_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Office Visit' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('11','02')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__combined_professional": {"database": "raw", "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": "3d32397613f5bce6e4fc5ec30b388512cf712a18a5e53a3bc1965c4fabbe37f4"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.793372, "relation_name": "raw.claims_preprocessing._int_combined_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith combined as (\nselect *\nfrom {{ ref('service_category__acute_inpatient_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__ambulatory_surgery_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__dialysis_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__emergency_department_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__home_health_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__hospice_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__inpatient_psychiatric_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__inpatient_rehab_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__lab_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__office_visit_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__outpatient_hospital_or_clinic_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__outpatient_psychiatric_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__outpatient_rehab_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__skilled_nursing_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__urgent_care_professional') }}\n)\n\nselect \n claim_id\n, claim_line_number\n, service_category_2\n, tuva_last_run\nfrom {{ ref('service_category__dme_professional') }}\n\nunion all\n\nselect \n a.claim_id\n, a.claim_line_number\n, a.service_category_2\n, a.tuva_last_run\nfrom {{ ref('service_category__ambulance_professional') }} 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 (b.claim_id is null and b.claim_line_number is null)\n\nunion all\n\nselect \n a.claim_id\n, a.claim_line_number\n, a.service_category_2\n, a.tuva_last_run\nfrom combined 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\nleft join {{ ref('service_category__ambulance_professional') }} c\n on a.claim_id = c.claim_id\n and a.claim_line_number = c.claim_line_number\nwhere (b.claim_id is null and b.claim_line_number is null)\n and (c.claim_id is null and c.claim_line_number is null)", "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__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_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__skilled_nursing_professional", "package": null, "version": null}, {"name": "service_category__urgent_care_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__dme_professional", "package": null, "version": null}, {"name": "service_category__dme_professional", "package": null, "version": null}, {"name": "service_category__ambulance_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "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__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_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__skilled_nursing_professional", "model.the_tuva_project.service_category__urgent_care_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__ambulance_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 as (\nselect *\nfrom raw.claims_preprocessing._int_acute_inpatient_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_ambulatory_surgery_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_dialysis_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_emergency_department_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_home_health_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_hospice_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_inpatient_psychiatric_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_inpatient_rehab_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_lab_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_office_visit_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_outpatient_hospital_or_clinic_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_outpatient_psychiatric_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_outpatient_rehab_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_skilled_nursing_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_urgent_care_professional\n)\n\nselect \n claim_id\n, claim_line_number\n, service_category_2\n, tuva_last_run\nfrom raw.claims_preprocessing._int_dme_professional\n\nunion all\n\nselect \n a.claim_id\n, a.claim_line_number\n, a.service_category_2\n, a.tuva_last_run\nfrom raw.claims_preprocessing._int_ambulance_professional a\nleft join raw.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 (b.claim_id is null and b.claim_line_number is null)\n\nunion all\n\nselect \n a.claim_id\n, a.claim_line_number\n, a.service_category_2\n, a.tuva_last_run\nfrom combined a\nleft join raw.claims_preprocessing._int_dme_professional b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\nleft join raw.claims_preprocessing._int_ambulance_professional c\n on a.claim_id = c.claim_id\n and a.claim_line_number = c.claim_line_number\nwhere (b.claim_id is null and b.claim_line_number is null)\n and (c.claim_id is null and c.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__ambulance_professional": {"database": "raw", "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": "9c87f7bd92242edff13bdd35479f6f2c0003d3922e0f684f5a08f25a03af4834"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.799204, "relation_name": "raw.claims_preprocessing._int_ambulance_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Ambulance' as service_category_2\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 'A0425' and 'A0436' or place_of_service_code in ('41','42'))", "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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Ambulance' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and (hcpcs_code between 'A0425' and 'A0436' or place_of_service_code in ('41','42'))", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__outpatient_psychiatric_professional": {"database": "raw", "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": "ce3cd6545a108168c75c03ce898461c83ea7ffc15cdadb089611b74c876452e0"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.822981, "relation_name": "raw.claims_preprocessing._int_outpatient_psychiatric_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Outpatient Psychiatric' as service_category_2\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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Outpatient Psychiatric' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__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": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__emergency_department_institutional": {"database": "raw", "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": "28541b14bd2f5f643cbe8567d6bbc45847512c8743abc6e30fe0f7f0145f6fdd"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.805522, "relation_name": "raw.claims_preprocessing._int_emergency_department_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n med.claim_id\n , 'Emergency Department' as service_category_2\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\nleft join {{ ref('service_category__acute_inpatient_institutional') }} inpatient\n on med.claim_id = inpatient.claim_id\nwhere claim_type = 'institutional'\nand revenue_center_code in ('0450','0451','0452','0459','0981')\nand inpatient.claim_id is null\n-- 0456, urgent care, is included in most published definitions\n-- that also include a requirement of a bill type code for\n-- inpatient or outpatient hospital.", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__acute_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__acute_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 __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n med.claim_id\n , 'Emergency Department' as service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim med\nleft join raw.claims_preprocessing._int_acute_inpatient_institutional inpatient\n on med.claim_id = inpatient.claim_id\nwhere claim_type = 'institutional'\nand revenue_center_code in ('0450','0451','0452','0459','0981')\nand inpatient.claim_id is null\n-- 0456, urgent care, is included in most published definitions\n-- that also include a requirement of a bill type code for\n-- inpatient or outpatient hospital.", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__outpatient_hospital_or_clinic_institutional": {"database": "raw", "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": "38ea9381aea4b8bc59db855cdc3cdb4e3731e51ad89812548f20055947f5d790"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.819299, "relation_name": "raw.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)))\n )\n}}\n\nselect distinct \n a.claim_id\n, 'Outpatient Hospital or Clinic' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nleft join {{ ref('service_category__emergency_department_institutional') }} b\n on a.claim_id = b.claim_id\nleft join {{ ref('service_category__urgent_care_institutional') }} c\n on a.claim_id = c.claim_id\nwhere a.claim_type = 'institutional'\n and left(a.bill_type_code,2) in ('13','71','73')\n and b.claim_id is null\n and c.claim_id is null", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__emergency_department_institutional", "package": null, "version": null}, {"name": "service_category__urgent_care_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__emergency_department_institutional", "model.the_tuva_project.service_category__urgent_care_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 __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n a.claim_id\n, 'Outpatient Hospital or Clinic' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join raw.claims_preprocessing._int_emergency_department_institutional b\n on a.claim_id = b.claim_id\nleft join raw.claims_preprocessing._int_urgent_care_institutional c\n on a.claim_id = c.claim_id\nwhere a.claim_type = 'institutional'\n and left(a.bill_type_code,2) in ('13','71','73')\n and b.claim_id is null\n and c.claim_id is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__outpatient_rehab_professional": {"database": "raw", "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": "756c8e5857e003bbe3dbbbcc7c007d5249eed2ecc7efd2c1b45d4fd80a19348e"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.824106, "relation_name": "raw.claims_preprocessing._int_outpatient_rehab_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Outpatient Rehabilitation' as service_category_2\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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Outpatient Rehabilitation' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('62')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__outpatient_psychiatric_institutional": {"database": "raw", "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": "1ead303ca265ac69f58db45dc1775dc9ffc31afb44832c946a7352d9577be5fe"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.821701, "relation_name": "raw.claims_preprocessing._int_outpatient_psychiatric_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Outpatient Psychiatric' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('52')", "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_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Outpatient Psychiatric' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('52')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.service_category__acute_inpatient_professional": {"database": "raw", "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": "e9bab19d3e02d461a0c3eaa360c38fdf7b386a92891d50701b326e976e9d0e58"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708461580.797791, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct\n claim_id\n, claim_line_number\n, 'Acute Inpatient' as service_category_2\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 = '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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct\n claim_id\n, claim_line_number\n, 'Acute Inpatient' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code = '21'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.acute_inpatient__stg_medical_claim": {"database": "raw", "schema": "jaffle_shop", "name": "acute_inpatient__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_medical_claim.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "staging", "acute_inpatient__stg_medical_claim"], "alias": "acute_inpatient__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "df60d74ac5218cec27b0cd8cac92064235e947bc335535e222c9316fd0d77533"}, "config": {"enabled": true, "alias": "acute_inpatient__stg_medical_claim", "schema": null, "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "acute_inpatient__stg_medical_claim", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.775846, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }}", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.acute_inpatient__stg_service_category": {"database": "raw", "schema": "jaffle_shop", "name": "acute_inpatient__stg_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_service_category.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_service_category.sql", "unique_id": "model.the_tuva_project.acute_inpatient__stg_service_category", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "staging", "acute_inpatient__stg_service_category"], "alias": "acute_inpatient__stg_service_category", "checksum": {"name": "sha256", "checksum": "2209519a82d2ab3d0f216a7634d07152514384339013c7fed208cffecb3646d3"}, "config": {"enabled": true, "alias": "acute_inpatient__stg_service_category", "schema": null, "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "acute_inpatient__stg_service_category", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.776549, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__service_category_grouper')}}", "language": "sql", "refs": [{"name": "service_category__service_category_grouper", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__service_category_grouper"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_service_category.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper", "extra_ctes_injected": true, "extra_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__stg_eligibility": {"database": "raw", "schema": "jaffle_shop", "name": "acute_inpatient__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_eligibility.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_eligibility.sql", "unique_id": "model.the_tuva_project.acute_inpatient__stg_eligibility", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "staging", "acute_inpatient__stg_eligibility"], "alias": "acute_inpatient__stg_eligibility", "checksum": {"name": "sha256", "checksum": "da19d68fb195a59a154da1c1138ac88b33b7b8472f808d7adbb7f34ca199ae9d"}, "config": {"enabled": true, "alias": "acute_inpatient__stg_eligibility", "schema": null, "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "acute_inpatient__stg_eligibility", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.775129, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n patient_id\n , birth_date\n , gender\n , race\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": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , birth_date\n , gender\n , race\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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.acute_inpatient__summary": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/final/acute_inpatient__summary.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/final/acute_inpatient__summary.sql", "unique_id": "model.the_tuva_project.acute_inpatient__summary", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "final", "acute_inpatient__summary"], "alias": "acute_inpatient_summary", "checksum": {"name": "sha256", "checksum": "2c7134e1d4bb9293da6cc7b6949924a8ca43abfd1ead18ac20b442d0fdaa02c3"}, "config": {"enabled": true, "alias": "acute_inpatient_summary", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "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 the acute inpatient encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the patient was admitted.", "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": []}, "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 as of their admission date.", "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 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": []}, "facility_npi": {"name": "facility_npi", "description": "The NPI for the facility where the encounter occurred.", "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": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "The MS-DRG code 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": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "The MS-DRG description associted with the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "Indicates whether the MS-DRG is medical or surgical in nature.", "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": "The APR-DRG code associted with the inpatient visit", "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": "The APR-DRG description associted with the inpatient visit", "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": "Admission source description 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": "Admission type description 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": "Discharge disposition description for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total paid amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total allowed amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total charge amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "The length of stay for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "1 if a patient died during the encounter, 0 otherwise.", "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\").", "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": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "acute_inpatient_summary", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.760212, "relation_name": "raw.claims_preprocessing.acute_inpatient_summary", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith distinct_encounters as (\n select distinct\n a.encounter_id\n , a.patient_id\n , b.encounter_start_date\n , b.encounter_end_date\nfrom {{ ref('acute_inpatient__encounter_id') }} a\ninner join {{ ref('acute_inpatient__encounter_start_and_end_dates') }} b\n on a.encounter_id = b.encounter_id\n)\n\n, institutional_claim_details as (\n select\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi as facility_npi\n , first.ms_drg_code as ms_drg_code\n , first.apr_drg_code as apr_drg_code\n , first.admit_source_code as admit_source_code\n , first.admit_type_code as admit_type_code\n , last.discharge_disposition_code as discharge_disposition_code\n , sum(paid_amount) as inst_paid_amount\n , sum(allowed_amount) as inst_allowed_amount\n , sum(charge_amount) as inst_charge_amount\n , max(data_source) as data_source\n from {{ ref('medical_claim') }} a\n inner join {{ ref('acute_inpatient__encounter_id') }} b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'institutional'\n inner join {{ ref('acute_inpatient__first_claim_values') }} first\n on b.encounter_id = first.encounter_id\n and first.claim_row = 1\n inner join {{ ref('acute_inpatient__last_claim_values') }} last\n on b.encounter_id = last.encounter_id\n and last.claim_row = 1\n group by\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi\n , first.ms_drg_code\n , first.apr_drg_code\n , first.admit_source_code\n , first.admit_type_code\n , last.discharge_disposition_code\n)\n\n, professional_claim_details as (\n select\n b.encounter_id\n , sum(paid_amount) as prof_paid_amount\n , sum(allowed_amount) as prof_allowed_amount\n , sum(charge_amount) as prof_charge_amount\n from {{ ref('acute_inpatient__stg_medical_claim') }} a\n inner join {{ ref('acute_inpatient__encounter_id') }} b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'professional'\ngroup by 1\n)\n\n, patient as (\n select distinct\n patient_id\n , birth_date\n , gender\n , race\n from {{ ref('acute_inpatient__stg_eligibility') }}\n )\n\n, provider as (\n select\n a.encounter_id\n , max(a.facility_npi) as facility_npi\n , b.provider_first_name\n , b.provider_last_name\n , count(distinct facility_npi) as npi_count\n from {{ ref('acute_inpatient__institutional_encounter_id') }} a\n left join {{ ref('terminology__provider') }} b\n on a.facility_npi = b.npi\n group by 1,3,4\n)\n\nselect\n a.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, a.patient_id\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.description, icd9cm.long_description) as primary_diagnosis_description\n, f.facility_npi\n, f.provider_first_name\n, f.provider_last_name\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, c.inst_paid_amount + coalesce(d.prof_paid_amount,0) as total_paid_amount\n, c.inst_allowed_amount + coalesce(d.prof_allowed_amount,0) as total_allowed_amount\n, c.inst_charge_amount + coalesce(d.prof_charge_amount,0) as total_charge_amount\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, data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom distinct_encounters a\nleft join institutional_claim_details c\n on a.encounter_id = c.encounter_id\nleft join professional_claim_details d\n on a.encounter_id = d.encounter_id\nleft join patient e\n on a.patient_id = e.patient_id\nleft join provider f\n on a.encounter_id = f.encounter_id\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": "acute_inpatient__encounter_id", "package": null, "version": null}, {"name": "acute_inpatient__encounter_start_and_end_dates", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "acute_inpatient__encounter_id", "package": null, "version": null}, {"name": "acute_inpatient__first_claim_values", "package": null, "version": null}, {"name": "acute_inpatient__last_claim_values", "package": null, "version": null}, {"name": "acute_inpatient__stg_medical_claim", "package": null, "version": null}, {"name": "acute_inpatient__encounter_id", "package": null, "version": null}, {"name": "acute_inpatient__stg_eligibility", "package": null, "version": null}, {"name": "acute_inpatient__institutional_encounter_id", "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.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.input_layer.medical_claim", "model.the_tuva_project.acute_inpatient__first_claim_values", "model.the_tuva_project.acute_inpatient__last_claim_values", "model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__stg_eligibility", "model.the_tuva_project.acute_inpatient__institutional_encounter_id", "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/acute_inpatient/final/acute_inpatient__summary.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), __dbt__cte__acute_inpatient__stg_eligibility as (\n\n\nselect\n patient_id\n , birth_date\n , gender\n , race\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_eligibility\n), distinct_encounters as (\n select distinct\n a.encounter_id\n , a.patient_id\n , b.encounter_start_date\n , b.encounter_end_date\nfrom raw.claims_preprocessing._int_acute_inpatient_encounter_id a\ninner join raw.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates b\n on a.encounter_id = b.encounter_id\n)\n\n, institutional_claim_details as (\n select\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi as facility_npi\n , first.ms_drg_code as ms_drg_code\n , first.apr_drg_code as apr_drg_code\n , first.admit_source_code as admit_source_code\n , first.admit_type_code as admit_type_code\n , last.discharge_disposition_code as discharge_disposition_code\n , sum(paid_amount) as inst_paid_amount\n , sum(allowed_amount) as inst_allowed_amount\n , sum(charge_amount) as inst_charge_amount\n , max(data_source) as data_source\n from tuva.input_layer.medical_claim a\n inner join raw.claims_preprocessing._int_acute_inpatient_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'institutional'\n inner join raw.claims_preprocessing._int_acute_inpatient_first_claim_values first\n on b.encounter_id = first.encounter_id\n and first.claim_row = 1\n inner join raw.claims_preprocessing._int_acute_inpatient_last_claim_values last\n on b.encounter_id = last.encounter_id\n and last.claim_row = 1\n group by\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi\n , first.ms_drg_code\n , first.apr_drg_code\n , first.admit_source_code\n , first.admit_type_code\n , last.discharge_disposition_code\n)\n\n, professional_claim_details as (\n select\n b.encounter_id\n , sum(paid_amount) as prof_paid_amount\n , sum(allowed_amount) as prof_allowed_amount\n , sum(charge_amount) as prof_charge_amount\n from __dbt__cte__acute_inpatient__stg_medical_claim a\n inner join raw.claims_preprocessing._int_acute_inpatient_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'professional'\ngroup by 1\n)\n\n, patient as (\n select distinct\n patient_id\n , birth_date\n , gender\n , race\n from __dbt__cte__acute_inpatient__stg_eligibility\n )\n\n, provider as (\n select\n a.encounter_id\n , max(a.facility_npi) as facility_npi\n , b.provider_first_name\n , b.provider_last_name\n , count(distinct facility_npi) as npi_count\n from raw.claims_preprocessing._int_acute_inpatient_institutional_encounter_id a\n left join raw.terminology.provider b\n on a.facility_npi = b.npi\n group by 1,3,4\n)\n\nselect\n a.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, a.patient_id\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.description, icd9cm.long_description) as primary_diagnosis_description\n, f.facility_npi\n, f.provider_first_name\n, f.provider_last_name\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, c.inst_paid_amount + coalesce(d.prof_paid_amount,0) as total_paid_amount\n, c.inst_allowed_amount + coalesce(d.prof_allowed_amount,0) as total_allowed_amount\n, c.inst_charge_amount + coalesce(d.prof_charge_amount,0) as total_charge_amount\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, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom distinct_encounters a\nleft join institutional_claim_details c\n on a.encounter_id = c.encounter_id\nleft join professional_claim_details d\n on a.encounter_id = d.encounter_id\nleft join patient e\n on a.patient_id = e.patient_id\nleft join provider f\n on a.encounter_id = f.encounter_id\nleft join raw.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join raw.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join raw.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join raw.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join raw.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join raw.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 raw.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": [{"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n)"}, {"id": "model.the_tuva_project.acute_inpatient__stg_eligibility", "sql": " __dbt__cte__acute_inpatient__stg_eligibility as (\n\n\nselect\n patient_id\n , birth_date\n , gender\n , race\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.acute_inpatient__professional_encounter_id": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__professional_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__professional_encounter_id.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__professional_encounter_id.sql", "unique_id": "model.the_tuva_project.acute_inpatient__professional_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__professional_encounter_id"], "alias": "_int_acute_inpatient_professional_encounter_id", "checksum": {"name": "sha256", "checksum": "a400d2dacc8d1a91a34cb8db6f87b3f09c43b95f74e863f42485cccae09ef773"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_professional_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Assigns encounter_id to every acute inpatient professional claim", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_professional_encounter_id", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.7678232, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_professional_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model assigns professional acute inpatient\n-- claims to acute inpatient encounters.\n-- Some acute inpatient professional claims do not fall\n-- within an acute inpatient encounter. We call these\n-- orphan claims, and they do not have an encounter_id.\n-- Some acute inpatient professional claims fall within\n-- more than one acute inpatient encounter. Since we do not\n-- know what encounter these claims should be mapped to\n-- we do not assign them an encounter_id. These claims\n-- have encounter_count > 1.\n-- This model returns a table with 5 fields:\n-- patient_id\n-- claim_id\n-- encounter_id (is null for orphan claims or claims\n-- that fall within more than one encounter)\n-- orphan_claim_flag (is always 0 or 1)\n-- encounter_count (an integer that represents the number\n-- of acute inpatient encounters this\n-- professional claim could fall into:\n-- could be 0,1,2,3,... but is never null\n-- for acute inpatient professional claims)\n-- *************************************************\n\n\n\n\nwith acute_inpatient_professional_claim_ids as (\nselect distinct \n claim_id\n , claim_line_number\nfrom {{ ref('acute_inpatient__stg_service_category') }} \nwhere claim_type = 'professional'\n and service_category_2 = 'Acute Inpatient'\n),\n\nacute_inpatient_professional_claim_lines as (\nselect\n mc.claim_id,\n mc.claim_line_number,\n mc.patient_id,\n mc.claim_start_date as start_date,\n mc.claim_end_date as end_date\t \nfrom {{ ref('acute_inpatient__stg_medical_claim') }} mc\ninner join acute_inpatient_professional_claim_ids prof\n on mc.claim_id = prof.claim_id\n and mc.claim_line_number = prof.claim_line_number\n),\n\n\nacute_inpatient_professional_claim_dates as (\nselect\n claim_id,\n claim_line_number,\n patient_id,\n min(start_date) as start_date,\n max(end_date) as end_date\nfrom acute_inpatient_professional_claim_lines\ngroup by claim_id, claim_line_number, patient_id\n),\n\n\nroll_up_professional_claims_to_institutional_claims as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n bb.encounter_id,\n case\n when bb.encounter_id is null then 1\n else 0\n end as orphan_claim_flag\nfrom acute_inpatient_professional_claim_dates aa\nleft join {{ ref('acute_inpatient__encounter_start_and_end_dates') }} bb\n on aa.patient_id = bb.patient_id\n and (coalesce(aa.start_date, aa.end_date) between bb.encounter_start_date and bb.encounter_end_date)\n and (coalesce(aa.end_date, aa.start_date) between bb.encounter_start_date and bb.encounter_end_date)\n),\n\nprofessional_claims_in_more_than_one_encounter as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n min(start_date) as start_date,\n max(end_date) as end_date,\n count(distinct encounter_id) as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims\ngroup by patient_id, claim_line_number, claim_id\nhaving count(distinct encounter_id) > 1\n),\n\n\nprofessional_claims_not_in_more_than_one_encounter as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.orphan_claim_flag,\n case\n when (aa.orphan_claim_flag = 1) then 0\n else 1\n end as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims aa\nleft join professional_claims_in_more_than_one_encounter bb\non aa.claim_id = bb.claim_id\nand aa.claim_line_number = bb.claim_line_number\nand aa.patient_id = bb.patient_id\nwhere (bb.patient_id is null) and (bb.claim_id is null)\n),\n\n\nall_acute_inpatient_professional_claims as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n encounter_id,\n orphan_claim_flag,\n encounter_count\nfrom professional_claims_not_in_more_than_one_encounter\n\nunion all\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n null as encounter_id,\n 0 as orphan_claim_count,\n encounter_count\nfrom professional_claims_in_more_than_one_encounter\n)\n\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom all_acute_inpatient_professional_claims", "language": "sql", "refs": [{"name": "acute_inpatient__stg_service_category", "package": null, "version": null}, {"name": "acute_inpatient__stg_medical_claim", "package": null, "version": null}, {"name": "acute_inpatient__encounter_start_and_end_dates", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__stg_service_category", "model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__professional_encounter_id.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model assigns professional acute inpatient\n-- claims to acute inpatient encounters.\n-- Some acute inpatient professional claims do not fall\n-- within an acute inpatient encounter. We call these\n-- orphan claims, and they do not have an encounter_id.\n-- Some acute inpatient professional claims fall within\n-- more than one acute inpatient encounter. Since we do not\n-- know what encounter these claims should be mapped to\n-- we do not assign them an encounter_id. These claims\n-- have encounter_count > 1.\n-- This model returns a table with 5 fields:\n-- patient_id\n-- claim_id\n-- encounter_id (is null for orphan claims or claims\n-- that fall within more than one encounter)\n-- orphan_claim_flag (is always 0 or 1)\n-- encounter_count (an integer that represents the number\n-- of acute inpatient encounters this\n-- professional claim could fall into:\n-- could be 0,1,2,3,... but is never null\n-- for acute inpatient professional claims)\n-- *************************************************\n\n\n\n\nwith __dbt__cte__acute_inpatient__stg_service_category as (\n\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n), __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), acute_inpatient_professional_claim_ids as (\nselect distinct \n claim_id\n , claim_line_number\nfrom __dbt__cte__acute_inpatient__stg_service_category \nwhere claim_type = 'professional'\n and service_category_2 = 'Acute Inpatient'\n),\n\nacute_inpatient_professional_claim_lines as (\nselect\n mc.claim_id,\n mc.claim_line_number,\n mc.patient_id,\n mc.claim_start_date as start_date,\n mc.claim_end_date as end_date\t \nfrom __dbt__cte__acute_inpatient__stg_medical_claim mc\ninner join acute_inpatient_professional_claim_ids prof\n on mc.claim_id = prof.claim_id\n and mc.claim_line_number = prof.claim_line_number\n),\n\n\nacute_inpatient_professional_claim_dates as (\nselect\n claim_id,\n claim_line_number,\n patient_id,\n min(start_date) as start_date,\n max(end_date) as end_date\nfrom acute_inpatient_professional_claim_lines\ngroup by claim_id, claim_line_number, patient_id\n),\n\n\nroll_up_professional_claims_to_institutional_claims as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n bb.encounter_id,\n case\n when bb.encounter_id is null then 1\n else 0\n end as orphan_claim_flag\nfrom acute_inpatient_professional_claim_dates aa\nleft join raw.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates bb\n on aa.patient_id = bb.patient_id\n and (coalesce(aa.start_date, aa.end_date) between bb.encounter_start_date and bb.encounter_end_date)\n and (coalesce(aa.end_date, aa.start_date) between bb.encounter_start_date and bb.encounter_end_date)\n),\n\nprofessional_claims_in_more_than_one_encounter as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n min(start_date) as start_date,\n max(end_date) as end_date,\n count(distinct encounter_id) as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims\ngroup by patient_id, claim_line_number, claim_id\nhaving count(distinct encounter_id) > 1\n),\n\n\nprofessional_claims_not_in_more_than_one_encounter as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.orphan_claim_flag,\n case\n when (aa.orphan_claim_flag = 1) then 0\n else 1\n end as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims aa\nleft join professional_claims_in_more_than_one_encounter bb\non aa.claim_id = bb.claim_id\nand aa.claim_line_number = bb.claim_line_number\nand aa.patient_id = bb.patient_id\nwhere (bb.patient_id is null) and (bb.claim_id is null)\n),\n\n\nall_acute_inpatient_professional_claims as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n encounter_id,\n orphan_claim_flag,\n encounter_count\nfrom professional_claims_not_in_more_than_one_encounter\n\nunion all\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n null as encounter_id,\n 0 as orphan_claim_count,\n encounter_count\nfrom professional_claims_in_more_than_one_encounter\n)\n\n\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom all_acute_inpatient_professional_claims", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.acute_inpatient__stg_service_category", "sql": " __dbt__cte__acute_inpatient__stg_service_category as (\n\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n)"}, {"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.acute_inpatient__last_claim_values": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__last_claim_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__last_claim_values.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__last_claim_values.sql", "unique_id": "model.the_tuva_project.acute_inpatient__last_claim_values", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__last_claim_values"], "alias": "_int_acute_inpatient_last_claim_values", "checksum": {"name": "sha256", "checksum": "244ee5c82b9ccafe2076fb6158f207ecfe83137d4cdab3a1bb6dee7636d29e4c"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_last_claim_values", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Orders claims to pull out encounter details (admit type, drg, etc)", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_last_claim_values", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.774274, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_last_claim_values", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith first_claim_values as(\r\n select distinct\r\n e.encounter_id\r\n , coalesce(claim_start_date, admission_date) as claim_start\r\n , discharge_disposition_code\r\n from {{ ref('acute_inpatient__encounter_id')}} e\r\n inner join {{ ref('acute_inpatient__stg_medical_claim') }} m\r\n on e.claim_id = m.claim_id\r\n where claim_type = 'institutional'\r\n)\r\n\r\nselect\r\n encounter_id\r\n , claim_start\r\n , discharge_disposition_code\r\n , row_number() over (partition by encounter_id order by claim_start desc) as claim_row\r\nfrom first_claim_values", "language": "sql", "refs": [{"name": "acute_inpatient__encounter_id", "package": null, "version": null}, {"name": "acute_inpatient__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__last_claim_values.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , discharge_disposition_code\n from raw.claims_preprocessing._int_acute_inpatient_encounter_id e\n inner join __dbt__cte__acute_inpatient__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , discharge_disposition_code\n , row_number() over (partition by encounter_id order by claim_start desc) as claim_row\nfrom first_claim_values", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.acute_inpatient__encounter_data_for_medical_claims": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__encounter_data_for_medical_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_data_for_medical_claims.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_data_for_medical_claims.sql", "unique_id": "model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__encounter_data_for_medical_claims"], "alias": "_int_encounter_data_for_medical_claims", "checksum": {"name": "sha256", "checksum": "87c3d7187fb51e55517aea4b56fe8970614c2c1289502d5dba0b73df9a129e1c"}, "config": {"enabled": true, "alias": "_int_encounter_data_for_medical_claims", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "All encounter-related fields that will be added to medical_claim", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_encounter_data_for_medical_claims", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.77182, "relation_name": "raw.claims_preprocessing._int_encounter_data_for_medical_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model returns all the columns with relevant\n-- encounter fields that we will append to the medical_claim\n-- table.\n\n-- It returns a table with these columns:\n-- patient_id\n-- claim_id\n-- encounter_type\n-- encounter_id\n-- start_date (date used for merging claims into encounters)\n-- end_date (date used for merging claims into encounters)\n-- encounter_start_date,\n-- encounter_end_date,\n-- encounter_admit_source_code,\n-- encounter_admit_type_code,\n-- encounter_discharge_disposition_code\n-- orphan_claim_flag (always 0 or 1) (never null)\n-- encounter_count (could be 0,1,2,3,...) (never null)\n-- *************************************************\n\n\n\n\nwith acute_inpatient_claims_with_encounter_id as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date, \n-- Relevant encounter-level fields for\n-- professional and institutional acute inpatient\n-- claims that are assigned to an encounter:\n 'acute inpatient' as encounter_type,\n encounter_id,\n encounter_start_date,\n encounter_end_date,\n encounter_admit_source_code,\n encounter_admit_type_code,\n encounter_discharge_disposition_code,\n-- Fields that are only relevant for professional\n-- acute inpatient claims that are not assigned to\n-- an encounter because they are orphan claims or because\n-- they overlap with more than one encounter:\n 0 as orphan_claim_flag,\n 1 as encounter_count\nfrom {{ ref('acute_inpatient__claims_with_encounter_data') }}\n),\n\n\nacute_inpatient_claims_without_encounter_id as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date, \n-- Relevant encounter-level fields for\n-- professional and institutional acute inpatient\n-- claims that are assigned to an encounter:\n 'acute inpatient' encounter_type,\n cast(null as {{ dbt.type_string() }}) as encounter_id,\n cast(null as date) as encounter_start_date,\n cast(null as date) as encounter_end_date,\n cast(null as {{ dbt.type_string() }}) as encounter_admit_source_code,\n cast(null as {{ dbt.type_string() }}) as encounter_admit_type_code,\n cast(null as {{ dbt.type_string() }}) as encounter_discharge_disposition_code,\n-- Fields that are only relevant for professional\n-- acute inpatient claims that are not assigned to\n-- an encounter because they are orphan claims or because\n-- they overlap with more than one encounter:\n orphan_claim_flag,\n encounter_count\n \nfrom {{ ref('acute_inpatient__professional_encounter_id') }}\nwhere (orphan_claim_flag = 1) or (encounter_count > 1)\n)\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom acute_inpatient_claims_with_encounter_id\n\nunion all\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom acute_inpatient_claims_without_encounter_id", "language": "sql", "refs": [{"name": "acute_inpatient__claims_with_encounter_data", "package": null, "version": null}, {"name": "acute_inpatient__professional_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "model.the_tuva_project.acute_inpatient__professional_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_data_for_medical_claims.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model returns all the columns with relevant\n-- encounter fields that we will append to the medical_claim\n-- table.\n\n-- It returns a table with these columns:\n-- patient_id\n-- claim_id\n-- encounter_type\n-- encounter_id\n-- start_date (date used for merging claims into encounters)\n-- end_date (date used for merging claims into encounters)\n-- encounter_start_date,\n-- encounter_end_date,\n-- encounter_admit_source_code,\n-- encounter_admit_type_code,\n-- encounter_discharge_disposition_code\n-- orphan_claim_flag (always 0 or 1) (never null)\n-- encounter_count (could be 0,1,2,3,...) (never null)\n-- *************************************************\n\n\n\n\nwith acute_inpatient_claims_with_encounter_id as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date, \n-- Relevant encounter-level fields for\n-- professional and institutional acute inpatient\n-- claims that are assigned to an encounter:\n 'acute inpatient' as encounter_type,\n encounter_id,\n encounter_start_date,\n encounter_end_date,\n encounter_admit_source_code,\n encounter_admit_type_code,\n encounter_discharge_disposition_code,\n-- Fields that are only relevant for professional\n-- acute inpatient claims that are not assigned to\n-- an encounter because they are orphan claims or because\n-- they overlap with more than one encounter:\n 0 as orphan_claim_flag,\n 1 as encounter_count\nfrom raw.claims_preprocessing._int_acute_inpatient_claims_with_encounter_data\n),\n\n\nacute_inpatient_claims_without_encounter_id as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date, \n-- Relevant encounter-level fields for\n-- professional and institutional acute inpatient\n-- claims that are assigned to an encounter:\n 'acute inpatient' encounter_type,\n cast(null as TEXT) as encounter_id,\n cast(null as date) as encounter_start_date,\n cast(null as date) as encounter_end_date,\n cast(null as TEXT) as encounter_admit_source_code,\n cast(null as TEXT) as encounter_admit_type_code,\n cast(null as TEXT) as encounter_discharge_disposition_code,\n-- Fields that are only relevant for professional\n-- acute inpatient claims that are not assigned to\n-- an encounter because they are orphan claims or because\n-- they overlap with more than one encounter:\n orphan_claim_flag,\n encounter_count\n \nfrom raw.claims_preprocessing._int_acute_inpatient_professional_encounter_id\nwhere (orphan_claim_flag = 1) or (encounter_count > 1)\n)\n\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom acute_inpatient_claims_with_encounter_id\n\nunion all\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom acute_inpatient_claims_without_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__data_quality_summary": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__data_quality_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__data_quality_summary.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__data_quality_summary.sql", "unique_id": "model.the_tuva_project.acute_inpatient__data_quality_summary", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__data_quality_summary"], "alias": "_int_acute_inpatient_data_quality_summary", "checksum": {"name": "sha256", "checksum": "ab984a6c67134b7a212088a5bf4405705552af01c04ee582ccee477092557c27"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_data_quality_summary", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Summary of data quality issues with acute inpatient claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_data_quality_summary", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.763734, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_data_quality_summary", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model summarizes data quality issues\n-- that could affect claims preprocessing.\n-- The table returns 2 fields:\n-- field\n-- total_count\n--\n-- If we order the results by 'field', the first\n-- 3 rows give us a high level summary:\n--\n-- 01 Total acute inpatient institutional claims:\n-- This is the total number of acute inpatient\n-- institutional claims\n-- 02 Acute inpatient institutional claims with insights:\n-- This is the number of acute inpatient institutional\n-- claims for which something is not ideal (e.g. they\n-- are missing a claim_start_date) but it's not something\n-- that prevents the claim from being used in the\n-- encounter grouper.\n\n-- 03 Acute inpatient institutional claims with problems:\n-- This is the number of acute inpatient institutional\n-- claims that have a data quality problem that\n-- prevents them from being used in the encounter grouper.\n\n-- The rest of the rows in the table give us counts\n-- of the number of acute inpatient institutional claims\n-- that have specific data quality problems.\n-- *************************************************\n\n\n\n\nwith total_acute_inpatient__institutional_claims as (\nselect\n '01 Total acute inpatient institutional claims' as field,\n count(*) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\ntotal_claims_with_insights as (\nselect\n '02 Acute inpatient institutional claims with insights' as field,\n count(*) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\nwhere dq_insight = 1\n),\n\n\ntotal_claims_with_problems as (\nselect\n '03 Acute inpatient institutional claims with problems' as field,\n count(*) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\nwhere dq_problem = 1\n),\n\n\npatient_id_not_unique as (\nselect\n '04 patient_id_not_unique' as field,\n sum(patient_id_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\npatient_id_missing as (\nselect\n '05 patient_id_missing' as field,\n sum(patient_id_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_start_date_not_unique as (\nselect\n '06 claim_start_date_not_unique' as field,\n sum(claim_start_date_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_start_date_missing as (\nselect\n '07 claim_start_date_missing' as field,\n sum(claim_start_date_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_end_date_not_unique as (\nselect\n '08 claim_end_date_not_unique' as field,\n sum(claim_end_date_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_end_date_missing as (\nselect\n '09 claim_end_date_missing' as field,\n sum(claim_end_date_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_start_date_after_claim_end_date as (\nselect\n '10 claim_start_date_after_claim_end_date' as field,\n sum(claim_start_date_after_claim_end_date) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmission_date_not_unique as (\nselect\n '11 admission_date_not_unique' as field,\n sum(admission_date_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmission_date_missing as (\nselect\n '12 admission_date_missing' as field,\n sum(admission_date_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\ndischarge_date_not_unique as (\nselect\n '13 discharge_date_not_unique' as field,\n sum(discharge_date_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\ndischarge_date_missing as (\nselect\n '14 discharge_date_missing' as field,\n sum(discharge_date_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmission_date_after_discharge_date as (\nselect\n '15 admission_date_after_discharge_date' as field,\n sum(admission_date_after_discharge_date) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmit_type_code_not_unique as (\nselect\n '16 admit_type_code_not_unique' as field,\n sum(admit_type_code_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmit_type_code_missing as (\nselect\n '17 admit_type_code_missing' as field,\n sum(admit_type_code_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmit_source_code_not_unique as (\nselect\n '18 admit_source_code_not_unique' as field,\n sum(admit_source_code_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmit_source_code_missing as (\nselect\n '19 admit_source_code_missing' as field,\n sum(admit_source_code_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\ndischarge_disposition_code_not_unique as (\nselect\n '20 discharge_disposition_code_not_unique' as field,\n sum(discharge_disposition_code_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\ndischarge_disposition_code_missing as (\nselect\n '21 discharge_disposition_code_missing' as field,\n sum(discharge_disposition_code_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nfacility_npi_not_unique as (\nselect\n '22 facility_npi_not_unique' as field,\n sum(facility_npi_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nfacility_npi_missing as (\nselect\n '23 facility_npi_missing' as field,\n sum(facility_npi_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_type_not_unique as (\nselect\n '24 claim_type_not_unique' as field,\n sum(claim_type_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_type_missing as (\nselect\n '25 claim_type_missing' as field,\n sum(claim_type_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_type_not_institutional as (\nselect\n '26 claim_type_not_institutional' as field,\n sum(claim_type_not_institutional) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nstart_date_not_determined as (\nselect\n '27 start_date_not_determined' as field,\n sum(start_date_not_determined) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nend_date_not_determined as (\nselect\n '28 end_date_not_determined' as field,\n sum(end_date_not_determined) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nstart_date_after_end_date as (\nselect\n '29 start_date_after_end_date' as field,\n sum(start_date_after_end_date) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\n\nunion_cte as (\nselect *\nfrom total_acute_inpatient__institutional_claims\n\nunion all\n\nselect *\nfrom total_claims_with_insights\n\nunion all\n\nselect *\nfrom total_claims_with_problems\n\nunion all\n\nselect *\nfrom patient_id_not_unique\n\nunion all\n\nselect *\nfrom patient_id_missing\n\nunion all\n\nselect *\nfrom claim_start_date_not_unique\n\nunion all\n\nselect *\nfrom claim_start_date_missing\n\nunion all\n\nselect *\nfrom claim_end_date_not_unique\n\nunion all\n\nselect *\nfrom claim_end_date_missing\n\nunion all\n\nselect *\nfrom claim_start_date_after_claim_end_date\n\nunion all\n\nselect *\nfrom admission_date_not_unique\n\nunion all\n\nselect *\nfrom admission_date_missing\n\nunion all\n\nselect *\nfrom discharge_date_not_unique\n\nunion all\n\nselect *\nfrom discharge_date_missing\n\nunion all\n\nselect *\nfrom admission_date_after_discharge_date\n\nunion all\n\nselect *\nfrom admit_type_code_not_unique\n\nunion all\n\nselect *\nfrom admit_type_code_missing\n\nunion all\n\nselect *\nfrom admit_source_code_not_unique\n\nunion all\n\nselect *\nfrom admit_source_code_missing\n\nunion all\n\nselect *\nfrom discharge_disposition_code_not_unique\n\nunion all\n\nselect *\nfrom discharge_disposition_code_missing\n\nunion all\n\nselect *\nfrom facility_npi_not_unique\n\nunion all\n\nselect *\nfrom facility_npi_missing\n\nunion all\n\nselect *\nfrom claim_type_not_unique\n\nunion all\n\nselect *\nfrom claim_type_missing\n\nunion all\n\nselect *\nfrom claim_type_not_institutional\n\nunion all\n\nselect *\nfrom start_date_not_determined\n\nunion all\n\nselect *\nfrom end_date_not_determined\n\nunion all\n\nselect *\nfrom start_date_after_end_date\n)\n\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_claims", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__institutional_claims"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__data_quality_summary.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model summarizes data quality issues\n-- that could affect claims preprocessing.\n-- The table returns 2 fields:\n-- field\n-- total_count\n--\n-- If we order the results by 'field', the first\n-- 3 rows give us a high level summary:\n--\n-- 01 Total acute inpatient institutional claims:\n-- This is the total number of acute inpatient\n-- institutional claims\n-- 02 Acute inpatient institutional claims with insights:\n-- This is the number of acute inpatient institutional\n-- claims for which something is not ideal (e.g. they\n-- are missing a claim_start_date) but it's not something\n-- that prevents the claim from being used in the\n-- encounter grouper.\n\n-- 03 Acute inpatient institutional claims with problems:\n-- This is the number of acute inpatient institutional\n-- claims that have a data quality problem that\n-- prevents them from being used in the encounter grouper.\n\n-- The rest of the rows in the table give us counts\n-- of the number of acute inpatient institutional claims\n-- that have specific data quality problems.\n-- *************************************************\n\n\n\n\nwith total_acute_inpatient__institutional_claims as (\nselect\n '01 Total acute inpatient institutional claims' as field,\n count(*) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ntotal_claims_with_insights as (\nselect\n '02 Acute inpatient institutional claims with insights' as field,\n count(*) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\nwhere dq_insight = 1\n),\n\n\ntotal_claims_with_problems as (\nselect\n '03 Acute inpatient institutional claims with problems' as field,\n count(*) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\nwhere dq_problem = 1\n),\n\n\npatient_id_not_unique as (\nselect\n '04 patient_id_not_unique' as field,\n sum(patient_id_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\npatient_id_missing as (\nselect\n '05 patient_id_missing' as field,\n sum(patient_id_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_start_date_not_unique as (\nselect\n '06 claim_start_date_not_unique' as field,\n sum(claim_start_date_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_start_date_missing as (\nselect\n '07 claim_start_date_missing' as field,\n sum(claim_start_date_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_end_date_not_unique as (\nselect\n '08 claim_end_date_not_unique' as field,\n sum(claim_end_date_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_end_date_missing as (\nselect\n '09 claim_end_date_missing' as field,\n sum(claim_end_date_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_start_date_after_claim_end_date as (\nselect\n '10 claim_start_date_after_claim_end_date' as field,\n sum(claim_start_date_after_claim_end_date) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmission_date_not_unique as (\nselect\n '11 admission_date_not_unique' as field,\n sum(admission_date_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmission_date_missing as (\nselect\n '12 admission_date_missing' as field,\n sum(admission_date_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_date_not_unique as (\nselect\n '13 discharge_date_not_unique' as field,\n sum(discharge_date_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_date_missing as (\nselect\n '14 discharge_date_missing' as field,\n sum(discharge_date_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmission_date_after_discharge_date as (\nselect\n '15 admission_date_after_discharge_date' as field,\n sum(admission_date_after_discharge_date) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_type_code_not_unique as (\nselect\n '16 admit_type_code_not_unique' as field,\n sum(admit_type_code_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_type_code_missing as (\nselect\n '17 admit_type_code_missing' as field,\n sum(admit_type_code_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_source_code_not_unique as (\nselect\n '18 admit_source_code_not_unique' as field,\n sum(admit_source_code_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_source_code_missing as (\nselect\n '19 admit_source_code_missing' as field,\n sum(admit_source_code_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_disposition_code_not_unique as (\nselect\n '20 discharge_disposition_code_not_unique' as field,\n sum(discharge_disposition_code_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_disposition_code_missing as (\nselect\n '21 discharge_disposition_code_missing' as field,\n sum(discharge_disposition_code_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nfacility_npi_not_unique as (\nselect\n '22 facility_npi_not_unique' as field,\n sum(facility_npi_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nfacility_npi_missing as (\nselect\n '23 facility_npi_missing' as field,\n sum(facility_npi_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_type_not_unique as (\nselect\n '24 claim_type_not_unique' as field,\n sum(claim_type_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_type_missing as (\nselect\n '25 claim_type_missing' as field,\n sum(claim_type_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_type_not_institutional as (\nselect\n '26 claim_type_not_institutional' as field,\n sum(claim_type_not_institutional) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nstart_date_not_determined as (\nselect\n '27 start_date_not_determined' as field,\n sum(start_date_not_determined) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nend_date_not_determined as (\nselect\n '28 end_date_not_determined' as field,\n sum(end_date_not_determined) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nstart_date_after_end_date as (\nselect\n '29 start_date_after_end_date' as field,\n sum(start_date_after_end_date) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\n\nunion_cte as (\nselect *\nfrom total_acute_inpatient__institutional_claims\n\nunion all\n\nselect *\nfrom total_claims_with_insights\n\nunion all\n\nselect *\nfrom total_claims_with_problems\n\nunion all\n\nselect *\nfrom patient_id_not_unique\n\nunion all\n\nselect *\nfrom patient_id_missing\n\nunion all\n\nselect *\nfrom claim_start_date_not_unique\n\nunion all\n\nselect *\nfrom claim_start_date_missing\n\nunion all\n\nselect *\nfrom claim_end_date_not_unique\n\nunion all\n\nselect *\nfrom claim_end_date_missing\n\nunion all\n\nselect *\nfrom claim_start_date_after_claim_end_date\n\nunion all\n\nselect *\nfrom admission_date_not_unique\n\nunion all\n\nselect *\nfrom admission_date_missing\n\nunion all\n\nselect *\nfrom discharge_date_not_unique\n\nunion all\n\nselect *\nfrom discharge_date_missing\n\nunion all\n\nselect *\nfrom admission_date_after_discharge_date\n\nunion all\n\nselect *\nfrom admit_type_code_not_unique\n\nunion all\n\nselect *\nfrom admit_type_code_missing\n\nunion all\n\nselect *\nfrom admit_source_code_not_unique\n\nunion all\n\nselect *\nfrom admit_source_code_missing\n\nunion all\n\nselect *\nfrom discharge_disposition_code_not_unique\n\nunion all\n\nselect *\nfrom discharge_disposition_code_missing\n\nunion all\n\nselect *\nfrom facility_npi_not_unique\n\nunion all\n\nselect *\nfrom facility_npi_missing\n\nunion all\n\nselect *\nfrom claim_type_not_unique\n\nunion all\n\nselect *\nfrom claim_type_missing\n\nunion all\n\nselect *\nfrom claim_type_not_institutional\n\nunion all\n\nselect *\nfrom start_date_not_determined\n\nunion all\n\nselect *\nfrom end_date_not_determined\n\nunion all\n\nselect *\nfrom start_date_after_end_date\n)\n\n\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom union_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.acute_inpatient__institutional_encounter_id": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__institutional_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_encounter_id.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_encounter_id.sql", "unique_id": "model.the_tuva_project.acute_inpatient__institutional_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__institutional_encounter_id"], "alias": "_int_acute_inpatient_institutional_encounter_id", "checksum": {"name": "sha256", "checksum": "32836827d0aace3676653b154255c0db0b9cfde31f8a66384c7d13b3d18ce216"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Assigns encounter_id to every acute inpatient institutional claim", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional_encounter_id", "tags": ["acute_inpatient", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.765101, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_institutional_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model groups acute inpatient institutional\n-- claims into encounters. It assigns an encounter_id\n-- to each acute inpatient institutional claim.\n-- This returns a table with 3 fields:\n-- patient_id\n-- claim_id\n-- encounter_id\n-- The number of rows in the table should be equal\n-- to the number of acute inpatient institutional claims.\n-- *************************************************\n\n\nwith add_row_num as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_npi,\n row_number() over (partition by patient_id order by end_date, start_date, claim_id) as row_num\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\ncheck_for_merges_with_larger_row_num as (\nselect\n aa.patient_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_npi should be merged:\n when (aa.end_date = bb.end_date\n and aa.facility_npi = bb.facility_npi) 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_npi = bb.facility_npi\n\t 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) and \n (aa.end_date >= bb.start_date) and --overlap requirement\n (aa.facility_npi = bb.facility_npi)\n\t )then 1\n else 0\n end as merge_flag\nfrom add_row_num aa\n inner join add_row_num bb\n on aa.patient_id = bb.patient_id\n and aa.row_num < bb.row_num\n),\n\nmerges_with_larger_row_num as (\nselect\n patient_id,\n claim_id_a,\n claim_id_b,\n row_num_a,\n row_num_b,\n merge_flag\nfrom check_for_merges_with_larger_row_num\nwhere merge_flag = 1\n),\n\n\nclaim_ids_that_merge_with_larger_row_num as (\nselect distinct claim_id_a as claim_id\nfrom merges_with_larger_row_num\n),\n\n\nclaim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\nselect distinct aa.claim_id as claim_id\nfrom add_row_num aa\n inner join\n merges_with_larger_row_num bb\n on aa.patient_id = bb.patient_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n),\n\n\nclose_flags as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.discharge_disposition_code,\n aa.facility_npi,\n aa.row_num,\n case when (bb.claim_id is null and cc.claim_id is null) then 1\n else 0\n end as close_flag\n\nfrom add_row_num aa\n\nleft join claim_ids_that_merge_with_larger_row_num bb\non aa.claim_id = bb.claim_id\n\nleft join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num cc\non aa.claim_id = cc.claim_id\n),\n\n\njoin_every_row_to_later_closes as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.row_num as row_num,\n bb.row_num as row_num_b\nfrom close_flags aa inner join close_flags bb\n on aa.patient_id = bb.patient_id\n and aa.row_num <= bb.row_num\nwhere bb.close_flag = 1\n),\n\n\nfind_min_closing_row_num_for_every_claim as (\nselect\n patient_id,\n claim_id,\n min(row_num_b) as min_closing_row\nfrom join_every_row_to_later_closes\ngroup by patient_id, claim_id\n),\n\n\nadd_min_closing_row_to_every_claim as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n bb.min_closing_row as min_closing_row\nfrom close_flags aa\n left join find_min_closing_row_num_for_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.claim_id = bb.claim_id\n),\n\n\nadd_encounter_id as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n aa.min_closing_row as min_closing_row,\n bb.claim_id as encounter_id\nfrom add_min_closing_row_to_every_claim aa\n left join add_min_closing_row_to_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "acute_inpatient__institutional_claims", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.acute_inpatient__institutional_claims"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_encounter_id.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model groups acute inpatient institutional\n-- claims into encounters. It assigns an encounter_id\n-- to each acute inpatient institutional claim.\n-- This returns a table with 3 fields:\n-- patient_id\n-- claim_id\n-- encounter_id\n-- The number of rows in the table should be equal\n-- to the number of acute inpatient institutional claims.\n-- *************************************************\n\n\nwith add_row_num as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_npi,\n row_number() over (partition by patient_id order by end_date, start_date, claim_id) as row_num\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\ncheck_for_merges_with_larger_row_num as (\nselect\n aa.patient_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_npi should be merged:\n when (aa.end_date = bb.end_date\n and aa.facility_npi = bb.facility_npi) 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_npi = bb.facility_npi\n\t 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) and \n (aa.end_date >= bb.start_date) and --overlap requirement\n (aa.facility_npi = bb.facility_npi)\n\t )then 1\n else 0\n end as merge_flag\nfrom add_row_num aa\n inner join add_row_num bb\n on aa.patient_id = bb.patient_id\n and aa.row_num < bb.row_num\n),\n\nmerges_with_larger_row_num as (\nselect\n patient_id,\n claim_id_a,\n claim_id_b,\n row_num_a,\n row_num_b,\n merge_flag\nfrom check_for_merges_with_larger_row_num\nwhere merge_flag = 1\n),\n\n\nclaim_ids_that_merge_with_larger_row_num as (\nselect distinct claim_id_a as claim_id\nfrom merges_with_larger_row_num\n),\n\n\nclaim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\nselect distinct aa.claim_id as claim_id\nfrom add_row_num aa\n inner join\n merges_with_larger_row_num bb\n on aa.patient_id = bb.patient_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n),\n\n\nclose_flags as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.discharge_disposition_code,\n aa.facility_npi,\n aa.row_num,\n case when (bb.claim_id is null and cc.claim_id is null) then 1\n else 0\n end as close_flag\n\nfrom add_row_num aa\n\nleft join claim_ids_that_merge_with_larger_row_num bb\non aa.claim_id = bb.claim_id\n\nleft join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num cc\non aa.claim_id = cc.claim_id\n),\n\n\njoin_every_row_to_later_closes as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.row_num as row_num,\n bb.row_num as row_num_b\nfrom close_flags aa inner join close_flags bb\n on aa.patient_id = bb.patient_id\n and aa.row_num <= bb.row_num\nwhere bb.close_flag = 1\n),\n\n\nfind_min_closing_row_num_for_every_claim as (\nselect\n patient_id,\n claim_id,\n min(row_num_b) as min_closing_row\nfrom join_every_row_to_later_closes\ngroup by patient_id, claim_id\n),\n\n\nadd_min_closing_row_to_every_claim as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n bb.min_closing_row as min_closing_row\nfrom close_flags aa\n left join find_min_closing_row_num_for_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.claim_id = bb.claim_id\n),\n\n\nadd_encounter_id as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n aa.min_closing_row as min_closing_row,\n bb.claim_id as encounter_id\nfrom add_min_closing_row_to_every_claim aa\n left join add_min_closing_row_to_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\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.acute_inpatient__encounter_start_and_end_dates": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__encounter_start_and_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_start_and_end_dates.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_start_and_end_dates.sql", "unique_id": "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__encounter_start_and_end_dates"], "alias": "_int_acute_inpatient_encounter_start_and_end_dates", "checksum": {"name": "sha256", "checksum": "e8a099ceacae9d1cdd079df3fe3966d2260a4883688a3446748dfac187ac3d75"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_encounter_start_and_end_dates", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Defines encounter start and end dates for acute inpatient encounters", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_encounter_start_and_end_dates", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.7665558, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model assigns an encounter_start_date and\n-- an encounter_end_date to each acute inpatient\n-- encounter_id.\n-- This returns a table with 4 fields:\n-- patient_id\n-- encounter_id\n-- encounter_start_date\n-- encounter_end_date\n-- The number of rows in the table should be equal\n-- to the number of acute inpatient encounters.\n-- *************************************************\n\n\nwith add_encounter_id_to_acute_inpatient_encounters as (\nselect\n aip.claim_id as claim_id,\n aip.patient_id as patient_id,\n aip.start_date as start_date,\n aip.end_date as end_date,\n eid.encounter_id as encounter_id\nfrom {{ ref('acute_inpatient__institutional_claims') }} aip\nleft join {{ ref('acute_inpatient__institutional_encounter_id') }} eid\n on aip.patient_id = eid.patient_id\n and aip.claim_id = eid.claim_id\n),\n\nencounter_start_and_end_dates as (\nselect\n patient_id,\n encounter_id,\n min(start_date) as encounter_start_date,\n max(end_date) as encounter_end_date\nfrom add_encounter_id_to_acute_inpatient_encounters\ngroup by patient_id, encounter_id\n)\n\nselect\n patient_id\n , encounter_id\n , encounter_start_date\n , encounter_end_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom encounter_start_and_end_dates", "language": "sql", "refs": [{"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__institutional_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_start_and_end_dates.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model assigns an encounter_start_date and\n-- an encounter_end_date to each acute inpatient\n-- encounter_id.\n-- This returns a table with 4 fields:\n-- patient_id\n-- encounter_id\n-- encounter_start_date\n-- encounter_end_date\n-- The number of rows in the table should be equal\n-- to the number of acute inpatient encounters.\n-- *************************************************\n\n\nwith add_encounter_id_to_acute_inpatient_encounters as (\nselect\n aip.claim_id as claim_id,\n aip.patient_id as patient_id,\n aip.start_date as start_date,\n aip.end_date as end_date,\n eid.encounter_id as encounter_id\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims aip\nleft join raw.claims_preprocessing._int_acute_inpatient_institutional_encounter_id eid\n on aip.patient_id = eid.patient_id\n and aip.claim_id = eid.claim_id\n),\n\nencounter_start_and_end_dates as (\nselect\n patient_id,\n encounter_id,\n min(start_date) as encounter_start_date,\n max(end_date) as encounter_end_date\nfrom add_encounter_id_to_acute_inpatient_encounters\ngroup by patient_id, encounter_id\n)\n\nselect\n patient_id\n , encounter_id\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom encounter_start_and_end_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.acute_inpatient__claims_with_encounter_data": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__claims_with_encounter_data", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__claims_with_encounter_data.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__claims_with_encounter_data.sql", "unique_id": "model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__claims_with_encounter_data"], "alias": "_int_acute_inpatient_claims_with_encounter_data", "checksum": {"name": "sha256", "checksum": "d97adc06d7b7b31ef547794092bfc9fb4925425f1deabf894753582ed1fe0599"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_claims_with_encounter_data", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Add all relevant encounter data to each acute inpatient claim_id", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_claims_with_encounter_data", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.7703948, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_claims_with_encounter_data", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model returns relevant encounter-level\n-- data for every professional or institutional\n-- acute inpatient claim that is part of an encounter\n-- (note that all institutional acute inpatienet claims\n-- are part of an acute inpatient encounter, but only\n-- professional acute inpatient claims that are not\n-- orphan claims and that belong to one and only\n-- one encounter, i.e. have encounter_count = 1,\n-- are part of an acute inpatient encounter).\n-- It returns a table with these columns:\n-- patient_id\n-- claim_id\n-- start_date (date used for merging claims into encounters)\n-- end_date (date used for merging claims into encounters)\n-- encounter_id\n-- encounter_start_date,\n-- encounter_end_date,\n-- encounter_admit_source_code,\n-- encounter_admit_type_code,\n-- encounter_discharge_disposition_code\n-- *************************************************\n\n\n\n\nwith useful_fields_at_claim_id_level as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.admit_type_code,\n aa.admit_source_code,\n aa.discharge_disposition_code,\n aa.start_date,\n aa.end_date,\n\n bb.encounter_id,\n\n cc.encounter_start_date,\n cc.encounter_end_date\n\nfrom {{ ref('acute_inpatient__institutional_claims') }} aa\n\nleft join\n{{ ref('acute_inpatient__encounter_id') }} bb\non aa.claim_id = bb.claim_id\nand aa.patient_id = bb.patient_id\n\nleft join\n{{ ref('acute_inpatient__encounter_start_and_end_dates') }} cc\non bb.encounter_id = cc.encounter_id\nand bb.patient_id = cc.patient_id\n),\n\n\n\nadmit_codes as (\nselect\n encounter_id,\n max(admit_source_code) as encounter_admit_source_code,\n max(admit_type_code) as encounter_admit_type_code\nfrom useful_fields_at_claim_id_level\nwhere start_date = encounter_start_date\ngroup by encounter_id\n),\n\n\ndischarge_code as (\nselect\n encounter_id,\n max(discharge_disposition_code) as encounter_discharge_disposition_code\nfrom useful_fields_at_claim_id_level\nwhere end_date = encounter_end_date\ngroup by encounter_id\n),\n\n\nall_useful_fields_at_claim_id_level as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.encounter_start_date,\n aa.encounter_end_date,\n\n bb.encounter_admit_source_code,\n bb.encounter_admit_type_code,\n \n cc.encounter_discharge_disposition_code\n\nfrom useful_fields_at_claim_id_level aa \n left join admit_codes bb on aa.encounter_id = bb.encounter_id\n left join discharge_code cc on aa.encounter_id = cc.encounter_id\n)\n\n\n\nselect \n *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom all_useful_fields_at_claim_id_level", "language": "sql", "refs": [{"name": "acute_inpatient__institutional_claims", "package": null, "version": null}, {"name": "acute_inpatient__encounter_id", "package": null, "version": null}, {"name": "acute_inpatient__encounter_start_and_end_dates", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__claims_with_encounter_data.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model returns relevant encounter-level\n-- data for every professional or institutional\n-- acute inpatient claim that is part of an encounter\n-- (note that all institutional acute inpatienet claims\n-- are part of an acute inpatient encounter, but only\n-- professional acute inpatient claims that are not\n-- orphan claims and that belong to one and only\n-- one encounter, i.e. have encounter_count = 1,\n-- are part of an acute inpatient encounter).\n-- It returns a table with these columns:\n-- patient_id\n-- claim_id\n-- start_date (date used for merging claims into encounters)\n-- end_date (date used for merging claims into encounters)\n-- encounter_id\n-- encounter_start_date,\n-- encounter_end_date,\n-- encounter_admit_source_code,\n-- encounter_admit_type_code,\n-- encounter_discharge_disposition_code\n-- *************************************************\n\n\n\n\nwith useful_fields_at_claim_id_level as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.admit_type_code,\n aa.admit_source_code,\n aa.discharge_disposition_code,\n aa.start_date,\n aa.end_date,\n\n bb.encounter_id,\n\n cc.encounter_start_date,\n cc.encounter_end_date\n\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims aa\n\nleft join\nraw.claims_preprocessing._int_acute_inpatient_encounter_id bb\non aa.claim_id = bb.claim_id\nand aa.patient_id = bb.patient_id\n\nleft join\nraw.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates cc\non bb.encounter_id = cc.encounter_id\nand bb.patient_id = cc.patient_id\n),\n\n\n\nadmit_codes as (\nselect\n encounter_id,\n max(admit_source_code) as encounter_admit_source_code,\n max(admit_type_code) as encounter_admit_type_code\nfrom useful_fields_at_claim_id_level\nwhere start_date = encounter_start_date\ngroup by encounter_id\n),\n\n\ndischarge_code as (\nselect\n encounter_id,\n max(discharge_disposition_code) as encounter_discharge_disposition_code\nfrom useful_fields_at_claim_id_level\nwhere end_date = encounter_end_date\ngroup by encounter_id\n),\n\n\nall_useful_fields_at_claim_id_level as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.encounter_start_date,\n aa.encounter_end_date,\n\n bb.encounter_admit_source_code,\n bb.encounter_admit_type_code,\n \n cc.encounter_discharge_disposition_code\n\nfrom useful_fields_at_claim_id_level aa \n left join admit_codes bb on aa.encounter_id = bb.encounter_id\n left join discharge_code cc on aa.encounter_id = cc.encounter_id\n)\n\n\n\nselect \n *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom all_useful_fields_at_claim_id_level", "extra_ctes_injected": true, "extra_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__first_claim_values": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__first_claim_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__first_claim_values.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__first_claim_values.sql", "unique_id": "model.the_tuva_project.acute_inpatient__first_claim_values", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__first_claim_values"], "alias": "_int_acute_inpatient_first_claim_values", "checksum": {"name": "sha256", "checksum": "14bbc7addd83908000caa382768bd1215b8f7d70e204a6b07848f86fa24c98f5"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_first_claim_values", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Orders claims to pull out encounter details (admit type, drg, etc)", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_first_claim_values", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.773068, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_first_claim_values", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith first_claim_values as(\r\n select distinct\r\n e.encounter_id\r\n , coalesce(claim_start_date, admission_date) as claim_start\r\n , diagnosis_code_1\r\n , diagnosis_code_type\r\n , admit_source_code\r\n , admit_type_code\r\n , facility_npi\r\n , ms_drg_code\r\n , apr_drg_code\r\n from {{ ref('acute_inpatient__encounter_id')}} e\r\n inner join {{ ref('acute_inpatient__stg_medical_claim') }} m\r\n on e.claim_id = m.claim_id\r\n where claim_type = 'institutional'\r\n)\r\n\r\nselect\r\n encounter_id\r\n , claim_start\r\n , diagnosis_code_1\r\n , diagnosis_code_type\r\n , admit_source_code\r\n , admit_type_code\r\n , facility_npi\r\n , ms_drg_code\r\n , apr_drg_code\r\n , row_number() over (partition by encounter_id order by claim_start) as claim_row\r\nfrom first_claim_values", "language": "sql", "refs": [{"name": "acute_inpatient__encounter_id", "package": null, "version": null}, {"name": "acute_inpatient__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__first_claim_values.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n from raw.claims_preprocessing._int_acute_inpatient_encounter_id e\n inner join __dbt__cte__acute_inpatient__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , row_number() over (partition by encounter_id order by claim_start) as claim_row\nfrom first_claim_values", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.acute_inpatient__encounter_id": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_id.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_id.sql", "unique_id": "model.the_tuva_project.acute_inpatient__encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__encounter_id"], "alias": "_int_acute_inpatient_encounter_id", "checksum": {"name": "sha256", "checksum": "29fcb69ad4c06139bfe133afcabcb8c0465b993be74ce93599c6bf68dccc5bae"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Fix encounter_id so each professional claim can only belong to one encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_encounter_id", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.769088, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model assigns an encounter_id to each\n-- institutional or professional acute inpatient claim\n-- that is eligible to be part of an encounter.\n-- Professional acute inpatient claims that are\n-- orphan claims (don't overlap with an institutional\n-- acute inpatient claim) or that have\n-- encounter_count > 1 (overlap with more than one different\n-- acute inpatient encounter) are not included here.\n-- It returns a table with these 3 columns:\n-- patient_id\n-- claim_id\n-- encounter_id\n-- *************************************************\n\n\n\n\nselect\n inst.patient_id,\n inst.claim_id,\n med.claim_line_number,\n inst.encounter_id,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('acute_inpatient__institutional_encounter_id') }} inst\nleft join {{ ref('acute_inpatient__stg_medical_claim') }} med\n on inst.claim_id = med.claim_id\n\nunion distinct\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n encounter_id,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('acute_inpatient__professional_encounter_id') }}\nwhere (orphan_claim_flag = 0) and (encounter_count = 1)", "language": "sql", "refs": [{"name": "acute_inpatient__institutional_encounter_id", "package": null, "version": null}, {"name": "acute_inpatient__stg_medical_claim", "package": null, "version": null}, {"name": "acute_inpatient__professional_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__institutional_encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__professional_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) -- *************************************************\n-- This dbt model assigns an encounter_id to each\n-- institutional or professional acute inpatient claim\n-- that is eligible to be part of an encounter.\n-- Professional acute inpatient claims that are\n-- orphan claims (don't overlap with an institutional\n-- acute inpatient claim) or that have\n-- encounter_count > 1 (overlap with more than one different\n-- acute inpatient encounter) are not included here.\n-- It returns a table with these 3 columns:\n-- patient_id\n-- claim_id\n-- encounter_id\n-- *************************************************\n\n\n\n\nselect\n inst.patient_id,\n inst.claim_id,\n med.claim_line_number,\n inst.encounter_id,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_encounter_id inst\nleft join __dbt__cte__acute_inpatient__stg_medical_claim med\n on inst.claim_id = med.claim_id\n\nunion distinct\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n encounter_id,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_acute_inpatient_professional_encounter_id\nwhere (orphan_claim_flag = 0) and (encounter_count = 1)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_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.acute_inpatient__institutional_claims": {"database": "raw", "schema": "claims_preprocessing", "name": "acute_inpatient__institutional_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_claims.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_claims.sql", "unique_id": "model.the_tuva_project.acute_inpatient__institutional_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__institutional_claims"], "alias": "_int_acute_inpatient_institutional_claims", "checksum": {"name": "sha256", "checksum": "7b8e75f9fad7f381b211d8d4378681e187564775bc783bada56831600ee68a25"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional_claims", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "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": "#0f3d0b"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "All acute inpatient institutional claim_ids with header values and data quality flags", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional_claims", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708461580.761832, "relation_name": "raw.claims_preprocessing._int_acute_inpatient_institutional_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model gives us all acute inpatient institutional claims.\n-- We have one row per claim_id (for all claim_ids belonging to\n-- acute inpatient institutinal claims).\n-- The number of rows in the table is equal to the number of unique\n-- claim_ids (i.e. claim_id is a primary key).\n-- Note that we are assuming that a claim_id is unique across\n-- all people in the datset, i.e.\n-- that no two people can have the same claim_id.\n-- *************************************************\n\nwith acute_inpatient_claim_lines as (\nselect\n mc.patient_id,\n mc.claim_id,\n mc.claim_line_number,\n mc.claim_start_date,\n mc.claim_end_date,\n mc.admission_date,\n mc.discharge_date,\n mc.admit_source_code,\n mc.admit_type_code,\n mc.discharge_disposition_code,\n mc.facility_npi,\n mc.claim_type,\n mc.data_source\nfrom {{ ref('acute_inpatient__stg_medical_claim') }} mc\ninner join {{ ref('acute_inpatient__stg_service_category')}} sc\n on mc.claim_id = sc.claim_id\nwhere mc.claim_type = 'institutional'\n and sc.service_category_2 = 'Acute Inpatient'\n),\n\ndata_quality_flags as (\nselect\n claim_id,\n-- patient_id_not_unique:\n case\n when count(distinct patient_id) > 1 then 1\n else 0\n end as patient_id_not_unique,\n-- patient_id_missing: \n case\n when max(patient_id) is null then 1\n else 0\n end as patient_id_missing, \n-- claim_start_date_not_unique:\n case\n when count(distinct claim_start_date) > 1 then 1\n else 0\n end as claim_start_date_not_unique,\n-- claim_start_date_missing: \n case\n when max(claim_start_date) is null then 1\n else 0\n end as claim_start_date_missing,\n-- claim_end_date_not_unique:\n case\n when count(distinct claim_end_date) > 1 then 1\n else 0\n end as claim_end_date_not_unique,\n-- claim_end_date_missing: \n case\n when max(claim_end_date) is null then 1\n else 0\n end as claim_end_date_missing,\n-- claim_start_date_after_claim_end_date:\n case\n when min(claim_start_date) > max(claim_end_date) then 1\n else 0\n end as claim_start_date_after_claim_end_date,\n-- admission_date_not_unique:\n case\n when count(distinct admission_date) > 1 then 1\n else 0\n end as admission_date_not_unique,\n-- admission_date_missing: \n case\n when max(admission_date) is null then 1\n else 0\n end as admission_date_missing,\n-- discharge_date_not_unique:\n case\n when count(distinct discharge_date) > 1 then 1\n else 0\n end as discharge_date_not_unique,\n-- discharge_date_missing: \n case\n when max(discharge_date) is null then 1\n else 0\n end as discharge_date_missing,\n-- admission_date_after_discharge_date:\n case\n when min(admission_date) > max(discharge_date) then 1\n else 0\n end as admission_date_after_discharge_date,\n-- admit_type_code_not_unique:\n case\n when count(distinct admit_type_code) > 1 then 1\n else 0\n end as admit_type_code_not_unique,\n-- admit_type_code_missing: \n case\n when max(admit_type_code) is null then 1\n else 0\n end as admit_type_code_missing, \n-- admit_source_code_not_unique:\n case\n when count(distinct admit_source_code) > 1 then 1\n else 0\n end as admit_source_code_not_unique,\n-- admit_source_code_missing: \n case\n when max(admit_source_code) is null then 1\n else 0\n end as admit_source_code_missing, \n-- discharge_disposition_code_not_unique:\n case\n when count(distinct discharge_disposition_code) > 1 then 1\n else 0\n end as discharge_disposition_code_not_unique,\n-- discharge_disposition_code_missing: \n case\n when max(discharge_disposition_code) is null then 1\n else 0\n end as discharge_disposition_code_missing,\n-- facility_npi_not_unique:\n case\n when count(distinct facility_npi) > 1 then 1\n else 0\n end as facility_npi_not_unique,\n-- facility_npi_missing: \n case\n when max(facility_npi) is null then 1\n else 0\n end as facility_npi_missing,\n-- claim_type_not_unique:\n case\n when count(distinct claim_type) > 1 then 1\n else 0\n end as claim_type_not_unique,\n-- claim_type_missing: \n case\n when max(claim_type) is null then 1\n else 0\n end as claim_type_missing,\n-- claim_type_not_institutional:\n case\n when max(claim_type) <> 'institutional'\n and min(claim_type) <> 'institutional' then 1\n else 0\n end as claim_type_not_institutional\nfrom acute_inpatient_claim_lines\ngroup by claim_id\n),\n\n\nheader_level_values as (\nselect\n claim_id,\n max(patient_id) as patient_id,\n min(claim_start_date) as claim_start_date,\n max(claim_end_date) as claim_end_date,\n min(admission_date) as admission_date,\n max(discharge_date) as discharge_date,\n max(admit_source_code) as admit_source_code,\n max(admit_type_code) as admit_type_code,\n max(discharge_disposition_code) as discharge_disposition_code,\n max(facility_npi) as facility_npi,\n max(claim_type) as claim_type,\n coalesce(min(admission_date),\n min(claim_start_date)) as start_date,\n coalesce(max(discharge_date),\n max(claim_end_date)) as end_date,\n case\n when min(admission_date) is not null then 'admission_date'\n when min(claim_start_date) is not null then 'claim_start_date'\n else null\n end as date_used_as_start_date,\n case\n when max(discharge_date) is not null then 'discharge_date'\n when max(claim_end_date) is not null then 'claim_end_date'\n else null\n end as date_used_as_end_date,\n data_source\nfrom acute_inpatient_claim_lines\ngroup by claim_id, data_source\n)\n\nselect\n h.patient_id as patient_id,\n h.claim_id as claim_id, \n h.claim_start_date as claim_start_date,\n h.claim_end_date as claim_end_date,\n h.admission_date as admission_date,\n h.discharge_date as discharge_date,\n h.admit_source_code as admit_source_code,\n h.admit_type_code as admit_type_code,\n h.discharge_disposition_code as discharge_disposition_code,\n h.facility_npi as facility_npi,\n h.claim_type as claim_type,\n h.start_date as start_date,\n h.end_date as end_date,\n h.date_used_as_start_date,\n h.date_used_as_end_date, \n\n case\n when\n ( (dq.patient_id_not_unique = 1) or\n (dq.patient_id_missing = 1) or\n (dq.discharge_disposition_code_not_unique = 1) or\n (dq.discharge_disposition_code_missing = 1) or\n (dq.facility_npi_not_unique = 1) or\n (dq.facility_npi_missing = 1) or\n (h.date_used_as_start_date is null) or\n\t(h.date_used_as_end_date is null) or\n\t(h.start_date > h.end_date) ) then 1\n else 0\n end as dq_problem,\n\n case\n when\n ( (dq.claim_start_date_not_unique = 1) or\n\t(dq.claim_start_date_missing = 1) or\n (dq.claim_end_date_not_unique = 1) or\n (dq.claim_end_date_missing = 1) or\n (dq.claim_start_date_after_claim_end_date = 1) or\n (dq.admission_date_not_unique = 1) or\n (dq.admission_date_missing = 1) or\n (dq.discharge_date_not_unique = 1) or\n (dq.discharge_date_missing = 1) or\n (dq.admission_date_after_discharge_date = 1) or\n (dq.admit_type_code_not_unique = 1) or\n (dq.admit_type_code_missing = 1) or\n (dq.admit_source_code_not_unique = 1) or\n (dq.admit_source_code_missing = 1) or\t\n (dq.claim_type_not_unique = 1) or\n (dq.claim_type_missing = 1) or\n (dq.claim_type_not_institutional = 1) ) then 1\n else 0\n end as dq_insight,\n\n case\n when (h.date_used_as_start_date is null) then 1\n else 0\n end as start_date_not_determined,\n \n case\n when (h.date_used_as_end_date is null) then 1\n else 0\n end as end_date_not_determined,\n\n case\n when (h.start_date > h.end_date) then 1\n else 0\n end as start_date_after_end_date,\n \n dq.patient_id_not_unique as patient_id_not_unique,\n dq.patient_id_missing as patient_id_missing,\n dq.claim_start_date_not_unique as claim_start_date_not_unique,\n dq.claim_start_date_missing as claim_start_date_missing,\n dq.claim_end_date_not_unique as claim_end_date_not_unique,\n dq.claim_end_date_missing as claim_end_date_missing,\n dq.claim_start_date_after_claim_end_date\n as claim_start_date_after_claim_end_date,\n dq.admission_date_not_unique as admission_date_not_unique,\n dq.admission_date_missing as admission_date_missing,\n dq.discharge_date_not_unique as discharge_date_not_unique,\n dq.discharge_date_missing as discharge_date_missing,\n dq.admission_date_after_discharge_date\n as admission_date_after_discharge_date,\n dq.admit_type_code_not_unique\n as admit_type_code_not_unique,\n dq.admit_type_code_missing\n as admit_type_code_missing,\n dq.admit_source_code_not_unique\n as admit_source_code_not_unique,\n dq.admit_source_code_missing\n as admit_source_code_missing,\n dq.discharge_disposition_code_not_unique\n as discharge_disposition_code_not_unique,\n dq.discharge_disposition_code_missing\n as discharge_disposition_code_missing,\n dq.facility_npi_not_unique as facility_npi_not_unique,\n dq.facility_npi_missing as facility_npi_missing,\n dq.claim_type_not_unique as claim_type_not_unique,\n dq.claim_type_missing as claim_type_missing,\n dq.claim_type_not_institutional as claim_type_not_institutional,\n h.data_source,\n '{{ var('tuva_last_run')}}' as tuva_last_run\n\nfrom header_level_values h\nleft join data_quality_flags dq\n on h.claim_id = dq.claim_id", "language": "sql", "refs": [{"name": "acute_inpatient__stg_medical_claim", "package": null, "version": null}, {"name": "acute_inpatient__stg_service_category", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__stg_service_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_claims.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model gives us all acute inpatient institutional claims.\n-- We have one row per claim_id (for all claim_ids belonging to\n-- acute inpatient institutinal claims).\n-- The number of rows in the table is equal to the number of unique\n-- claim_ids (i.e. claim_id is a primary key).\n-- Note that we are assuming that a claim_id is unique across\n-- all people in the datset, i.e.\n-- that no two people can have the same claim_id.\n-- *************************************************\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), __dbt__cte__acute_inpatient__stg_service_category as (\n\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n), acute_inpatient_claim_lines as (\nselect\n mc.patient_id,\n mc.claim_id,\n mc.claim_line_number,\n mc.claim_start_date,\n mc.claim_end_date,\n mc.admission_date,\n mc.discharge_date,\n mc.admit_source_code,\n mc.admit_type_code,\n mc.discharge_disposition_code,\n mc.facility_npi,\n mc.claim_type,\n mc.data_source\nfrom __dbt__cte__acute_inpatient__stg_medical_claim mc\ninner join __dbt__cte__acute_inpatient__stg_service_category sc\n on mc.claim_id = sc.claim_id\nwhere mc.claim_type = 'institutional'\n and sc.service_category_2 = 'Acute Inpatient'\n),\n\ndata_quality_flags as (\nselect\n claim_id,\n-- patient_id_not_unique:\n case\n when count(distinct patient_id) > 1 then 1\n else 0\n end as patient_id_not_unique,\n-- patient_id_missing: \n case\n when max(patient_id) is null then 1\n else 0\n end as patient_id_missing, \n-- claim_start_date_not_unique:\n case\n when count(distinct claim_start_date) > 1 then 1\n else 0\n end as claim_start_date_not_unique,\n-- claim_start_date_missing: \n case\n when max(claim_start_date) is null then 1\n else 0\n end as claim_start_date_missing,\n-- claim_end_date_not_unique:\n case\n when count(distinct claim_end_date) > 1 then 1\n else 0\n end as claim_end_date_not_unique,\n-- claim_end_date_missing: \n case\n when max(claim_end_date) is null then 1\n else 0\n end as claim_end_date_missing,\n-- claim_start_date_after_claim_end_date:\n case\n when min(claim_start_date) > max(claim_end_date) then 1\n else 0\n end as claim_start_date_after_claim_end_date,\n-- admission_date_not_unique:\n case\n when count(distinct admission_date) > 1 then 1\n else 0\n end as admission_date_not_unique,\n-- admission_date_missing: \n case\n when max(admission_date) is null then 1\n else 0\n end as admission_date_missing,\n-- discharge_date_not_unique:\n case\n when count(distinct discharge_date) > 1 then 1\n else 0\n end as discharge_date_not_unique,\n-- discharge_date_missing: \n case\n when max(discharge_date) is null then 1\n else 0\n end as discharge_date_missing,\n-- admission_date_after_discharge_date:\n case\n when min(admission_date) > max(discharge_date) then 1\n else 0\n end as admission_date_after_discharge_date,\n-- admit_type_code_not_unique:\n case\n when count(distinct admit_type_code) > 1 then 1\n else 0\n end as admit_type_code_not_unique,\n-- admit_type_code_missing: \n case\n when max(admit_type_code) is null then 1\n else 0\n end as admit_type_code_missing, \n-- admit_source_code_not_unique:\n case\n when count(distinct admit_source_code) > 1 then 1\n else 0\n end as admit_source_code_not_unique,\n-- admit_source_code_missing: \n case\n when max(admit_source_code) is null then 1\n else 0\n end as admit_source_code_missing, \n-- discharge_disposition_code_not_unique:\n case\n when count(distinct discharge_disposition_code) > 1 then 1\n else 0\n end as discharge_disposition_code_not_unique,\n-- discharge_disposition_code_missing: \n case\n when max(discharge_disposition_code) is null then 1\n else 0\n end as discharge_disposition_code_missing,\n-- facility_npi_not_unique:\n case\n when count(distinct facility_npi) > 1 then 1\n else 0\n end as facility_npi_not_unique,\n-- facility_npi_missing: \n case\n when max(facility_npi) is null then 1\n else 0\n end as facility_npi_missing,\n-- claim_type_not_unique:\n case\n when count(distinct claim_type) > 1 then 1\n else 0\n end as claim_type_not_unique,\n-- claim_type_missing: \n case\n when max(claim_type) is null then 1\n else 0\n end as claim_type_missing,\n-- claim_type_not_institutional:\n case\n when max(claim_type) <> 'institutional'\n and min(claim_type) <> 'institutional' then 1\n else 0\n end as claim_type_not_institutional\nfrom acute_inpatient_claim_lines\ngroup by claim_id\n),\n\n\nheader_level_values as (\nselect\n claim_id,\n max(patient_id) as patient_id,\n min(claim_start_date) as claim_start_date,\n max(claim_end_date) as claim_end_date,\n min(admission_date) as admission_date,\n max(discharge_date) as discharge_date,\n max(admit_source_code) as admit_source_code,\n max(admit_type_code) as admit_type_code,\n max(discharge_disposition_code) as discharge_disposition_code,\n max(facility_npi) as facility_npi,\n max(claim_type) as claim_type,\n coalesce(min(admission_date),\n min(claim_start_date)) as start_date,\n coalesce(max(discharge_date),\n max(claim_end_date)) as end_date,\n case\n when min(admission_date) is not null then 'admission_date'\n when min(claim_start_date) is not null then 'claim_start_date'\n else null\n end as date_used_as_start_date,\n case\n when max(discharge_date) is not null then 'discharge_date'\n when max(claim_end_date) is not null then 'claim_end_date'\n else null\n end as date_used_as_end_date,\n data_source\nfrom acute_inpatient_claim_lines\ngroup by claim_id, data_source\n)\n\nselect\n h.patient_id as patient_id,\n h.claim_id as claim_id, \n h.claim_start_date as claim_start_date,\n h.claim_end_date as claim_end_date,\n h.admission_date as admission_date,\n h.discharge_date as discharge_date,\n h.admit_source_code as admit_source_code,\n h.admit_type_code as admit_type_code,\n h.discharge_disposition_code as discharge_disposition_code,\n h.facility_npi as facility_npi,\n h.claim_type as claim_type,\n h.start_date as start_date,\n h.end_date as end_date,\n h.date_used_as_start_date,\n h.date_used_as_end_date, \n\n case\n when\n ( (dq.patient_id_not_unique = 1) or\n (dq.patient_id_missing = 1) or\n (dq.discharge_disposition_code_not_unique = 1) or\n (dq.discharge_disposition_code_missing = 1) or\n (dq.facility_npi_not_unique = 1) or\n (dq.facility_npi_missing = 1) or\n (h.date_used_as_start_date is null) or\n\t(h.date_used_as_end_date is null) or\n\t(h.start_date > h.end_date) ) then 1\n else 0\n end as dq_problem,\n\n case\n when\n ( (dq.claim_start_date_not_unique = 1) or\n\t(dq.claim_start_date_missing = 1) or\n (dq.claim_end_date_not_unique = 1) or\n (dq.claim_end_date_missing = 1) or\n (dq.claim_start_date_after_claim_end_date = 1) or\n (dq.admission_date_not_unique = 1) or\n (dq.admission_date_missing = 1) or\n (dq.discharge_date_not_unique = 1) or\n (dq.discharge_date_missing = 1) or\n (dq.admission_date_after_discharge_date = 1) or\n (dq.admit_type_code_not_unique = 1) or\n (dq.admit_type_code_missing = 1) or\n (dq.admit_source_code_not_unique = 1) or\n (dq.admit_source_code_missing = 1) or\t\n (dq.claim_type_not_unique = 1) or\n (dq.claim_type_missing = 1) or\n (dq.claim_type_not_institutional = 1) ) then 1\n else 0\n end as dq_insight,\n\n case\n when (h.date_used_as_start_date is null) then 1\n else 0\n end as start_date_not_determined,\n \n case\n when (h.date_used_as_end_date is null) then 1\n else 0\n end as end_date_not_determined,\n\n case\n when (h.start_date > h.end_date) then 1\n else 0\n end as start_date_after_end_date,\n \n dq.patient_id_not_unique as patient_id_not_unique,\n dq.patient_id_missing as patient_id_missing,\n dq.claim_start_date_not_unique as claim_start_date_not_unique,\n dq.claim_start_date_missing as claim_start_date_missing,\n dq.claim_end_date_not_unique as claim_end_date_not_unique,\n dq.claim_end_date_missing as claim_end_date_missing,\n dq.claim_start_date_after_claim_end_date\n as claim_start_date_after_claim_end_date,\n dq.admission_date_not_unique as admission_date_not_unique,\n dq.admission_date_missing as admission_date_missing,\n dq.discharge_date_not_unique as discharge_date_not_unique,\n dq.discharge_date_missing as discharge_date_missing,\n dq.admission_date_after_discharge_date\n as admission_date_after_discharge_date,\n dq.admit_type_code_not_unique\n as admit_type_code_not_unique,\n dq.admit_type_code_missing\n as admit_type_code_missing,\n dq.admit_source_code_not_unique\n as admit_source_code_not_unique,\n dq.admit_source_code_missing\n as admit_source_code_missing,\n dq.discharge_disposition_code_not_unique\n as discharge_disposition_code_not_unique,\n dq.discharge_disposition_code_missing\n as discharge_disposition_code_missing,\n dq.facility_npi_not_unique as facility_npi_not_unique,\n dq.facility_npi_missing as facility_npi_missing,\n dq.claim_type_not_unique as claim_type_not_unique,\n dq.claim_type_missing as claim_type_missing,\n dq.claim_type_not_institutional as claim_type_not_institutional,\n h.data_source,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n\nfrom header_level_values h\nleft join data_quality_flags dq\n on h.claim_id = dq.claim_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n)"}, {"id": "model.the_tuva_project.acute_inpatient__stg_service_category", "sql": " __dbt__cte__acute_inpatient__stg_service_category as (\n\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\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__stg_medical_claim": {"database": "raw", "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": "2598a77f063c83df17e4263dd10147ee0914b36917186e3e35d51f4dae0a8756"}, "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": null}, "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": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.9290051, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , '{{ 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 , '{{ 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\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_timestamp() }} ) as tuva_last_run\nlimit 0\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "e450b5ec0c774f3e3624565aee8e99b0fb4638cb3bfa3fad3b1646ea49ad7795"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.926492, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "6ac64920ae666a218eb2065d9d319b7ae7f5ec53c8cda0b870b9e8ac45f36505"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.925374, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , 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__observation') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , observation_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__observation') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\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 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\nlimit 0\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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "1d1eb6e4f6a76a6c0e528be64d6ffd0491eaeb5937e25f4801bc1a9600281693"}, "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": null}, "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": []}, "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": null}, "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}, "created_at": 1708461580.9235709, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , 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 , 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\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_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\nlimit 0\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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "7328c6608e112884137102e96a625ab72eded37772421ffec34e6d450faa0495"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.9205492, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\nselect\n patient_id\n , claim_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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "f3b89d9a06448320730322ce5e362792ab473fff9054bca3ab84afa01ec38fa2"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.931411, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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_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_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\nselect\n cast(null as {{ dbt.type_string() }} ) as patient_id\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\nlimit 0\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_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "d3cc37b103a2cdce19944f7fff56a050f260fa91d716da4ba2be10fe4dddb001"}, "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": null}, "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": []}, "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": null}, "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}, "created_at": 1708461580.930166, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , 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 , 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\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 ndc_code\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as paid_date\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\nlimit 0\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 , paid_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "61025c6978615c6c9369fdb019207e0d5154cb47f90e696ba3bc9c2ea5c5db8c"}, "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": null}, "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": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.9276989, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\nselect\n patient_id\n , procedure_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__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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "864a8d92e301fad08a8bd0a826182b58b7a475a968de05c347d34652df05acfb"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.921959, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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_type\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_type\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\nselect\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_type\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\nlimit 0\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_type\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "1e5a5adff99398f5468fd59fb5f84a398b6c1630cbc5fd62ba4d722bd632b970"}, "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": null}, "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": "Each measure has a boolean flag which is the result of evaluating the denominator, numerator, and exclusion indicators for the patient. 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": null}, "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}, "created_at": 1708461580.889386, "relation_name": "raw.quality_measures.summary_wide", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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, nqf_0034 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0034'\n\n)\n, joined as (\n\n select\n measures_long.patient_id\n , nqf_2372.performance_flag as nqf_2372\n , nqf_0034.performance_flag as nqf_0034\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\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 from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\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 raw.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, nqf_0034 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0034'\n\n)\n, joined as (\n\n select\n measures_long.patient_id\n , nqf_2372.performance_flag as nqf_2372\n , nqf_0034.performance_flag as nqf_0034\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\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 from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\n , '2024-02-20 20:47:44.615990+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": "raw", "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": "9ea6415f97f1fbff5cd793f0822094e560602822b97cb3ea32ed265025a43191"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.885835, "relation_name": "raw.quality_measures.summary_counts", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 raw.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-02-20 20:47:44.615990+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": "raw", "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": "4b5205b9f22aa7c89f537ae34374134e534f8f15c5db30023f2f150299666845"}, "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": null}, "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": []}, "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": []}, "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": null}, "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}, "created_at": 1708461580.888022, "relation_name": "raw.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 )\n}}\n\n/* measures should already be at the full eligibility population grain */\nwith measures_unioned as (\n\n select * from {{ ref('quality_measures__int_nqf2372_long') }}\n union all\n\n select * from {{ ref('quality_measures__int_nqf0034_long') }}\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 measures_unioned\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , case\n when exclusion_flag = 1 then null\n when numerator_flag = 1 then 1\n when denominator_flag = 1 then 0\n else null end as performance_flag\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}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372_long", "model.the_tuva_project.quality_measures__int_nqf0034_long"]}, "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 measures_unioned as (\n\n select * from raw.quality_measures._int_nqf2372_long\n union all\n\n select * from raw.quality_measures._int_nqf0034_long\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 measures_unioned\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , case\n when exclusion_flag = 1 then null\n when numerator_flag = 1 then 1\n when denominator_flag = 1 then 0\n else null end as performance_flag\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-02-20 20:47:44.615990+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_exclude_mastectomy": {"database": "raw", "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": "1d03b9f7580863adc845af8cd09d5287de5bcb9d1138260fafebf1a3cd035440"}, "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": null}, "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.899735, "relation_name": "raw.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))))\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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from raw.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 raw.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-02-20 20:47:44.615990+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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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__frailty": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf2372__frailty", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372__frailty.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372__frailty.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372__frailty"], "alias": "_int_nqf2372__frailty", "checksum": {"name": "sha256", "checksum": "03fec5d7df9045ff25d56ab1d0b5449b04371a917ac4c002ce589f1f69f3dd88"}, "config": {"enabled": true, "alias": "_int_nqf2372__frailty", "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": null}, "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": null}, "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__frailty", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false}, "created_at": 1708461580.891925, "relation_name": "raw.quality_measures._int_nqf2372__frailty", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n/*\n This concept is used in multiple exclusions. Patients greater than\n or equal to 66 with at least one claim/encounter for frailty during\n the measurement period.\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_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 '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 denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and condition_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and condition_exclusions.recorded_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where denominator.age >= 66\n and med_claim_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and observation_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and procedure_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\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__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_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__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_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__frailty.sql", "compiled": true, "compiled_code": "\n/*\n This concept is used in multiple exclusions. Patients greater than\n or equal to 66 with at least one claim/encounter for frailty during\n the measurement period.\n*/\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), denominator as (\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n from raw.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 raw.quality_measures._value_set_codes\n where 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 denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and condition_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and condition_exclusions.recorded_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where denominator.age >= 66\n and med_claim_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and observation_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and procedure_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+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__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_exclude_advanced_illness": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_advanced_illness", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_advanced_illness.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_advanced_illness.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_advanced_illness"], "alias": "_int_nqf2372_exclude_advanced_illness", "checksum": {"name": "sha256", "checksum": "89a304c805c5f5840606f26a90b33877c14b89379befcdd9d2821892025fd74b"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_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": null}, "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 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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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_advanced_illness", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.894727, "relation_name": "raw.quality_measures._int_nqf2372_exclude_advanced_illness", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n OR two outpatient, observation, ED or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\nwith patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372__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 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\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/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name = 'Acute Inpatient'\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n med_claim_exclusions.claim_start_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 procedure_exclusions.concept_name = 'Acute Inpatient'\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n procedure_exclusions.procedure_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND two outpatient, observation, ED or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name in (\n 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n med_claim_exclusions.claim_start_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 procedure_exclusions.concept_name in (\n 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n procedure_exclusions.procedure_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n Filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n, acute_inpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient\n group by patient_id\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient\n group by patient_id\n\n)\n\n, eligible_acute_inpatient as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n from acute_inpatient\n left join acute_inpatient_counts\n on acute_inpatient.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n)\n\n, eligible_nonacute_outpatient as (\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n from nonacute_outpatient\n left join nonacute_outpatient_counts\n on nonacute_outpatient.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n\n, exclusions_unioned as (\n\n select\n eligible_acute_inpatient.patient_id\n , eligible_acute_inpatient.exclusion_date\n , eligible_acute_inpatient.exclusion_reason\n from eligible_acute_inpatient\n\n union all\n\n select\n eligible_nonacute_outpatient.patient_id\n , eligible_nonacute_outpatient.exclusion_date\n , eligible_nonacute_outpatient.exclusion_reason\n from eligible_nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions_unioned", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372__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.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372__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/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_advanced_illness.sql", "compiled": true, "compiled_code": "\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n OR two outpatient, observation, ED or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372__frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from raw.quality_measures._value_set_codes\n where 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\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/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name = 'Acute Inpatient'\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n med_claim_exclusions.claim_start_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 procedure_exclusions.concept_name = 'Acute Inpatient'\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n procedure_exclusions.procedure_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND two outpatient, observation, ED or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name in (\n 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n med_claim_exclusions.claim_start_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 procedure_exclusions.concept_name in (\n 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n procedure_exclusions.procedure_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n Filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n, acute_inpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient\n group by patient_id\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient\n group by patient_id\n\n)\n\n, eligible_acute_inpatient as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n from acute_inpatient\n left join acute_inpatient_counts\n on acute_inpatient.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n)\n\n, eligible_nonacute_outpatient as (\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n from nonacute_outpatient\n left join nonacute_outpatient_counts\n on nonacute_outpatient.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n\n, exclusions_unioned as (\n\n select\n eligible_acute_inpatient.patient_id\n , eligible_acute_inpatient.exclusion_date\n , eligible_acute_inpatient.exclusion_reason\n from eligible_acute_inpatient\n\n union all\n\n select\n eligible_nonacute_outpatient.patient_id\n , eligible_nonacute_outpatient.exclusion_date\n , eligible_nonacute_outpatient.exclusion_reason\n from eligible_nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_exclude_institutional": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_institutional.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_institutional.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_institutional"], "alias": "_int_nqf2372_exclude_institutional", "checksum": {"name": "sha256", "checksum": "d24105c7382317fb5122acf989e144582f62e850baa7350016e230782aeae1d6"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_institutional", "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": null}, "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 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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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_institutional", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.898539, "relation_name": "raw.quality_measures._int_nqf2372_exclude_institutional", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Patients greater than or equal to 66 in Institutional Special Needs Plans (SNP)\n or residing in long term care\n\n Future enhancement: group claims into encounters\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_nqf2372_denominator') }}\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 denominator.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 denominator\n inner join medical_claim\n on denominator.patient_id = medical_claim.patient_id\n where denominator.age >= 66\n and (\n medical_claim.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or medical_claim.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n and 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 , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372_denominator", "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__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_institutional.sql", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 in Institutional Special Needs Plans (SNP)\n or residing in long term care\n\n Future enhancement: group claims into encounters\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), denominator as (\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n from raw.quality_measures._int_nqf2372_denominator\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 denominator.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 denominator\n inner join medical_claim\n on denominator.patient_id = medical_claim.patient_id\n where denominator.age >= 66\n and (\n medical_claim.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or medical_claim.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n and 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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom exclusions", "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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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__performance_period": {"database": "raw", "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": "325f2b8405e1c308fe0ce98776cdda1da15e499c7ebfc1f7bad6e4731c12671e"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.8907342, "relation_name": "raw.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))))\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 raw.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_id\n , cast((select name\nfrom raw.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_name\n , cast((select version\nfrom raw.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": "raw", "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": "0cfdf5a2bf37c8de59fd04d624c654e0f3c50135ade5672540f56e99e316ad28"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.905945, "relation_name": "raw.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))))\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 raw.quality_measures._int_nqf2372_denominator\n\n)\n\n, mammography_codes as (\n\n select\n code\n , code_system\n from raw.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-02-20 20:47:44.615990+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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "5154133f60202353f7f9e3ad89ff63f8a1361d30f21892a764b763b38717ec79"}, "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": null}, "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": []}, "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": null}, "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}, "created_at": 1708461580.904468, "relation_name": "raw.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))))\n )\n}}\n\n/* selecting the full patient population as the grain of this table */\nwith patient as (\n\n select distinct patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\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 , denominator_flag\n from {{ ref('quality_measures__int_nqf2372_denominator') }}\n\n)\n\n, numerator 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 , numerator_flag\n from {{ ref('quality_measures__int_nqf2372_numerator') }}\n\n)\n\n, exclusions 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 , 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 patient.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 patient\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 evidence_date desc nulls last\n , exclusion_date desc nulls last\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 , 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__stg_core__patient", "package": null, "version": null}, {"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__stg_core__patient", "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\n/* selecting the full patient population as the grain of this table */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\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 , denominator_flag\n from raw.quality_measures._int_nqf2372_denominator\n\n)\n\n, numerator 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 , numerator_flag\n from raw.quality_measures._int_nqf2372_numerator\n\n)\n\n, exclusions 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 , exclusion_date\n , exclusion_reason\n , exclusion_flag\n from raw.quality_measures._int_nqf2372_exclusions\n\n)\n\n, measure_flags as (\n\n select\n patient.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 patient\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 evidence_date desc nulls last\n , exclusion_date desc nulls last\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 , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-02-20 20:47:44.615990+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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_nqf2372_exclude_dementia": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_dementia", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_dementia.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_dementia.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_dementia"], "alias": "_int_nqf2372_exclude_dementia", "checksum": {"name": "sha256", "checksum": "2961f61e7f5fd3fd5b44a73646dba576626654750cce2f3bb18c4e477a5c1e14"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_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": null}, "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 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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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_dementia", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.895982, "relation_name": "raw.quality_measures._int_nqf2372_exclude_dementia", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period AND a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372__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 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 , patients_with_frailty.exclusion_reason\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n where (\n pharmacy_claim_exclusions.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n or pharmacy_claim_exclusions.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n )\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\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n where medication_exclusions.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom frailty_with_dementia", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372__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.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372__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/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_dementia.sql", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period AND a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , paid_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.pharmacy_claim\n\n\n), patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372__frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from raw.quality_measures._value_set_codes\n where 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\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n where (\n pharmacy_claim_exclusions.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or pharmacy_claim_exclusions.paid_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\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\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n where medication_exclusions.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , paid_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_nqf2372_exclude_palliative": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_palliative", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_palliative.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_palliative.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_palliative"], "alias": "_int_nqf2372_exclude_palliative", "checksum": {"name": "sha256", "checksum": "c918c4c5bd88f84a06ba57d6bb47c5aa2ad66a028c856e6a11823c9615bed9f6"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients using palliative services 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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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_palliative", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.901079, "relation_name": "raw.quality_measures._int_nqf2372_exclude_palliative", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Palliative care services used by patient any time during the measurement period\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 'Palliative Care Encounter'\n , 'Palliative Care Intervention'\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 , 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, 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, palliative_care as (\n\n select\n denominator.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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\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 where observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\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 where procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom palliative_care", "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": [], "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_exclude_palliative.sql", "compiled": true, "compiled_code": "\n\n/*\n Palliative care services used by patient any time during the measurement period\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from raw.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 raw.quality_measures._value_set_codes\n where concept_name in (\n 'Palliative Care Encounter'\n , 'Palliative Care Intervention'\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 , 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, 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, palliative_care as (\n\n select\n denominator.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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\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 where observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\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 where procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom palliative_care", "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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_exclusions": {"database": "raw", "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": "c6a26a6b0fb05ea2806a8181b62d61e27d1ba02c27f21929481c879ebd33b1fb"}, "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": null}, "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": []}, "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": []}, "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": null}, "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}, "created_at": 1708461580.90297, "relation_name": "raw.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))))\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 , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_nqf2372_denominator') }}\n\n)\n\n, advanced_illness as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_advanced_illness') }}\n\n)\n\n, dementia as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_dementia') }}\n\n)\n\n, hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_hospice') }}\n\n)\n\n, institutional as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_institutional') }}\n\n)\n\n, mastectomy 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\n, palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_palliative') }}\n\n)\n\n, denominator_with_advanced_illness 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 , case\n when advanced_illness.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , advanced_illness.exclusion_date\n , advanced_illness.exclusion_reason\n from denominator\n left join advanced_illness\n on denominator.patient_id = advanced_illness.patient_id\n\n)\n\n, denominator_with_dementia 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 , case\n when dementia.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , dementia.exclusion_date\n , dementia.exclusion_reason\n from denominator\n left join dementia\n on denominator.patient_id = dementia.patient_id\n\n)\n\n, denominator_with_hospice 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 , case\n when hospice.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , hospice.exclusion_date\n , hospice.exclusion_reason\n from denominator\n left join hospice\n on denominator.patient_id = hospice.patient_id\n\n)\n\n, denominator_with_institutional 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 , case\n when institutional.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , institutional.exclusion_date\n , institutional.exclusion_reason\n from denominator\n left join institutional\n on denominator.patient_id = institutional.patient_id\n\n)\n\n, denominator_with_mastectomy 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 , case\n when mastectomy.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , mastectomy.exclusion_date\n , mastectomy.exclusion_reason\n from denominator\n left join mastectomy\n on denominator.patient_id = mastectomy.patient_id\n\n)\n\n, denominator_with_palliative 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 , case\n when palliative.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , palliative.exclusion_date\n , palliative.exclusion_reason\n from denominator\n left join palliative\n on denominator.patient_id = palliative.patient_id\n\n)\n\n, exclusions_unioned as (\n\n select * from denominator_with_advanced_illness\n union all\n select * from denominator_with_dementia\n union all\n select * from denominator_with_hospice\n union all\n select * from denominator_with_institutional\n union all\n select * from denominator_with_mastectomy\n union all\n select * from denominator_with_palliative\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 , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(exclusion_flag as integer) as exclusion_flag\n from exclusions_unioned\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 , 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_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_exclude_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_exclude_dementia", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_exclude_hospice", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_exclude_institutional", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_exclude_mastectomy", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_exclude_palliative", "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_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative"]}, "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": "\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 , measure_id\n , measure_name\n , measure_version\n from raw.quality_measures._int_nqf2372_denominator\n\n)\n\n, advanced_illness as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_advanced_illness\n\n)\n\n, dementia as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_dementia\n\n)\n\n, hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_hospice\n\n)\n\n, institutional as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_institutional\n\n)\n\n, mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_mastectomy\n\n)\n\n, palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_palliative\n\n)\n\n, denominator_with_advanced_illness 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 , case\n when advanced_illness.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , advanced_illness.exclusion_date\n , advanced_illness.exclusion_reason\n from denominator\n left join advanced_illness\n on denominator.patient_id = advanced_illness.patient_id\n\n)\n\n, denominator_with_dementia 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 , case\n when dementia.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , dementia.exclusion_date\n , dementia.exclusion_reason\n from denominator\n left join dementia\n on denominator.patient_id = dementia.patient_id\n\n)\n\n, denominator_with_hospice 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 , case\n when hospice.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , hospice.exclusion_date\n , hospice.exclusion_reason\n from denominator\n left join hospice\n on denominator.patient_id = hospice.patient_id\n\n)\n\n, denominator_with_institutional 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 , case\n when institutional.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , institutional.exclusion_date\n , institutional.exclusion_reason\n from denominator\n left join institutional\n on denominator.patient_id = institutional.patient_id\n\n)\n\n, denominator_with_mastectomy 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 , case\n when mastectomy.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , mastectomy.exclusion_date\n , mastectomy.exclusion_reason\n from denominator\n left join mastectomy\n on denominator.patient_id = mastectomy.patient_id\n\n)\n\n, denominator_with_palliative 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 , case\n when palliative.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , palliative.exclusion_date\n , palliative.exclusion_reason\n from denominator\n left join palliative\n on denominator.patient_id = palliative.patient_id\n\n)\n\n, exclusions_unioned as (\n\n select * from denominator_with_advanced_illness\n union all\n select * from denominator_with_dementia\n union all\n select * from denominator_with_hospice\n union all\n select * from denominator_with_institutional\n union all\n select * from denominator_with_mastectomy\n union all\n select * from denominator_with_palliative\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 , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(exclusion_flag as integer) as exclusion_flag\n from exclusions_unioned\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 , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-02-20 20:47:44.615990+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": "raw", "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": "20d37b8969ab10d2558aaaacd61b8f468f2be15c0c811928d5392f7b0304e1e0"}, "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": null}, "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": []}, "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": null}, "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}, "created_at": 1708461580.8934789, "relation_name": "raw.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))))\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_end', 'hour') }} / 8766.0) as age\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_type\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 raw.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 raw.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_end\n ) / 8766.0) as age\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-02-20 20:47:44.615990+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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_type\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_exclude_hospice": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_hospice", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_hospice.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_hospice.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_hospice"], "alias": "_int_nqf2372_exclude_hospice", "checksum": {"name": "sha256", "checksum": "cf39611efb8664f7c8a5873de910d5aa4642e4ab4a5e3774a868d6e40b444e8b"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_hospice", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients using hospice services 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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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_hospice", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.897333, "relation_name": "raw.quality_measures._int_nqf2372_exclude_hospice", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Hospice services used by patient any time during the measurement period\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 'Hospice Care Ambulatory'\n , 'Hospice Encounter'\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 {{ ref('quality_measures__stg_core__observation') }}\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, procedures as (\n\n select\n patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n from {{ ref('quality_measures__stg_core__procedure') }}\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, 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, 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.normalized_code = exclusion_codes.code\n and procedures.normalized_code_type = exclusion_codes.code_system\n\n)\n\n, hospice as (\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 where observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\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 where procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom hospice", "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__observation", "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": [], "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__observation", "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/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_hospice.sql", "compiled": true, "compiled_code": "\n\n/*\n Hospice services used by patient any time during the measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from raw.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 raw.quality_measures._value_set_codes\n where concept_name in (\n 'Hospice Care Ambulatory'\n , 'Hospice Encounter'\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\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, procedures as (\n\n select\n patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__procedure\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, 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, 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.normalized_code = exclusion_codes.code\n and procedures.normalized_code_type = exclusion_codes.code_system\n\n)\n\n, hospice as (\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 where observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\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 where procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom hospice", "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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_denominator": {"database": "raw", "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": "b4486f850648c72a9ab815fa10c71b5ecc8df95931bfce77674fcd68af5b7c9c"}, "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": null}, "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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.9071062, "relation_name": "raw.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))))\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 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), visits_encounters as (\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_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\n,procedure_encounters as (\n select patient_id, PROCEDURE_DATE as min_date, PROCEDURE_DATE as max_date\n from {{ref('quality_measures__stg_core__procedure')}} proc\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(proc.normalized_code,proc.source_code) = visit_codes.code\n\n\n)\n,\nclaims_encounters as (\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\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, patients_with_age as (\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.BIRTH_DATE is not null\n\n)\n\nselect 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_type\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from raw.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), visits_encounters as (\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 raw.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\n,procedure_encounters as (\n select patient_id, PROCEDURE_DATE as min_date, PROCEDURE_DATE as max_date\n from __dbt__cte__quality_measures__stg_core__procedure proc\n inner join raw.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(proc.normalized_code,proc.source_code) = visit_codes.code\n\n\n)\n,\nclaims_encounters as (\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 raw.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\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, 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 ) / 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.BIRTH_DATE is not null\n\n)\n\nselect 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_type\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_exclude_dementia": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclude_dementia", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_dementia.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_dementia.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclude_dementia"], "alias": "_int_nqf0034_exclude_dementia", "checksum": {"name": "sha256", "checksum": "aa1b7de04547b3118c4881f7978d7e79b67a5d205c8531e86c276f60ce63013b"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_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": null}, "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 the reporting version of NQF 0034, Colorectal Cancer Screening.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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_dementia", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.910752, "relation_name": "raw.quality_measures._int_nqf0034_exclude_dementia", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period AND a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith\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 ( '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\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 {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on pharmacy_claim.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\n or pharmacy_claim.paid_date between pp.performance_period_begin_1yp and pp.performance_period_end\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\n\n, patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , concept_name\nfrom {{ref('quality_measures__int_nqf0034__frailty')}}\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.concept_name\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\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\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , patients_with_frailty.concept_name\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom frailty_with_dementia d", "language": "sql", "refs": [{"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}, {"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_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__frailty", "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__medication", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__frailty"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_dementia.sql", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period AND a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith\n __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , paid_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.pharmacy_claim\n\n\n), exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from raw.quality_measures._value_set_codes\n where 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\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 raw.quality_measures._int_nqf0034__performance_period pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 raw.quality_measures._int_nqf0034__performance_period pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 raw.quality_measures._int_nqf0034__performance_period pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 raw.quality_measures._int_nqf0034__performance_period pp\n on pharmacy_claim.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\n or pharmacy_claim.paid_date between pp.performance_period_begin_1yp and pp.performance_period_end\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\n\n, patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , concept_name\nfrom raw.quality_measures._int_nqf0034__frailty\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.concept_name\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\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\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , patients_with_frailty.concept_name\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom frailty_with_dementia d", "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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , paid_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_long": {"database": "raw", "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": "c5dcad10a4a404c61a7dc446e4b963cb54f89268fbb38607bc8546e9376b1102"}, "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": null}, "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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.9156969, "relation_name": "raw.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))))\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\n/* selecting the full patient population as the grain of this table */\nwith patient as (\n\n select distinct patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n, 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 patient.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 patient\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on 1 = 1\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 evidence_date desc nulls last\n , exclusion_date desc nulls last\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 , 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__stg_core__patient", "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__stg_core__patient", "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": "/* selecting the full patient population as the grain of this table */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, denominator as (\n\n select\n patient_id\n from raw.quality_measures._int_nqf0034_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n from raw.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 raw.quality_measures._int_nqf0034_exclusions\n\n)\n\n, measure_flags as (\n\n select\n patient.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 raw.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n ) as measure_id\n , (\n\n select name\nfrom raw.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_name\n , (\n select version\nfrom raw.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_version\n from patient\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 evidence_date desc nulls last\n , exclusion_date desc nulls last\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 , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-02-20 20:47:44.615990+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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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__performance_period": {"database": "raw", "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": "cca2e6986e8b7f77a62452621da6107ca7e54007c5d07495b7da112464495da7"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.9194, "relation_name": "raw.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))))\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": "raw", "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": "6298ca02233276966995fda43fa85da02fcd4130dbcf384e4e46cbfd75b4504f"}, "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": null}, "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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.914521, "relation_name": "raw.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))))\n )\n}}\n\nwith exclusions as (\nselect *\nFrom {{ref('quality_measures__int_nqf0034_exclude_advanced_illness')}}\n\nunion all\n\nselect *\nFrom {{ref('quality_measures__int_nqf0034_exclude_colectomy_cancer')}}\n\nunion all\n\nselect *\nFrom {{ref('quality_measures__int_nqf0034_exclude_dementia')}}\n\nunion all\n\nselect *\nFrom {{ref('quality_measures__int_nqf0034_exclude_hospice_palliative')}}\n\nunion all\n\nselect *\nFrom {{ref('quality_measures__int_nqf0034_exclude_institutional_snp')}}\n)\n\nselect exclusions.*\nfrom exclusions\ninner join {{ref('quality_measures__int_nqf0034_denominator')}} p\n on exclusions.patient_id = p.patient_id", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0034_exclude_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_exclude_colectomy_cancer", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_exclude_dementia", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_exclude_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_exclude_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "model.the_tuva_project.quality_measures__int_nqf0034_denominator"]}, "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": "\n\nwith exclusions as (\nselect *\nFrom raw.quality_measures._int_nqf0034_exclude_advanced_illness\n\nunion all\n\nselect *\nFrom raw.quality_measures._int_nqf0034_exclude_colectomy_cancer\n\nunion all\n\nselect *\nFrom raw.quality_measures._int_nqf0034_exclude_dementia\n\nunion all\n\nselect *\nFrom raw.quality_measures._int_nqf0034_exclude_hospice_palliative\n\nunion all\n\nselect *\nFrom raw.quality_measures._int_nqf0034_exclude_institutional_snp\n)\n\nselect exclusions.*\nfrom exclusions\ninner join raw.quality_measures._int_nqf0034_denominator p\n on exclusions.patient_id = p.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.quality_measures__int_nqf0034__frailty": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf0034__frailty", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__frailty.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__frailty.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__frailty", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034__frailty"], "alias": "_int_nqf0034__frailty", "checksum": {"name": "sha256", "checksum": "64c3341f811ebbe1082f8146944799c29089899c8d4412fa6599817bafd65559"}, "config": {"enabled": true, "alias": "_int_nqf0034__frailty", "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Frailty definition for nqf 0034 colorectal cancer screening used in multiple exclusions\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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__frailty", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false}, "created_at": 1708461580.918227, "relation_name": "raw.quality_measures._int_nqf0034__frailty", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients 66 years of age and older with at least one claim/encounter\nfor frailty during the measurement period (not full exclusion, used\nin conjunction with dementia medication or\n*/\n\n\nwith aged_patients as (\n select distinct patient_id\n from {{ref('quality_measures__int_nqf0034_denominator')}}\n where max_age >=66\n\n)\n\n, exclusion_codes as (\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 , case when code in ('G2100','G2101') then 1 else 0 end as meets_all_criteria\n From {{ref('quality_measures__value_sets')}}\n where concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n\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 {{ ref('quality_measures__stg_core__condition') }} )\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\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 aged_patients\n on conditions.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on\n recorded_date between pp.performance_period_begin and pp.performance_period_end\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 aged_patients\n on medical_claim.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp\n on claim_start_date between pp.performance_period_begin and pp.performance_period_end\n where exclusion_codes.code_system = 'hcpcs'\n\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 aged_patients\n on observations.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp\n on observation_date between pp.performance_period_begin and pp.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\n from procedures\n inner join aged_patients\n on procedures.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on\n procedure_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as concept_name\n from condition_exclusions\n\n union distinct\n\n select patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , concept_name as concept_name\n from med_claim_exclusions\n\n union distinct\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as concept_name\n from observation_exclusions\n\n union distinct\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as concept_name\n from procedure_exclusions\n\n)\n, ordered_exclusions as (\n select patient_id\n , exclusion_date\n , concept_name\n , row_number() over (partition by patient_id order by exclusion_date) as exclusion_row\n from patients_with_exclusions\n )\n\nselect patient_id\n , exclusion_date\n , concept_name\nfrom ordered_exclusions", "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__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__int_nqf0034__performance_period", "package": null, "version": null}, {"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_nqf0034__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0034_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_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__int_nqf0034__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__frailty.sql", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients 66 years of age and older with at least one claim/encounter\nfor frailty during the measurement period (not full exclusion, used\nin conjunction with dementia medication or\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), aged_patients as (\n select distinct patient_id\n from raw.quality_measures._int_nqf0034_denominator\n where max_age >=66\n\n)\n\n, exclusion_codes as (\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 , case when code in ('G2100','G2101') then 1 else 0 end as meets_all_criteria\n From raw.quality_measures._value_set_codes\n where concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n\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\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\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 aged_patients\n on conditions.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n inner join raw.quality_measures._int_nqf0034__performance_period as pp on\n recorded_date between pp.performance_period_begin and pp.performance_period_end\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 aged_patients\n on medical_claim.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n inner join raw.quality_measures._int_nqf0034__performance_period as pp\n on claim_start_date between pp.performance_period_begin and pp.performance_period_end\n where exclusion_codes.code_system = 'hcpcs'\n\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 aged_patients\n on observations.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n inner join raw.quality_measures._int_nqf0034__performance_period as pp\n on observation_date between pp.performance_period_begin and pp.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\n from procedures\n inner join aged_patients\n on procedures.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n inner join raw.quality_measures._int_nqf0034__performance_period as pp on\n procedure_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as concept_name\n from condition_exclusions\n\n union distinct\n\n select patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , concept_name as concept_name\n from med_claim_exclusions\n\n union distinct\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as concept_name\n from observation_exclusions\n\n union distinct\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as concept_name\n from procedure_exclusions\n\n)\n, ordered_exclusions as (\n select patient_id\n , exclusion_date\n , concept_name\n , row_number() over (partition by patient_id order by exclusion_date) as exclusion_row\n from patients_with_exclusions\n )\n\nselect patient_id\n , exclusion_date\n , concept_name\nfrom ordered_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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_exclude_hospice_palliative": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclude_hospice_palliative", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_hospice_palliative.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_hospice_palliative.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclude_hospice_palliative"], "alias": "_int_nqf0034_exclude_hospice_palliative", "checksum": {"name": "sha256", "checksum": "3c6edbda4dde2dc317e096187c65b3e0e7c7a157154b2ca8e1a0b83f47f1dacc"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_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": null}, "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 version of NQF 0034, Colorectal Cancer Screening. \n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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_hospice_palliative", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.911941, "relation_name": "raw.quality_measures._int_nqf0034_exclude_hospice_palliative", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9710\n*/\n\n\nwith exclusion_codes as (\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 concept_name in (\n 'Hospice Care Ambulatory'\n , 'Hospice Encounter'\n , 'Palliative Care Encounter'\n , 'Palliative Care Intervention'\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 {{ ref('quality_measures__stg_core__condition') }} )\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 inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp\n on recorded_date between pp.performance_period_begin and pp.performance_period_end\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 inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on 1=1\n where exclusion_codes.code_system = 'hcpcs'\n and claim_start_date between pp.performance_period_begin and pp.performance_period_end\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 inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on 1=1\n where observation_date between pp.performance_period_begin and pp.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 inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on 1=1\n where procedure_date between pp.performance_period_begin and pp.performance_period_end\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\n\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\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}, {"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_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "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", "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_exclude_hospice_palliative.sql", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9710\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), exclusion_codes as (\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 raw.quality_measures._value_set_codes\n where concept_name in (\n 'Hospice Care Ambulatory'\n , 'Hospice Encounter'\n , 'Palliative Care Encounter'\n , 'Palliative Care Intervention'\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\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 inner join raw.quality_measures._int_nqf0034__performance_period as pp\n on recorded_date between pp.performance_period_begin and pp.performance_period_end\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 inner join raw.quality_measures._int_nqf0034__performance_period as pp on 1=1\n where exclusion_codes.code_system = 'hcpcs'\n and claim_start_date between pp.performance_period_begin and pp.performance_period_end\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 inner join raw.quality_measures._int_nqf0034__performance_period as pp on 1=1\n where observation_date between pp.performance_period_begin and pp.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 inner join raw.quality_measures._int_nqf0034__performance_period as pp on 1=1\n where procedure_date between pp.performance_period_begin and pp.performance_period_end\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\n\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_exclude_advanced_illness": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclude_advanced_illness", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_advanced_illness.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_advanced_illness.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclude_advanced_illness"], "alias": "_int_nqf0034_exclude_advanced_illness", "checksum": {"name": "sha256", "checksum": "9f402d568942d11a9026800b6150e95f5dde384f6aa80df735d69aab9b0c103a"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_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": null}, "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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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_advanced_illness", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.9082692, "relation_name": "raw.quality_measures._int_nqf0034_exclude_advanced_illness", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n OR two outpatient, observation, ED or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\nwith encounter_exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n , case when concept_name = 'Acute Inpatient' then 'Acute Inpatient'\n else 'Other Encounter' end as concept_category\n , case when concept_name = 'Acute Inpatient' then 1\n else 2 end as qualifying_count\n from {{ ref('quality_measures__value_sets') }}\n where concept_name in (\n 'Acute Inpatient'\n , 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n\n)\n\n, condition_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 'Advanced Illness'\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/* -- observation based exclusions removed until we have better testing data\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 select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , condition_exclusion_codes.concept_name\n from conditions\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on conditions.recorded_date between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join condition_exclusion_codes\n on conditions.code = condition_exclusion_codes.code\n and conditions.code_type = condition_exclusion_codes.code_system\n\n/* -- observations temporarily removed until we have better testing data\n union all\n select\n observations.patient_id\n , cast(null as {{ dbt.type_string() }}) as claim_id\n , observations.observation_date\n , condition_exclusion_codes.concept_name\n from observations\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on observations.observation_date between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join condition_exclusion_codes\n on observations.code = condition_exclusion_codes.code\n and observations.code_type = condition_exclusion_codes.code_system\n*/\n\n\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 , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from medical_claim\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on coalesce(medical_claim.claim_start_date,medical_claim.claim_end_date) between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join encounter_exclusion_codes\n on medical_claim.hcpcs_code = encounter_exclusion_codes.code\n where encounter_exclusion_codes.code_system = 'hcpcs'\n\n)\n\n/* -- observations temporarily removed until we get better testing data\n, observation_exclusions as (\n\n\n select\n observations.patient_id\n , observations.observation_date\n , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from observations\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on observations.observation_date between pp.performance_period_begin_1yp and pp.performance_period_end\n\n inner join encounter_exclusion_codes\n on observations.code = encounter_exclusion_codes.code\n and observations.code_type = encounter_exclusion_codes.code_system\n\n)\n*/\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from procedures\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on procedures.procedure_date between pp.performance_period_begin_1yp and pp.performance_period_end\n\n inner join encounter_exclusion_codes\n on procedures.code = encounter_exclusion_codes.code\n and procedures.code_type = encounter_exclusion_codes.code_system\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n*/\n, patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , concept_name\nfrom {{ref('quality_measures__int_nqf0034__frailty')}}\n\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\n*/\n, encounters_with_conditions 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 , med_claim_exclusions.concept_name\n || ' with '\n || condition_exclusions.concept_name\n as exclusion_reason\n , med_claim_exclusions.concept_category\n , med_claim_exclusions.qualifying_count\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\n\n union all\n\n/* -- observations temporarily removed until we get better testing data\n select distinct\n patients_with_frailty.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n , observation_exclusions.concept_category\n , observation_exclusions.qualifying_count\n from patients_with_frailty\n inner join observation_exclusions\n on patients_with_frailty.patient_id = observation_exclusions.patient_id\n inner join condition_exclusions\n on observation_exclusions.patient_id = condition_exclusions.patient_id\n and observation_exclusions.observation_date = condition_exclusions.recorded_date\n\n union all\n*/\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n , procedure_exclusions.concept_category\n , procedure_exclusions.qualifying_count\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\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND two outpatient, observation, ED or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\n/*\n Filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n\n\n, qualifying_encounters as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\nfrom encounters_with_conditions e\nqualify dense_rank() over(partition by patient_id,concept_category order by exclusion_date) >= qualifying_count\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom qualifying_encounters", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "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}, {"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_nqf0034__performance_period", "package": null, "version": null}, {"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_nqf0034__frailty", "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_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__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__frailty"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_advanced_illness.sql", "compiled": true, "compiled_code": "\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n OR two outpatient, observation, ED or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), encounter_exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n , case when concept_name = 'Acute Inpatient' then 'Acute Inpatient'\n else 'Other Encounter' end as concept_category\n , case when concept_name = 'Acute Inpatient' then 1\n else 2 end as qualifying_count\n from raw.quality_measures._value_set_codes\n where concept_name in (\n 'Acute Inpatient'\n , 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n\n)\n\n, condition_exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from raw.quality_measures._value_set_codes\n where concept_name in (\n 'Advanced Illness'\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/* -- observation based exclusions removed until we have better testing data\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 select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , condition_exclusion_codes.concept_name\n from conditions\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on conditions.recorded_date between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join condition_exclusion_codes\n on conditions.code = condition_exclusion_codes.code\n and conditions.code_type = condition_exclusion_codes.code_system\n\n/* -- observations temporarily removed until we have better testing data\n union all\n select\n observations.patient_id\n , cast(null as TEXT) as claim_id\n , observations.observation_date\n , condition_exclusion_codes.concept_name\n from observations\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on observations.observation_date between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join condition_exclusion_codes\n on observations.code = condition_exclusion_codes.code\n and observations.code_type = condition_exclusion_codes.code_system\n*/\n\n\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 , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from medical_claim\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on coalesce(medical_claim.claim_start_date,medical_claim.claim_end_date) between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join encounter_exclusion_codes\n on medical_claim.hcpcs_code = encounter_exclusion_codes.code\n where encounter_exclusion_codes.code_system = 'hcpcs'\n\n)\n\n/* -- observations temporarily removed until we get better testing data\n, observation_exclusions as (\n\n\n select\n observations.patient_id\n , observations.observation_date\n , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from observations\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on observations.observation_date between pp.performance_period_begin_1yp and pp.performance_period_end\n\n inner join encounter_exclusion_codes\n on observations.code = encounter_exclusion_codes.code\n and observations.code_type = encounter_exclusion_codes.code_system\n\n)\n*/\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from procedures\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on procedures.procedure_date between pp.performance_period_begin_1yp and pp.performance_period_end\n\n inner join encounter_exclusion_codes\n on procedures.code = encounter_exclusion_codes.code\n and procedures.code_type = encounter_exclusion_codes.code_system\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n*/\n, patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , concept_name\nfrom raw.quality_measures._int_nqf0034__frailty\n\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\n*/\n, encounters_with_conditions 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 , med_claim_exclusions.concept_name\n || ' with '\n || condition_exclusions.concept_name\n as exclusion_reason\n , med_claim_exclusions.concept_category\n , med_claim_exclusions.qualifying_count\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\n\n union all\n\n/* -- observations temporarily removed until we get better testing data\n select distinct\n patients_with_frailty.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n , observation_exclusions.concept_category\n , observation_exclusions.qualifying_count\n from patients_with_frailty\n inner join observation_exclusions\n on patients_with_frailty.patient_id = observation_exclusions.patient_id\n inner join condition_exclusions\n on observation_exclusions.patient_id = condition_exclusions.patient_id\n and observation_exclusions.observation_date = condition_exclusions.recorded_date\n\n union all\n*/\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n , procedure_exclusions.concept_category\n , procedure_exclusions.qualifying_count\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\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND two outpatient, observation, ED or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\n/*\n Filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n\n\n, qualifying_encounters as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\nfrom encounters_with_conditions e\nqualify dense_rank() over(partition by patient_id,concept_category order by exclusion_date) >= qualifying_count\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom qualifying_encounters", "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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_exclude_institutional_snp": {"database": "raw", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclude_institutional_snp", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_institutional_snp.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_institutional_snp.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclude_institutional_snp"], "alias": "_int_nqf0034_exclude_institutional_snp", "checksum": {"name": "sha256", "checksum": "5cb4e700829a5c7fa8a9e31905679350f6910351b1087788ef84a9ce6bf47366"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_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": null}, "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 version of NQF 0034, Colorectal Cancer Screening. \n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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_institutional_snp", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708461580.913337, "relation_name": "raw.quality_measures._int_nqf0034_exclude_institutional_snp", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Patients greater than or equal to 66 in Institutional Special Needs Plans (SNP)\n or residing in long term care\n\n Future enhancement: group claims into encounters\n*/\n\nwith aged_patients as (\n select distinct patient_id\n from {{ref('quality_measures__int_nqf0034_denominator')}}\n where max_age >=66\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 aged_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 aged_patients\n inner join medical_claim\n on aged_patients.patient_id = medical_claim.patient_id\n\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) between pp.performance_period_begin and pp.performance_period_end\n\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\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0034_denominator", "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}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__stg_medical_claim", "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_exclude_institutional_snp.sql", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 in Institutional Special Needs Plans (SNP)\n or residing in long term care\n\n Future enhancement: group claims into encounters\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), aged_patients as (\n select distinct patient_id\n from raw.quality_measures._int_nqf0034_denominator\n where max_age >=66\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 aged_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 aged_patients\n inner join medical_claim\n on aged_patients.patient_id = medical_claim.patient_id\n\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) between pp.performance_period_begin and pp.performance_period_end\n\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\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom exclusions", "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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_nqf0034_exclude_colectomy_cancer": {"database": "raw", "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": "e229d8f1e7f4e6a18d48fa5cd4b6638f4f6d4b4eaec10333d5a51bebf970ec65"}, "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": null}, "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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.909579, "relation_name": "raw.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))))\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 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 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\n\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), exclusion_codes as (\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 raw.quality_measures._value_set_codes\n where 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\n\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "078c46c8f97bb936b8c770594dd84e0ceaed13fb9d0bdabc6bdf1140aaad1f6e"}, "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": null}, "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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.916894, "relation_name": "raw.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))))\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\n from {{ ref('quality_measures__int_nqf0034_denominator') }}\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) end as code_system\n , concept_name\n From {{ref('quality_measures__value_sets')}}\n where 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, screening_periods as (\n select *,\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 end as effective_performance_period_begin\n\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 select 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,qualifying_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) between screening_periods.effective_performance_period_begin and 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 or ( labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system )\n )\n\n,qualifying_events as (\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() }}) patient_id\n ,cast( evidence_date as date) as evidence_date\n ,cast( evidence as {{ dbt.type_string() }}) as evidence\n\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.lab_result\n\n\n), denominator as (\n\n select\n patient_id\n\n from raw.quality_measures._int_nqf0034_denominator\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) end as code_system\n , concept_name\n From raw.quality_measures._value_set_codes\n where 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, screening_periods as (\n select *,\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 end as effective_performance_period_begin\n\n from screening_codes\n inner join raw.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 select 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,qualifying_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) between screening_periods.effective_performance_period_begin and 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 or ( labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system )\n )\n\n,qualifying_events as (\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) patient_id\n ,cast( evidence_date as date) as evidence_date\n ,cast( evidence as TEXT) as evidence\n\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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.ccsr__stg_core__condition": {"database": "raw", "schema": "jaffle_shop", "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": "ae7ac148ae1f91be3e61cfbd37d128eb0e0159a50eb0afdfde11c5ed4b09d6c7"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.9509828, "relation_name": null, "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\nselect *, '{{ 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 *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "schema": "jaffle_shop", "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": "4f867df3d4e43f41e54d7afa4c185d9ba187be688de1272437ae2d5ce81fddf2"}, "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": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.95178, "relation_name": null, "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\nselect *, '{{ 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 *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "08f710d6b4eef478aa581e199ed0a7f78744f26bb88f18b74cca4bb3ab129898"}, "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": null}, "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`).", "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`.", "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.", "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.", "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.", "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": null}, "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}, "created_at": 1708461580.94896, "relation_name": "raw.ccsr.singular_condition_category", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 = true\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.ccsr.long_condition_category\nwhere \n is_ip_default_category = true\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": "raw", "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": "5f7995cd41aecad7b78dbf61bde2f50e10cce98af87dbb6f43ba1703c26f86c1"}, "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": null}, "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.", "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`.", "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.", "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.", "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.", "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.", "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.", "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.", "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.", "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": null}, "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}, "created_at": 1708461580.947501, "relation_name": "raw.ccsr.long_condition_category", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 using(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 *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\nwhere normalized_code_type = 'icd-10-cm'\n), ccsr__dx_vertical_pivot as (\n \n select * from raw.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 raw.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-02-20 20:47:44.615990+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 using(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 *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "dbba55d2513c9c38777a479b9fad26a8d61fc7609f779c518b13bdfe8bed9bdb"}, "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": null}, "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.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The encounter_id for the encounter where this procedure was performed.", "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.", "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.", "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.", "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.", "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": null}, "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}, "created_at": 1708461580.95034, "relation_name": "raw.ccsr.long_procedure_category", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\nwith procedure as (\n \n select * from {{ ref('ccsr__stg_core__procedure') }}\n\n), ccsr__procedure_category_map as (\n\n select * from {{ ref ('ccsr__procedure_category_map') }}\n\n)\n\nselect distinct\n procedure.encounter_id,\n procedure.patient_id,\n procedure.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 procedure\nleft join ccsr__procedure_category_map\n on procedure.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 *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), procedure as (\n \n select * from __dbt__cte__ccsr__stg_core__procedure\n\n), ccsr__procedure_category_map as (\n\n select * from raw.ccsr.procedure_category_map\n\n)\n\nselect distinct\n procedure.encounter_id,\n procedure.patient_id,\n procedure.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom procedure\nleft join ccsr__procedure_category_map\n on procedure.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 *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "3e3719d1c3ca45862fb5fcad7a2d75993abc41c0c3d1b57f013d335ed5ab8e6c"}, "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": null}, "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\ninto a long format table. While the seed uses 6 columns to represent the 6 CCSR codes that\nmay be present, this generates one row for each CCSR category per ICD code, so up to\n6 rows per code. \n\nThis model includes details and descriptions of the CCSR parent category and body systems that are inherited by the final models.\n\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.", "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.", "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.", "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.", "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.", "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.", "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": null}, "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}, "created_at": 1708461580.944281, "relation_name": "raw.ccsr.dx_vertical_pivot", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 left(ccsr_category_{{ i }}, 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 (ccsr_category_{{ i }} = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_{{ i }} = default_ccsr_category_op) 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 raw.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 left(ccsr_category_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 (ccsr_category_1 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_1 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_2, 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 (ccsr_category_2 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_2 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_3, 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 (ccsr_category_3 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_3 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_4, 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 (ccsr_category_4 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_4 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_5, 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 (ccsr_category_5 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_5 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_6, 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 (ccsr_category_6 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_6 = default_ccsr_category_op) as is_op_default_category\n from codes \n \n\n)\n\nselect distinct\n *,\n '2024-02-20 20:47:44.615990+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": "raw", "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": "9de066ce4bc064a683d44abe2552b778ec8ea2caa7aa7b62dfae61136ceaeb6d"}, "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": null}, "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.", "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.", "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.", "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.", "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": null}, "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}, "created_at": 1708461580.945746, "relation_name": "raw.ccsr.procedure_category_map", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\nselect \n icd_10_pcs as code,\n icd_10_pcs_description as code_description,\n prccsr as ccsr_category,\n left(prccsr, 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 left(prccsr, 3) as ccsr_parent_category,\n prccsr_description as ccsr_category_description,\n clinical_domain,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_eligibility": {"database": "raw", "schema": "jaffle_shop", "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": "ae85cc14e5b92eed2bebd1d7e8e9c213e75ff0410762d274a4cacb013a1882ce"}, "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": "#abab26"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.973793, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n patient_id\n, enrollment_start_date\n, enrollment_end_date\n, payer\n, 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": [], "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "schema": "jaffle_shop", "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": "f1dce1c43ad38cefb74a3ecfe96f3f74d2715bcb29c6bb1a6dbe3dd8fa318793"}, "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": "#abab26"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.9744792, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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, 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": [], "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "schema": "jaffle_shop", "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": "cffd881a875dd7c499c0498fdf37b17a0fc623018b0b73fb175b2d9c3e3edd36"}, "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": "#abab26"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.975168, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n\nSELECT\n patient_id\n, dispensing_date\n, paid_amount\n, allowed_amount\n, payer\n, 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": [], "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_amount\n, allowed_amount\n, payer\n, plan\n, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "9b6818647e1d4ce7de181d8ba5762a54d82c9ea3e73a372e81afd58f79929df8"}, "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": "#abab26"}, "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": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.966218, "relation_name": "raw.financial_pmpm.pmpm_payer", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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_visit_paid) / COUNT(1) AS office_visit_paid,\n SUM(ancillary_paid) / COUNT(1) AS ancillary_paid,\n SUM(pharmacy_paid) / COUNT(1) AS pharmacy_paid,\n SUM(other_paid) / COUNT(1) AS other_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_paid) / COUNT(1) AS ambulatory_surgery_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(hospice_paid) / COUNT(1) AS 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(office_visit_paid_2) / COUNT(1) AS office_visit_paid_2,\n SUM(outpatient_hospital_or_clinic_paid) / COUNT(1) AS outpatient_hospital_or_clinic_paid,\n SUM(outpatient_psychiatric_paid) / COUNT(1) AS outpatient_psychiatric_paid,\n SUM(outpatient_rehabilitation_paid) / COUNT(1) AS outpatient_rehabilitation_paid,\n SUM(skilled_nursing_paid) / COUNT(1) AS skilled_nursing_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_visit_allowed) / COUNT(1) AS office_visit_allowed,\n SUM(ancillary_allowed) / COUNT(1) AS ancillary_allowed,\n SUM(pharmacy_allowed) / COUNT(1) AS pharmacy_allowed,\n SUM(other_allowed) / COUNT(1) AS other_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_allowed) / COUNT(1) AS ambulatory_surgery_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(hospice_allowed) / COUNT(1) AS 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(office_visit_allowed_2) / COUNT(1) AS office_visit_allowed_2,\n SUM(outpatient_hospital_or_clinic_allowed) / COUNT(1) AS outpatient_hospital_or_clinic_allowed,\n SUM(outpatient_psychiatric_allowed) / COUNT(1) AS outpatient_psychiatric_allowed,\n SUM(outpatient_rehabilitation_allowed) / COUNT(1) AS outpatient_rehabilitation_allowed,\n SUM(skilled_nursing_allowed) / COUNT(1) AS skilled_nursing_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 1,2,3", "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_visit_paid) / COUNT(1) AS office_visit_paid,\n SUM(ancillary_paid) / COUNT(1) AS ancillary_paid,\n SUM(pharmacy_paid) / COUNT(1) AS pharmacy_paid,\n SUM(other_paid) / COUNT(1) AS other_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_paid) / COUNT(1) AS ambulatory_surgery_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(hospice_paid) / COUNT(1) AS 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(office_visit_paid_2) / COUNT(1) AS office_visit_paid_2,\n SUM(outpatient_hospital_or_clinic_paid) / COUNT(1) AS outpatient_hospital_or_clinic_paid,\n SUM(outpatient_psychiatric_paid) / COUNT(1) AS outpatient_psychiatric_paid,\n SUM(outpatient_rehabilitation_paid) / COUNT(1) AS outpatient_rehabilitation_paid,\n SUM(skilled_nursing_paid) / COUNT(1) AS skilled_nursing_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_visit_allowed) / COUNT(1) AS office_visit_allowed,\n SUM(ancillary_allowed) / COUNT(1) AS ancillary_allowed,\n SUM(pharmacy_allowed) / COUNT(1) AS pharmacy_allowed,\n SUM(other_allowed) / COUNT(1) AS other_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_allowed) / COUNT(1) AS ambulatory_surgery_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(hospice_allowed) / COUNT(1) AS 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(office_visit_allowed_2) / COUNT(1) AS office_visit_allowed_2,\n SUM(outpatient_hospital_or_clinic_allowed) / COUNT(1) AS outpatient_hospital_or_clinic_allowed,\n SUM(outpatient_psychiatric_allowed) / COUNT(1) AS outpatient_psychiatric_allowed,\n SUM(outpatient_rehabilitation_allowed) / COUNT(1) AS outpatient_rehabilitation_allowed,\n SUM(skilled_nursing_allowed) / COUNT(1) AS skilled_nursing_allowed,\n SUM(urgent_care_allowed) / COUNT(1) AS urgent_care_allowed,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nFROM raw.financial_pmpm.pmpm_prep a\nGROUP BY 1,2,3", "extra_ctes_injected": true, "extra_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": "raw", "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": "04f4a81f4ccd3261af1b60263f314ecb6ef920c7ce85e9ec5a12e969410967b4"}, "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": "#abab26"}, "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": []}, "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": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.961869, "relation_name": "raw.financial_pmpm.pmpm_prep", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith combine as (\nSELECT\n a.patient_id,\n a.year_month,\n a.payer,\n a.plan, \n a.data_source,\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_visit_paid, 0) AS office_visit_paid,\n COALESCE(b.ancillary_paid, 0) AS ancillary_paid,\n COALESCE(b.pharmacy_paid, 0) AS pharmacy_paid,\n COALESCE(b.other_paid, 0) AS other_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_paid, 0) AS ambulatory_surgery_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.hospice_paid, 0) AS 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.office_visit_paid, 0) AS office_visit_paid_2,\n COALESCE(c.outpatient_hospital_or_clinic_paid, 0) AS outpatient_hospital_or_clinic_paid,\n COALESCE(c.outpatient_psychiatric_paid, 0) AS outpatient_psychiatric_paid,\n COALESCE(c.outpatient_rehabilitation_paid, 0) AS outpatient_rehabilitation_paid,\n COALESCE(c.skilled_nursing_paid, 0) AS skilled_nursing_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_visit_allowed, 0) AS office_visit_allowed,\n COALESCE(d.ancillary_allowed, 0) AS ancillary_allowed,\n COALESCE(d.pharmacy_allowed, 0) AS pharmacy_allowed,\n COALESCE(d.other_allowed, 0) AS other_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_allowed, 0) AS ambulatory_surgery_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.hospice_allowed, 0) AS 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.office_visit_allowed, 0) AS office_visit_allowed_2,\n COALESCE(e.outpatient_hospital_or_clinic_allowed, 0) AS outpatient_hospital_or_clinic_allowed,\n COALESCE(e.outpatient_psychiatric_allowed, 0) AS outpatient_psychiatric_allowed,\n COALESCE(e.outpatient_rehabilitation_allowed, 0) AS outpatient_rehabilitation_allowed,\n COALESCE(e.skilled_nursing_allowed, 0) AS skilled_nursing_allowed,\n COALESCE(e.urgent_care_allowed, 0) AS urgent_care_allowed\nFROM {{ ref('financial_pmpm__member_months') }} a\nleft join {{ ref('financial_pmpm__service_category_1_paid_pivot') }} 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\nleft join {{ ref('financial_pmpm__service_category_2_paid_pivot') }} 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\nleft join {{ ref('financial_pmpm__service_category_1_allowed_pivot') }} 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\nleft join {{ ref('financial_pmpm__service_category_2_allowed_pivot') }} 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, inpatient_paid + outpatient_paid + office_visit_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n, inpatient_paid + outpatient_paid + office_visit_paid + ancillary_paid + other_paid as medical_paid\n, inpatient_allowed + outpatient_allowed + office_visit_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n, inpatient_allowed + outpatient_allowed + office_visit_allowed + ancillary_allowed + other_allowed as medical_allowed\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom combine", "language": "sql", "refs": [{"name": "financial_pmpm__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": [], "nodes": ["model.the_tuva_project.financial_pmpm__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 (\nSELECT\n a.patient_id,\n a.year_month,\n a.payer,\n a.plan, \n a.data_source,\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_visit_paid, 0) AS office_visit_paid,\n COALESCE(b.ancillary_paid, 0) AS ancillary_paid,\n COALESCE(b.pharmacy_paid, 0) AS pharmacy_paid,\n COALESCE(b.other_paid, 0) AS other_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_paid, 0) AS ambulatory_surgery_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.hospice_paid, 0) AS 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.office_visit_paid, 0) AS office_visit_paid_2,\n COALESCE(c.outpatient_hospital_or_clinic_paid, 0) AS outpatient_hospital_or_clinic_paid,\n COALESCE(c.outpatient_psychiatric_paid, 0) AS outpatient_psychiatric_paid,\n COALESCE(c.outpatient_rehabilitation_paid, 0) AS outpatient_rehabilitation_paid,\n COALESCE(c.skilled_nursing_paid, 0) AS skilled_nursing_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_visit_allowed, 0) AS office_visit_allowed,\n COALESCE(d.ancillary_allowed, 0) AS ancillary_allowed,\n COALESCE(d.pharmacy_allowed, 0) AS pharmacy_allowed,\n COALESCE(d.other_allowed, 0) AS other_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_allowed, 0) AS ambulatory_surgery_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.hospice_allowed, 0) AS 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.office_visit_allowed, 0) AS office_visit_allowed_2,\n COALESCE(e.outpatient_hospital_or_clinic_allowed, 0) AS outpatient_hospital_or_clinic_allowed,\n COALESCE(e.outpatient_psychiatric_allowed, 0) AS outpatient_psychiatric_allowed,\n COALESCE(e.outpatient_rehabilitation_allowed, 0) AS outpatient_rehabilitation_allowed,\n COALESCE(e.skilled_nursing_allowed, 0) AS skilled_nursing_allowed,\n COALESCE(e.urgent_care_allowed, 0) AS urgent_care_allowed\nFROM raw.financial_pmpm.member_months a\nleft join raw.financial_pmpm._int_service_category_1_paid_pivot 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\nleft join raw.financial_pmpm._int_service_category_2_paid_pivot 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\nleft join raw.financial_pmpm._int_service_category_1_allowed_pivot 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\nleft join raw.financial_pmpm._int_service_category_2_allowed_pivot 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, inpatient_paid + outpatient_paid + office_visit_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n, inpatient_paid + outpatient_paid + office_visit_paid + ancillary_paid + other_paid as medical_paid\n, inpatient_allowed + outpatient_allowed + office_visit_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n, inpatient_allowed + outpatient_allowed + office_visit_allowed + ancillary_allowed + other_allowed as medical_allowed\n, '2024-02-20 20:47:44.615990+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__member_months": {"database": "raw", "schema": "financial_pmpm", "name": "financial_pmpm__member_months", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/final/financial_pmpm__member_months.sql", "original_file_path": "models/financial_pmpm/final/financial_pmpm__member_months.sql", "unique_id": "model.the_tuva_project.financial_pmpm__member_months", "fqn": ["the_tuva_project", "financial_pmpm", "final", "financial_pmpm__member_months"], "alias": "member_months", "checksum": {"name": "sha256", "checksum": "e409c34c2e7d8e2ff15dbd47f410284e1d762adfec344abd354a4d497afe27b7"}, "config": {"enabled": true, "alias": "member_months", "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": "#abab26"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "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 (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": "#abab26"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "financial_pmpm", "alias": "member_months", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#abab26"}}, "created_at": 1708461580.95441, "relation_name": "raw.financial_pmpm.member_months", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith month_start_and_end_dates as (\nselect \n concat(cast(year as {{ dbt.type_string() }} ),lpad(cast(month as {{ dbt.type_string() }}),2,'0')) as year_month\n, min(full_date) as month_start_date\n, max(full_date) as month_end_date\nfrom {{ ref('terminology__calendar')}}\ngroup by 1\n)\n\nselect distinct\n a.patient_id\n, year_month\n, a.payer\n, a.plan\n, data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('financial_pmpm__stg_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": "terminology__calendar", "package": null, "version": null}, {"name": "financial_pmpm__stg_eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.terminology__calendar", "model.the_tuva_project.financial_pmpm__stg_eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/final/financial_pmpm__member_months.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__financial_pmpm__stg_eligibility as (\n\n\nselect\n patient_id\n, enrollment_start_date\n, enrollment_end_date\n, payer\n, plan\n, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.eligibility\n), month_start_and_end_dates as (\nselect \n concat(cast(year as TEXT ),lpad(cast(month as TEXT),2,'0')) as year_month\n, min(full_date) as month_start_date\n, max(full_date) as month_end_date\nfrom raw.terminology.calendar\ngroup by 1\n)\n\nselect distinct\n a.patient_id\n, year_month\n, a.payer\n, a.plan\n, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__financial_pmpm__stg_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": [{"id": "model.the_tuva_project.financial_pmpm__stg_eligibility", "sql": " __dbt__cte__financial_pmpm__stg_eligibility as (\n\n\nselect\n patient_id\n, enrollment_start_date\n, enrollment_end_date\n, payer\n, plan\n, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.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.financial_pmpm__pmpm_payer_plan": {"database": "raw", "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": "e456c62e3b8953eb085ab347d7d540717b0e067f9bc004998c1e5e29f05a998d"}, "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": "#abab26"}, "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": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.964019, "relation_name": "raw.financial_pmpm.pmpm_payer_plan", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n)}}\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_visit_paid) / COUNT(1) AS office_visit_paid,\n SUM(ancillary_paid) / COUNT(1) AS ancillary_paid,\n SUM(pharmacy_paid) / COUNT(1) AS pharmacy_paid,\n SUM(other_paid) / COUNT(1) AS other_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_paid) / COUNT(1) AS ambulatory_surgery_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(hospice_paid) / COUNT(1) AS 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(office_visit_paid_2) / COUNT(1) AS office_visit_paid_2,\n SUM(outpatient_hospital_or_clinic_paid) / COUNT(1) AS outpatient_hospital_or_clinic_paid,\n SUM(outpatient_psychiatric_paid) / COUNT(1) AS outpatient_psychiatric_paid,\n SUM(outpatient_rehabilitation_paid) / COUNT(1) AS outpatient_rehabilitation_paid,\n SUM(skilled_nursing_paid) / COUNT(1) AS skilled_nursing_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_visit_allowed) / COUNT(1) AS office_visit_allowed,\n SUM(ancillary_allowed) / COUNT(1) AS ancillary_allowed,\n SUM(pharmacy_allowed) / COUNT(1) AS pharmacy_allowed,\n SUM(other_allowed) / COUNT(1) AS other_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_allowed) / COUNT(1) AS ambulatory_surgery_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(hospice_allowed) / COUNT(1) AS 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(office_visit_allowed_2) / COUNT(1) AS office_visit_allowed_2,\n SUM(outpatient_hospital_or_clinic_allowed) / COUNT(1) AS outpatient_hospital_or_clinic_allowed,\n SUM(outpatient_psychiatric_allowed) / COUNT(1) AS outpatient_psychiatric_allowed,\n SUM(outpatient_rehabilitation_allowed) / COUNT(1) AS outpatient_rehabilitation_allowed,\n SUM(skilled_nursing_allowed) / COUNT(1) AS skilled_nursing_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 1,2,3,4", "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_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_visit_paid) / COUNT(1) AS office_visit_paid,\n SUM(ancillary_paid) / COUNT(1) AS ancillary_paid,\n SUM(pharmacy_paid) / COUNT(1) AS pharmacy_paid,\n SUM(other_paid) / COUNT(1) AS other_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_paid) / COUNT(1) AS ambulatory_surgery_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(hospice_paid) / COUNT(1) AS 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(office_visit_paid_2) / COUNT(1) AS office_visit_paid_2,\n SUM(outpatient_hospital_or_clinic_paid) / COUNT(1) AS outpatient_hospital_or_clinic_paid,\n SUM(outpatient_psychiatric_paid) / COUNT(1) AS outpatient_psychiatric_paid,\n SUM(outpatient_rehabilitation_paid) / COUNT(1) AS outpatient_rehabilitation_paid,\n SUM(skilled_nursing_paid) / COUNT(1) AS skilled_nursing_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_visit_allowed) / COUNT(1) AS office_visit_allowed,\n SUM(ancillary_allowed) / COUNT(1) AS ancillary_allowed,\n SUM(pharmacy_allowed) / COUNT(1) AS pharmacy_allowed,\n SUM(other_allowed) / COUNT(1) AS other_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_allowed) / COUNT(1) AS ambulatory_surgery_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(hospice_allowed) / COUNT(1) AS 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(office_visit_allowed_2) / COUNT(1) AS office_visit_allowed_2,\n SUM(outpatient_hospital_or_clinic_allowed) / COUNT(1) AS outpatient_hospital_or_clinic_allowed,\n SUM(outpatient_psychiatric_allowed) / COUNT(1) AS outpatient_psychiatric_allowed,\n SUM(outpatient_rehabilitation_allowed) / COUNT(1) AS outpatient_rehabilitation_allowed,\n SUM(skilled_nursing_allowed) / COUNT(1) AS skilled_nursing_allowed,\n SUM(urgent_care_allowed) / COUNT(1) AS urgent_care_allowed,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nFROM raw.financial_pmpm.pmpm_prep a\nGROUP BY 1,2,3,4", "extra_ctes_injected": true, "extra_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": "raw", "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": "dd106400e6a3b1cf5922a95c8550bc839b100af6d91583eb1306b6deb146dde9"}, "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": "#abab26"}, "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": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.971503, "relation_name": "raw.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)))\n )\n}}\n\nwith service_cat_1 as (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_1\n, data_source\n, sum(total_paid) as total_paid\nfrom {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\ngroup by 1,2,3,4,5,6\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_1'\n , values=('Inpatient','Outpatient','Office Visit','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 1,2,3,4,5", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_1\n, data_source\n, sum(total_paid) as total_paid\nfrom raw.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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 Visit'\n then total_paid\n else 0\n end\n )\n \n \n as office_visit_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by 1,2,3,4,5", "extra_ctes_injected": true, "extra_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": "raw", "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": "0f3b24231c00e77f69ad45cc88394eb6e5f7de10dc760507883630d4541dae30"}, "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": "#abab26"}, "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": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.9727669, "relation_name": "raw.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)))\n )\n}}\n\nwith service_cat_2 as (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_2\n, data_source\n, sum(total_paid) as total_paid\nfrom {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\ngroup by 1,2,3,4,5,6\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_2'\n , values=('Acute Inpatient',\n 'Ambulance',\n 'Ambulatory Surgery',\n 'Dialysis',\n 'Durable Medical Equipment',\n 'Emergency Department',\n 'Home Health',\n 'Hospice',\n 'Inpatient Psychiatric',\n 'Inpatient Rehabilitation',\n 'Lab',\n 'Office Visit',\n 'Outpatient Hospital or Clinic',\n 'Outpatient Psychiatric',\n 'Outpatient Rehabilitation',\n 'Skilled Nursing',\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 1,2,3,4,5", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_2\n, data_source\n, sum(total_paid) as total_paid\nfrom raw.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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'\n then total_paid\n else 0\n end\n )\n \n \n as ambulatory_surgery_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 = 'Hospice'\n then total_paid\n else 0\n end\n )\n \n \n as 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 = 'Office Visit'\n then total_paid\n else 0\n end\n )\n \n \n as office_visit_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 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 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 = '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 = '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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by 1,2,3,4,5", "extra_ctes_injected": true, "extra_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": "raw", "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": "9edc612350f50178fffa597eaf30f96d41df1a22f2d9ec577b83d63f77c8c72a"}, "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": "#abab26"}, "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": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.9674509, "relation_name": "raw.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)))\n )\n}}\n\nwith claims_with_service_categories as (\n select\n a.patient_id\n , a.payer\n , a.plan\n , a.service_category_1\n , a.service_category_2\n , coalesce(a.claim_start_date,a.claim_end_date) as claim_date\n , a.paid_amount\n , a.allowed_amount\n , data_source\n from {{ ref('financial_pmpm__stg_medical_claim') }} a\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 , cast({{ date_part(\"year\", \"claim_date\" ) }} as {{ dbt.type_string() }} ) || lpad(cast({{ date_part(\"month\", \"claim_date\" ) }} as {{ dbt.type_string() }} ),2,'0') 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 {{ dbt.type_string() }}) as service_category_2\n , {{try_to_cast_date('dispensing_date','YYYMMDD') }} 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 , plan\n , service_category_1\n , service_category_2\n , cast({{ date_part(\"year\", \"claim_date\" ) }} as {{ dbt.type_string() }} ) || lpad(cast({{ date_part(\"month\", \"claim_date\" ) }} as {{ dbt.type_string() }} ),2,'0') 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 , '{{ var('tuva_last_run')}}' as tuva_last_run\n from combine_medical_and_rx\ngroup by 1,2,3,4,5,6,9", "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.date_part", "macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date"], "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n), __dbt__cte__financial_pmpm__stg_pharmacy_claim as (\n\n\n\nSELECT\n patient_id\n, dispensing_date\n, paid_amount\n, allowed_amount\n, payer\n, plan\n, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.pharmacy_claim\n), claims_with_service_categories as (\n select\n a.patient_id\n , a.payer\n , a.plan\n , a.service_category_1\n , a.service_category_2\n , coalesce(a.claim_start_date,a.claim_end_date) as claim_date\n , a.paid_amount\n , a.allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_medical_claim a\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 , cast(date_part('year', claim_date) as TEXT ) || lpad(cast(date_part('month', claim_date) as TEXT ),2,'0') 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 , try_cast( dispensing_date as 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 , cast(date_part('year', claim_date) as TEXT ) || lpad(cast(date_part('month', claim_date) as TEXT ),2,'0') 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-02-20 20:47:44.615990+00:00' as tuva_last_run\n from combine_medical_and_rx\ngroup by 1,2,3,4,5,6,9", "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_amount\n, allowed_amount\n, payer\n, plan\n, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "403c8dd6e6f3407364b10a4f0a21b0bf80c6ae3379ba780bfe6ee3e578e8932c"}, "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": "#abab26"}, "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": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.9687061, "relation_name": "raw.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)))\n )\n}}\n\nwith service_cat_1 as (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_1\n, data_source\n, sum(total_allowed) as total_allowed\nfrom {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\ngroup by 1,2,3,4,5,6\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_1'\n , values=('Inpatient','Outpatient','Office Visit','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 1,2,3,4,5", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_1\n, data_source\n, sum(total_allowed) as total_allowed\nfrom raw.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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 Visit'\n then total_allowed\n else 0\n end\n )\n \n \n as office_visit_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by 1,2,3,4,5", "extra_ctes_injected": true, "extra_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": "raw", "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": "ad30c2f5dedc08e138b411667752bb70744c4445a2713c81b1341cc65dfdc18a"}, "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": "#abab26"}, "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": "#abab26"}, "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": "#abab26"}}, "created_at": 1708461580.9701939, "relation_name": "raw.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)))\n )\n}}\n\nwith service_cat_2 as (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_2\n, data_source\n, sum(total_allowed) as total_allowed\nfrom {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\ngroup by 1,2,3,4,5,6\n)\n\nselect\n patient_id \n, year_month \n, payer\n, plan\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_2'\n , values=('Acute Inpatient',\n 'Ambulance',\n 'Ambulatory Surgery',\n 'Dialysis',\n 'Durable Medical Equipment',\n 'Emergency Department',\n 'Home Health',\n 'Hospice',\n 'Inpatient Psychiatric',\n 'Inpatient Rehabilitation',\n 'Lab',\n 'Office Visit',\n 'Outpatient Hospital or Clinic',\n 'Outpatient Psychiatric',\n 'Outpatient Rehabilitation',\n 'Skilled Nursing',\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 1,2,3,4,5", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_2\n, data_source\n, sum(total_allowed) as total_allowed\nfrom raw.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulatory_surgery_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 = 'Hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as 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 = 'Office Visit'\n then total_allowed\n else 0\n end\n )\n \n \n as office_visit_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 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 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 = '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 = '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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by 1,2,3,4,5", "extra_ctes_injected": true, "extra_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": "raw", "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": "ead2f58476166732f909a5b0151c640d991fab09874636cff0587738db9c2109"}, "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": null}, "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": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708461580.9858618, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , data_source\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/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 , normalized_code_type as code_type\n , normalized_code as code\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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__patient": {"database": "raw", "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": "3df32901fdf9ccc3a67180594f433bbf361840f918d0af8d7039d5721d3bb382"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.987027, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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/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\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "55a8de28f326836864a43cd3d0f19f53b8787e2d004c1c4c6d1bcd44219bc8aa"}, "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": null}, "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 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": []}, "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": null}, "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}, "created_at": 1708461580.977858, "relation_name": "raw.hcc_suspecting.list", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , 'Prior coding history' as reason\n , icd_10_cm_code\n || case\n when last_billed is not null then ' last billed on ' || last_billed\n when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded\n else ' (missing recorded and billing dates) '\n end as contributing_factor\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n where current_year_billed = false\n\n)\n\n, unioned as (\n\n select * from hcc_history_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 from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\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}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"]}, "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 , 'Prior coding history' as reason\n , icd_10_cm_code\n || case\n when last_billed is not null then ' last billed on ' || last_billed\n when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded\n else ' (missing recorded and billing dates) '\n end as contributing_factor\n from raw.hcc_suspecting._int_patient_hcc_history\n where current_year_billed = false\n\n)\n\n, unioned as (\n\n select * from hcc_history_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 from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , '2024-02-20 20:47:44.615990+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": "raw", "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": "d62db6b78453d02113d73c2691fff7ec8e2b6cd95532dbc8da294ffc2c354005"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.979274, "relation_name": "raw.hcc_suspecting.summary", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\nwith patients as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor({{ datediff('birth_date', 'current_date', 'hour') }} / 8766.0) as age\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\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), patients as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8766.0) as age\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 raw.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-02-20 20:47:44.615990+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\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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__int_patient_hcc_history": {"database": "raw", "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": "0cc66c836a8f9e2c37fc9ea1e1b5cc4b57c2e61f6c922c0bf91d92ad583c10a2"}, "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": null}, "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 was billed during the payment year.\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": null}, "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}, "created_at": 1708461580.983207, "relation_name": "raw.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))))\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 extract(year from hcc_billed.last_billed) = extract(year from {{ dbt.current_timestamp() }} )\n then 1\n else 0\n end as current_year_billed\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 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_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 , cast(current_year_billed as boolean) as current_year_billed\n from all_conditions_with_flag\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 , '{{ 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.dbt.current_timestamp", "macro.dbt.type_string"], "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 raw.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 extract(year from hcc_billed.last_billed) = extract(year from convert_timezone('UTC', current_timestamp()) )\n then 1\n else 0\n end as current_year_billed\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 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_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 , cast(current_year_billed as boolean) as current_year_billed\n from all_conditions_with_flag\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 , '2024-02-20 20:47:44.615990+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_conditions": {"database": "raw", "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": "8b5cd13c15dc1f928b9fffdfaba29d03bcc079c10cc741eeff6fff51dc6c089f"}, "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": null}, "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": null}, "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}, "created_at": 1708461580.9809668, "relation_name": "raw.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))))\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 raw.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 raw.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 raw.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-02-20 20:47:44.615990+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_conditions": {"database": "raw", "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": "550c5a5256a27b2e204c09905add90a037a852bf967ee626d1ff53d4f0486667"}, "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": null}, "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": []}, "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": null}, "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}, "created_at": 1708461580.984648, "relation_name": "raw.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))))\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 , normalized_code_type as code_type\n , normalized_code as code\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 raw.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-02-20 20:47:44.615990+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 , normalized_code_type as code_type\n , normalized_code as code\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_chronic_conditions__stg_pharmacy_claim": {"database": "raw", "schema": "jaffle_shop", "name": "cms_chronic_conditions__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_pharmacy_claim.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_pharmacy_claim"], "alias": "cms_chronic_conditions__stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "c6fe56463f4b344bf02158e45e7a72b2d6ab6c0a76ba098090302bf04fb6acb0"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.010227, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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('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/chronic_conditions/staging/cms_chronic_conditions__stg_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-02-20 20:47:44.615990+00:00' as tuva_last_run\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.tuva_chronic_conditions__stg_core__patient": {"database": "raw", "schema": "jaffle_shop", "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": "052d4e09d81b4d13b6e6e574982ac9530f20a832c69ed9ee201dfac4739a30ec"}, "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": "#2e0e0e"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["tuva_chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.033501, "relation_name": null, "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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__procedure": {"database": "raw", "schema": "jaffle_shop", "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": "bd66a457c679034c78d2096d5f11fa56ee836c475deb61f5799031d50ae88a8d"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.008439, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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') }}", "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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.tuva_chronic_conditions__stg_core__condition": {"database": "raw", "schema": "jaffle_shop", "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": "fc63071aa65724d7ccfce9f7c7807511c9d21eefa4c401a5ef1df54e3a329f6e"}, "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": "#2e0e0e"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["tuva_chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.032812, "relation_name": null, "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "schema": "jaffle_shop", "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": "f42e0eb8c7fd94e710385294473ff4cbb48b9efa056e20015005b21a20e56ed0"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.0077472, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_medical_claim": {"database": "raw", "schema": "jaffle_shop", "name": "cms_chronic_conditions__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_medical_claim.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_medical_claim"], "alias": "cms_chronic_conditions__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "0217a4751ee97a1188a358e17dffcbb600d006dd50effdd5c3597cfef4a5de7a"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.009124, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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('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/chronic_conditions/staging/cms_chronic_conditions__stg_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-02-20 20:47:44.615990+00:00' as tuva_last_run\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.cms_chronic_conditions__stg_core__condition": {"database": "raw", "schema": "jaffle_shop", "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": "af31a34e0ee8accd286630da04ee6154aac827c689e518e66eca2e696eaaafa7"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.007042, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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') }}", "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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.chronic_conditions__tuva_chronic_conditions_long": {"database": "raw", "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": "a9f319a429001c1a239554868a1c13bb2b61199699162591772b1bb9cc8f0579"}, "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": "#2e0e0e"}, "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_family": {"name": "condition_family", "description": "A higher level rollup grouping of conditions from the condition column\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": []}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.0266519, "relation_name": "raw.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))))\n )\n}}\n\nwith condition_row_number as (\n\n select \n patient_id\n , normalized_code\n , recorded_date\n , row_number() over(\n partition by\n patient_id\n , normalized_code\n order by recorded_date asc\n ) as rn_asc\n , row_number() over(\n partition by\n patient_id\n , normalized_code\n order by recorded_date desc\n ) as rn_desc\n from {{ ref('tuva_chronic_conditions__stg_core__condition') }}\n\n)\n\n, patient_conditions as (\n\n select \n patient_id\n , normalized_code as icd_10_cm\n , max(\n case\n when rn_asc = 1\n then recorded_date\n end\n ) as first_diagnosis_date\n , max(\n case\n when rn_desc = 1\n then recorded_date\n end\n ) as last_diagnosis_date\n from condition_row_number\n group by \n patient_id\n , normalized_code\n\n)\n\nselect \n pc.patient_id\n , h.condition_family\n , h.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 {{ ref('chronic_conditions__tuva_chronic_conditions_hierarchy') }} h\n inner join patient_conditions pc\n on h.icd_10_cm_code = pc.icd_10_cm\ngroup by \n pc.patient_id\n , h.condition_family\n , h.condition", "language": "sql", "refs": [{"name": "tuva_chronic_conditions__stg_core__condition", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_hierarchy", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.tuva_chronic_conditions__stg_core__condition", "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy"]}, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n), condition_row_number as (\n\n select \n patient_id\n , normalized_code\n , recorded_date\n , row_number() over(\n partition by\n patient_id\n , normalized_code\n order by recorded_date asc\n ) as rn_asc\n , row_number() over(\n partition by\n patient_id\n , normalized_code\n order by recorded_date desc\n ) as rn_desc\n from __dbt__cte__tuva_chronic_conditions__stg_core__condition\n\n)\n\n, patient_conditions as (\n\n select \n patient_id\n , normalized_code as icd_10_cm\n , max(\n case\n when rn_asc = 1\n then recorded_date\n end\n ) as first_diagnosis_date\n , max(\n case\n when rn_desc = 1\n then recorded_date\n end\n ) as last_diagnosis_date\n from condition_row_number\n group by \n patient_id\n , normalized_code\n\n)\n\nselect \n pc.patient_id\n , h.condition_family\n , h.condition\n , min(first_diagnosis_date) as first_diagnosis_date\n , max(last_diagnosis_date) as last_diagnosis_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.chronic_conditions._value_set_tuva_chronic_conditions_hierarchy h\n inner join patient_conditions pc\n on h.icd_10_cm_code = pc.icd_10_cm\ngroup by \n pc.patient_id\n , h.condition_family\n , h.condition", "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "1a4a6540512db0e049723d6afdeaa6cf95638321608170855f18964c9fbae4ad"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461580.998574, "relation_name": "raw.chronic_conditions.cms_chronic_conditions_wide", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), chronic_conditions as (\n\n select distinct\n condition\n , condition_column_name\n from raw.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 raw.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-02-20 20:47:44.615990+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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": "fd544808dd511e5b9ad485a51b7a5a6dcc399cf116583db8c5b89c71878ae284"}, "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": "#2e0e0e"}, "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": []}, "acute_myocardial_infarction": {"name": "acute_myocardial_infarction", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "alcohol": {"name": "alcohol", "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": []}, "amyotrophic_lateral_sclerosis": {"name": "amyotrophic_lateral_sclerosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "anxiety": {"name": "anxiety", "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": []}, "atherosclerosis": {"name": "atherosclerosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "atrial_fibrillation": {"name": "atrial_fibrillation", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "attention_deficit_hyperactivity_disorder": {"name": "attention_deficit_hyperactivity_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "bipolar": {"name": "bipolar", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "breast_cancer": {"name": "breast_cancer", "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": []}, "cocaine": {"name": "cocaine", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "colorectal_cancer": {"name": "colorectal_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "crohns_disease": {"name": "crohns_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cystic_fibrosis": {"name": "cystic_fibrosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "dementia": {"name": "dementia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "depression": {"name": "depression", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "heart_failure": {"name": "heart_failure", "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": []}, "lung_cancer": {"name": "lung_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "lupus": {"name": "lupus", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "metabolic_syndrome": {"name": "metabolic_syndrome", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "multiple_sclerosis": {"name": "multiple_sclerosis", "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": []}, "obesity": {"name": "obesity", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "obsessive_compulsive_disorder": {"name": "obsessive_compulsive_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "opioid": {"name": "opioid", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "parkinsons_disease": {"name": "parkinsons_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "personality_disorder": {"name": "personality_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "post_traumatic_stress_disorder": {"name": "post_traumatic_stress_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "rheumatoid_arthritis": {"name": "rheumatoid_arthritis", "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": []}, "stroke": {"name": "stroke", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "tobacco": {"name": "tobacco", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "type_1_diabetes": {"name": "type_1_diabetes", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "type_2_diabetes": {"name": "type_2_diabetes", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "ulcerative_colitis": {"name": "ulcerative_colitis", "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.0321019, "relation_name": "raw.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))))\n )\n}}\n\nwith condition_columns as (\n\n select distinct\n condition\n , condition_column_name\n from {{ ref('chronic_conditions__tuva_chronic_conditions_hierarchy') }}\n\n)\n\nselect\n p.patient_id\n , {{ dbt_utils.pivot(\n column='cc.condition_column_name'\n , values=dbt_utils.get_column_values(\n ref('chronic_conditions__tuva_chronic_conditions_hierarchy')\n , 'condition_column_name'\n ,'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('tuva_chronic_conditions__stg_core__patient') }} p\n left join {{ ref('chronic_conditions__tuva_chronic_conditions_long') }} l\n on p.patient_id = l.patient_id\n left join condition_columns cc\n on l.condition = cc.condition\ngroup by\n p.patient_id", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "tuva_chronic_conditions__stg_core__patient", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "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__tuva_chronic_conditions_hierarchy", "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient", "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 __dbt__cte__tuva_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), condition_columns as (\n\n select distinct\n condition\n , condition_column_name\n from raw.chronic_conditions._value_set_tuva_chronic_conditions_hierarchy\n\n)\n\nselect\n p.patient_id\n , \n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'ALCOHOL'\n then 1\n else 0\n end\n )\n \n \n as alcohol\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'AMYOTROPHIC_LATERAL_SCLEROSIS'\n then 1\n else 0\n end\n )\n \n \n as amyotrophic_lateral_sclerosis\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ANXIETY'\n then 1\n else 0\n end\n )\n \n \n as anxiety\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'ATHEROSCLEROSIS'\n then 1\n else 0\n end\n )\n \n \n as atherosclerosis\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ATRIAL_FIBRILLATION'\n then 1\n else 0\n end\n )\n \n \n as atrial_fibrillation\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ATTENTION_DEFICIT_HYPERACTIVITY_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as attention_deficit_hyperactivity_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'BIPOLAR'\n then 1\n else 0\n end\n )\n \n \n as bipolar\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'BREAST_CANCER'\n then 1\n else 0\n end\n )\n \n \n as breast_cancer\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.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 cc.condition_column_name = 'COCAINE'\n then 1\n else 0\n end\n )\n \n \n as cocaine\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'COLORECTAL_CANCER'\n then 1\n else 0\n end\n )\n \n \n as colorectal_cancer\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'CROHNS_DISEASE'\n then 1\n else 0\n end\n )\n \n \n as crohns_disease\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'CYSTIC_FIBROSIS'\n then 1\n else 0\n end\n )\n \n \n as cystic_fibrosis\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'DEMENTIA'\n then 1\n else 0\n end\n )\n \n \n as dementia\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'DEPRESSION'\n then 1\n else 0\n end\n )\n \n \n as depression\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'HEART_FAILURE'\n then 1\n else 0\n end\n )\n \n \n as heart_failure\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.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 cc.condition_column_name = 'LUNG_CANCER'\n then 1\n else 0\n end\n )\n \n \n as lung_cancer\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'LUPUS'\n then 1\n else 0\n end\n )\n \n \n as lupus\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'METABOLIC_SYNDROME'\n then 1\n else 0\n end\n )\n \n \n as metabolic_syndrome\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'MULTIPLE_SCLEROSIS'\n then 1\n else 0\n end\n )\n \n \n as multiple_sclerosis\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.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 cc.condition_column_name = 'OBSESSIVE_COMPULSIVE_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as obsessive_compulsive_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'OPIOID'\n then 1\n else 0\n end\n )\n \n \n as opioid\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'PARKINSONS_DISEASE'\n then 1\n else 0\n end\n )\n \n \n as parkinsons_disease\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'PERSONALITY_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as personality_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'POST_TRAUMATIC_STRESS_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as post_traumatic_stress_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'RHEUMATOID_ARTHRITIS'\n then 1\n else 0\n end\n )\n \n \n as rheumatoid_arthritis\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'STROKE'\n then 1\n else 0\n end\n )\n \n \n as stroke\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'TOBACCO'\n then 1\n else 0\n end\n )\n \n \n as tobacco\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'TYPE_1_DIABETES'\n then 1\n else 0\n end\n )\n \n \n as type_1_diabetes\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'TYPE_2_DIABETES'\n then 1\n else 0\n end\n )\n \n \n as type_2_diabetes\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ULCERATIVE_COLITIS'\n then 1\n else 0\n end\n )\n \n \n as ulcerative_colitis\n \n \n \n \n\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__tuva_chronic_conditions__stg_core__patient p\n left join raw.chronic_conditions.tuva_chronic_conditions_long l\n on p.patient_id = l.patient_id\n left join condition_columns cc\n on l.condition = cc.condition\ngroup by\n p.patient_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient", "sql": " __dbt__cte__tuva_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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__cms_chronic_conditions_long": {"database": "raw", "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": "5480b81efb388b47f7d122d3916336072eb751447b8e5f72fb35dd5f3c50a9eb"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.000513, "relation_name": "raw.chronic_conditions.cms_chronic_conditions_long", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\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\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\nwith conditions_unioned as (\n\n select * from raw.chronic_conditions._int_cms_chronic_condition_all\n union distinct\n select * from raw.chronic_conditions._int_cms_chronic_condition_hiv_aids\n union distinct\n select * from raw.chronic_conditions._int_cms_chronic_condition_oud\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-02-20 20:47:44.615990+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": "raw", "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": "a3837d2c0d39ae64d0f7b672e04c21444e53d1c6eed81327169977b0f1ef3034"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.003516, "relation_name": "raw.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)))\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_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, 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\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_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_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n), __dbt__cte__cms_chronic_conditions__stg_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim\n), chronic_conditions as (\n\n select * from raw.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_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, 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\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-02-20 20:47:44.615990+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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_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-02-20 20:47:44.615990+00:00' as tuva_last_run\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.chronic_conditions__cms_chronic_conditions_oud": {"database": "raw", "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": "ec9c2f386fb92e3792534e624e8ff4dfc5e241ad8dd409f6f685e0e193600352"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.0059361, "relation_name": "raw.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)))\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_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, 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\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_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_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n), __dbt__cte__cms_chronic_conditions__stg_pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom tuva.input_layer.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), chronic_conditions as (\n\n select * from raw.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_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 raw.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, 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\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-02-20 20:47:44.615990+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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom tuva.input_layer.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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.chronic_conditions__cms_chronic_conditions_all": {"database": "raw", "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": "6c143e25459a2df431c6c4fa586a685b63c26f6d6c08632bc1d75b6a7f089d10"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708461581.002076, "relation_name": "raw.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)))\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_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, 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\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_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_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n), __dbt__cte__cms_chronic_conditions__stg_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom tuva.input_layer.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), chronic_conditions as (\n\n select * from raw.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_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, 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\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-02-20 20:47:44.615990+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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom tuva.input_layer.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\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": "raw", "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": "fd67aa459041a8d1f8b8b8c6cf9bb041b9e5405c2c28c70b54eacbc01926508b"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"admit_type_code": "varchar", "admit_type_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "admit_type", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"admit_type_code": "varchar", "admit_type_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.040184, "relation_name": "raw.terminology.admit_type", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__ssa_fips_state": {"database": "raw", "schema": "terminology", "name": "terminology__ssa_fips_state", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ssa_fips_state.csv", "original_file_path": "seeds/terminology/terminology__ssa_fips_state.csv", "unique_id": "seed.the_tuva_project.terminology__ssa_fips_state", "fqn": ["the_tuva_project", "terminology", "terminology__ssa_fips_state"], "alias": "ssa_fips_state", "checksum": {"name": "sha256", "checksum": "c3a5543c86971b4895f4ff9a814a07c5e38068ea341426c5e7acff0914ada0ce"}, "config": {"enabled": true, "alias": "ssa_fips_state", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"ssa_fips_state_code": "varchar", "ssa_fips_state_name": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "ssa_fips_state", "tags": "terminology", "column_types": {"ssa_fips_state_code": "varchar", "ssa_fips_state_name": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.1118872, "relation_name": "raw.terminology.ssa_fips_state", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__medicare_orec": {"database": "raw", "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": "ff425893ec0ec8d7e3eb1911d3c979540d02a8853efa2af0676ccd9c954a50f4"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"original_reason_entitlement_code": "varchar", "original_reason_entitlement_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "medicare_orec", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"original_reason_entitlement_code": "varchar", "original_reason_entitlement_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.1098912, "relation_name": "raw.terminology.medicare_orec", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__gender": {"database": "raw", "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": "49caad564a6d46cabcbbaa25857984aa1f7d4426ed5927989cdeddc1539d6fb6"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "gender", "tags": ["terminology", "data_profiling"], "column_types": {"description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.071052, "relation_name": "raw.terminology.gender", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__ethnicity": {"database": "raw", "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": "d23c1e3d7417d569bbb1e11cd0a493cfd60f60e231756adb2f7b6160ca2f93e6"}, "config": {"enabled": true, "alias": "ethnicity", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"code": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "ethnicity", "tags": "terminology", "column_types": {"code": "varchar", "description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.0654202, "relation_name": "raw.terminology.ethnicity", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__ms_drg": {"database": "raw", "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": "4f604ede8b4f04891a180b2a28d0591dd19c6f2213f31771cb12651b833bb587"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"ms_drg_code": "varchar", "mdc_code": "varchar", "medical_surgical": "varchar", "ms_drg_description": "varchar", "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": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "ms_drg", "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "column_types": {"ms_drg_code": "varchar", "mdc_code": "varchar", "medical_surgical": "varchar", "ms_drg_description": "varchar", "deprecated": "integer", "deprecated_date": "date"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.116549, "relation_name": "raw.terminology.ms_drg", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__revenue_center": {"database": "raw", "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": "ff5cfaa788fef04e5c0dac4a135cb7479132d76d98ebcbf75c97f70a9735c8db"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"revenue_center_code": "varchar", "revenue_center_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "revenue_center", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"revenue_center_code": "varchar", "revenue_center_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.13691, "relation_name": "raw.terminology.revenue_center", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__icd_9_cm": {"database": "raw", "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": "path", "checksum": "seeds/terminology/terminology__icd_9_cm.csv"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"icd_9_cm": "varchar", "long_description": "varchar", "short_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "icd_9_cm", "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "column_types": {"icd_9_cm": "varchar", "long_description": "varchar", "short_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.084169, "relation_name": "raw.terminology.icd_9_cm", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__race": {"database": "raw", "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": "f2eb6f41b8f9653d6191d77991ab07dc20e7a15fa3e128c9407134cf7d1717bc"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"race_code": "varchar", "race_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "race", "tags": ["terminology", "data_profiling"], "column_types": {"race_code": "varchar", "race_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.135124, "relation_name": "raw.terminology.race", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__rxnorm_to_atc": {"database": "raw", "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": "0c22d1d9c1cb2f26fb0a1f860a412abbc5a6f6946c473083651f4bf38bac73ca"}, "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/terminology','rxnorm_to_atc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"rxcui": "varchar", "rxnorm_description": "varchar(3000)", "atc_1_name": "varchar", "atc_2_name": "varchar", "atc_3_name": "varchar", "atc_4_name": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','rxnorm_to_atc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "rxnorm_to_atc", "tags": ["terminology"], "column_types": {"rxcui": "varchar", "rxnorm_description": "varchar(3000)", "atc_1_name": "varchar", "atc_2_name": "varchar", "atc_3_name": "varchar", "atc_4_name": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.050539, "relation_name": "raw.terminology.rxnorm_to_atc", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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": "2bd1a8a081fceb69bf91287c8a56c370ea1544a1fbbe12829566955012c04c97"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"medicare_status_code": "varchar", "medicare_status_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "medicare_status", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"medicare_status_code": "varchar", "medicare_status_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.114203, "relation_name": "raw.terminology.medicare_status", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__loinc_deprecated_mapping": {"database": "raw", "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/terminology','loinc_deprecated_mapping.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"loinc": "varchar", "map_to": "varchar", "comment": "varchar", "final_map_to": "varchar", "all_comments": "varchar", "depth": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null, "columns": [{"name": "loinc", "description": "The deprecated term to which the replacement term(s) apply."}, {"name": "map_to", "description": "A replacement term that is to be used in place of the deprecated or discouraged term."}, {"name": "comment", "description": "Narrative text that explains the rational for using the recommended replacement term."}, {"name": "final_map_to", "description": "If there are multiple steps of deprecated codes, this is the final (active) code"}, {"name": "all_comments", "description": "An aggregation of comments for any mapping steps between the deprecated code and the active code"}, {"name": "depth", "description": "How many steps this mapping is to the active code"}]}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','loinc_deprecated_mapping.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "loinc_deprecated_mapping", "tags": ["terminology"], "columns": [{"name": "loinc", "description": "The deprecated term to which the replacement term(s) apply."}, {"name": "map_to", "description": "A replacement term that is to be used in place of the deprecated or discouraged term."}, {"name": "comment", "description": "Narrative text that explains the rational for using the recommended replacement term."}, {"name": "final_map_to", "description": "If there are multiple steps of deprecated codes, this is the final (active) code"}, {"name": "all_comments", "description": "An aggregation of comments for any mapping steps between the deprecated code and the active code"}, {"name": "depth", "description": "How many steps this mapping is to the active code"}], "column_types": {"loinc": "varchar", "map_to": "varchar", "comment": "varchar", "final_map_to": "varchar", "all_comments": "varchar", "depth": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.104186, "relation_name": "raw.terminology.loinc_deprecated_mapping", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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": "d53d91055ebddab61198919a4d08fd4b312ced8dc91df28d76106f5185642ceb"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"place_of_service_code": "varchar", "place_of_service_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "place_of_service", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"place_of_service_code": "varchar", "place_of_service_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.1242251, "relation_name": "raw.terminology.place_of_service", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__discharge_disposition": {"database": "raw", "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": "15c1af0306238509e41a88152b1ac9dc683776d790531da941c9cac40430ce05"}, "config": {"enabled": true, "alias": "discharge_disposition", "schema": "terminology", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"discharge_disposition_code": "varchar", "discharge_disposition_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "discharge_disposition", "column_types": {"discharge_disposition_code": "varchar", "discharge_disposition_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.062158, "relation_name": "raw.terminology.discharge_disposition", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__icd_9_pcs": {"database": "raw", "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": "dc97df38ffbff5dddcd6e0160d41f76c3d29b7d740b583faaac1a5de86698fab"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"icd_9_pcs": "varchar", "long_description": "varchar", "short_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "icd_9_pcs", "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "column_types": {"icd_9_pcs": "varchar", "long_description": "varchar", "short_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.086242, "relation_name": "raw.terminology.icd_9_pcs", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__present_on_admission": {"database": "raw", "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": "f0cdf4a2206612969016f8427eb97159b5954364518a92194275adc2ba9ce53b"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"present_on_admit_code": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "present_on_admission", "tags": ["terminology", "data_profiling", "claims_preprocessing"], "column_types": {"present_on_admit_code": "varchar", "description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.126216, "relation_name": "raw.terminology.present_on_admission", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__mdc": {"database": "raw", "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": "b19311ec103fd48ea11a228d065b646f52fde1292a42ca3feb6fb2884eb00522"}, "config": {"enabled": true, "alias": "mdc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"mdc_code": "varchar", "mcd_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "mdc", "tags": "terminology", "column_types": {"mdc_code": "varchar", "mcd_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.106001, "relation_name": "raw.terminology.mdc", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__admit_source": {"database": "raw", "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": "392e0c1935973dbea2e96030db856a8ccfa660cbd51f45c92d51d121aa432a8b"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"admit_source_code": "varchar", "admit_source_description": "varchar", "newborn_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "admit_source", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"admit_source_code": "varchar", "admit_source_description": "varchar", "newborn_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.0381691, "relation_name": "raw.terminology.admit_source", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__calendar": {"database": "raw", "schema": "terminology", "name": "terminology__calendar", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__calendar.csv", "original_file_path": "seeds/terminology/terminology__calendar.csv", "unique_id": "seed.the_tuva_project.terminology__calendar", "fqn": ["the_tuva_project", "terminology", "terminology__calendar"], "alias": "calendar", "checksum": {"name": "sha256", "checksum": "e0e2dcef31be96e75c148c0c957eb818f563c04e71a5e7faefc8057598198671"}, "config": {"enabled": true, "alias": "calendar", "schema": "terminology", "database": null, "tags": ["terminology", "pmpm"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/terminology','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", "day_of_week_number": "integer", "day_of_week_name": "varchar", "week_of_year": "integer", "day_of_year": "integer", "year_month": "varchar", "first_day_of_month": "date", "last_day_of_month": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','calendar.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "calendar", "tags": ["terminology", "pmpm"], "column_types": {"full_date": "date", "year": "integer", "month": "integer", "day": "integer", "month_name": "varchar", "day_of_week_number": "integer", "day_of_week_name": "varchar", "week_of_year": "integer", "day_of_year": "integer", "year_month": "varchar", "first_day_of_month": "date", "last_day_of_month": "date"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.0566258, "relation_name": "raw.terminology.calendar", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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/provider_data','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": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/provider_data','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": "#460d4f"}}, "created_at": 1708461581.120626, "relation_name": "raw.terminology.other_provider_taxonomy", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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": "08903dd5b951cfdd2dc1e2d92406571ab08c2fa401c2f951a6190b38af1dbf61"}, "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/terminology','icd_10_cm.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','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", "description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.078347, "relation_name": "raw.terminology.icd_10_cm", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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": "da35be4c432144ba8003d5ef8f2d815d8afce6ed215d6aa065e305ad11f7552c"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"claim_type_code": "varchar", "claim_type_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "claim_type", "tags": ["terminology", "data_profiling"], "column_types": {"claim_type_code": "varchar", "claim_type_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.058368, "relation_name": "raw.terminology.claim_type", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__hcpcs_level_2": {"database": "raw", "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": "path", "checksum": "seeds/terminology/terminology__hcpcs_level_2.csv"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"hcpcs": "varchar", "seqnum": "varchar", "recid": "varchar", "long_description": "varchar(2000)", "short_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "hcpcs_level_2", "tags": "terminology", "column_types": {"hcpcs": "varchar", "seqnum": "varchar", "recid": "varchar", "long_description": "varchar(2000)", "short_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.074564, "relation_name": "raw.terminology.hcpcs_level_2", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__fips_county": {"database": "raw", "schema": "terminology", "name": "terminology__fips_county", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__fips_county.csv", "original_file_path": "seeds/terminology/terminology__fips_county.csv", "unique_id": "seed.the_tuva_project.terminology__fips_county", "fqn": ["the_tuva_project", "terminology", "terminology__fips_county"], "alias": "fips_county", "checksum": {"name": "sha256", "checksum": "51c80da82ec1f20665fbd65379796c53f724781fa3833396cba093c89004bfb5"}, "config": {"enabled": true, "alias": "fips_county", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"fips_code": "varchar", "county": "varchar", "state": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "fips_county", "tags": "terminology", "column_types": {"fips_code": "varchar", "county": "varchar", "state": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.06744, "relation_name": "raw.terminology.fips_county", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__ndc": {"database": "raw", "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/terminology','ndc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ndc": "varchar", "rxcui": "varchar", "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": "#460d4f"}, "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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','ndc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ndc", "tags": ["terminology"], "column_types": {"ndc": "varchar", "rxcui": "varchar", "rxnorm_description": "varchar(3000)", "fda_description": "varchar(3000)"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.045843, "relation_name": "raw.terminology.ndc", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ansi_fips_state": {"database": "raw", "schema": "terminology", "name": "terminology__ansi_fips_state", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ansi_fips_state.csv", "original_file_path": "seeds/terminology/terminology__ansi_fips_state.csv", "unique_id": "seed.the_tuva_project.terminology__ansi_fips_state", "fqn": ["the_tuva_project", "terminology", "terminology__ansi_fips_state"], "alias": "ansi_fips_state", "checksum": {"name": "sha256", "checksum": "9aace3600ddf44495c8071368abbab6baf6bc83ccf454cdb6125079b355a7055"}, "config": {"enabled": true, "alias": "ansi_fips_state", "schema": "terminology", "database": null, "tags": ["terminology", "medicare_cclf_connector"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"ansi_fips_state_code": "varchar", "ansi_fips_state_abbreviation": "varchar", "ansi_fips_state_name": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "medicare_cclf_connector"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "ansi_fips_state", "tags": ["terminology", "medicare_cclf_connector"], "column_types": {"ansi_fips_state_code": "varchar", "ansi_fips_state_abbreviation": "varchar", "ansi_fips_state_name": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.0695622, "relation_name": "raw.terminology.ansi_fips_state", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__encounter_type": {"database": "raw", "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": "6860a611d3dde5a476c3c6b2969b4e90f63e05491e6a943d1158bb5f2e7b1879"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "encounter_type", "tags": ["terminology", "claims_preprocessing"], "column_types": {"description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.0635588, "relation_name": "raw.terminology.encounter_type", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__provider": {"database": "raw", "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/provider_data','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": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/provider_data','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": "#460d4f"}}, "created_at": 1708461581.133445, "relation_name": "raw.terminology.provider", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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": "df7db012d6c46b24f5b5a367e191ef85df76a70c661cacd27989c212fac241b4"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"payer_type": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "payer_type", "tags": ["terminology", "data_profiling"], "column_types": {"payer_type": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.122389, "relation_name": "raw.terminology.payer_type", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__apr_drg": {"database": "raw", "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": "4458f5fe5df95b8291d6a0ccc4023cd7e567cca527aa56c7fb1b62c3a88d6c23"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"apr_drg_code": "varchar", "severity": "varchar", "apr_drg_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "apr_drg", "tags": ["terminology", "data_profiling"], "column_types": {"apr_drg_code": "varchar", "severity": "varchar", "apr_drg_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.139071, "relation_name": "raw.terminology.apr_drg", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__icd_10_pcs": {"database": "raw", "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/terminology','icd_10_pcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','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", "description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.081453, "relation_name": "raw.terminology.icd_10_pcs", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__code_type": {"database": "raw", "schema": "terminology", "name": "terminology__code_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__code_type.csv", "original_file_path": "seeds/terminology/terminology__code_type.csv", "unique_id": "seed.the_tuva_project.terminology__code_type", "fqn": ["the_tuva_project", "terminology", "terminology__code_type"], "alias": "code_type", "checksum": {"name": "sha256", "checksum": "5fe9aa562e036ca6f98866fe29d85c1f2351f53d00fdde631ad8dce183ce5788"}, "config": {"enabled": true, "alias": "code_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "code_type", "tags": ["terminology", "data_profiling"], "column_types": {"description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.060008, "relation_name": "raw.terminology.code_type", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__medicare_dual_eligibility": {"database": "raw", "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": "193c868833835d33634e0a4bee8841859d32b26e46b8bf9378a0fa9e20e6baac"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"dual_status_code": "varchar", "dual_status_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "medicare_dual_eligibility", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"dual_status_code": "varchar", "dual_status_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.107883, "relation_name": "raw.terminology.medicare_dual_eligibility", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__bill_type": {"database": "raw", "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": "2e28bfc3dc31c7858ebbdeb75c46bfa3ea2fd2e9448d65884289d909383b4ea5"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"bill_type_code": "varchar", "bill_type_description": "varchar", "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": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "bill_type", "tags": ["terminology", "data_profiling"], "column_types": {"bill_type_code": "varchar", "bill_type_description": "varchar", "deprecated": "integer", "deprecated_date": "date"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.052504, "relation_name": "raw.terminology.bill_type", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.terminology__loinc": {"database": "raw", "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/terminology','loinc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"loinc": "varchar", "short_name": "varchar", "long_common_name": "varchar", "component": "varchar", "property": "varchar", "time_aspect": "varchar", "system": "varchar", "scale_type": "varchar", "method_type": "varchar", "class_code": "varchar", "class_description": "varchar", "class_type_code": "varchar", "class_type_description": "varchar", "external_copyright_notice": "varchar(3000)", "status": "varchar", "version_first_released": "varchar", "version_last_changed": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null, "columns": [{"name": "loinc", "description": "The LOINC code"}, {"name": "short_name", "description": "If exists, the short human readable version of the LOINC description"}, {"name": "long_common_name", "description": "Clinician-friendly full loinc description"}, {"name": "component", "description": "The substance or entity being measured or observed. Also called the Analyte. The first of six loinc parts."}, {"name": "property", "description": "The characteristic or attribute of the analyte. The second of six loinc parts."}, {"name": "time_aspect", "description": "The interval of time over which an observation was made. The third of six loinc parts."}, {"name": "system", "description": "The thing upon which the observation was made. Also called specimen for laboratory tests. The fourth of six loinc parts."}, {"name": "scale_type", "description": "How the observation value is quantified or expressed (e.g. quantitative, ordinal, nominal, etc). The fifth of six loinc parts."}, {"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."}, {"name": "class_code", "description": "A code representing the general category of the loinc term"}, {"name": "class_description", "description": "The general category of the LOINC term"}, {"name": "class_type_code", "description": "A code representing the top level category for the test"}, {"name": "class_type_description", "description": "The top level category for the test; Laboratory, Clincal, Claims attachments, or Surveys"}, {"name": "external_copyright_notice", "description": "External copyright holders copyright notice for this LOINC code"}, {"name": "status", "description": "The status of the LOINC code concept. Active, Trial (experimental), Discouraged (not recommended), or Deprecated (should not be used)"}, {"name": "version_first_released", "description": "The first release version of LOINC that included this code"}, {"name": "version_last_changed", "description": "The last LOINC version in which this record was changed"}]}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','loinc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "loinc", "tags": ["terminology"], "columns": [{"name": "loinc", "description": "The LOINC code"}, {"name": "short_name", "description": "If exists, the short human readable version of the LOINC description"}, {"name": "long_common_name", "description": "Clinician-friendly full loinc description"}, {"name": "component", "description": "The substance or entity being measured or observed. Also called the Analyte. The first of six loinc parts."}, {"name": "property", "description": "The characteristic or attribute of the analyte. The second of six loinc parts."}, {"name": "time_aspect", "description": "The interval of time over which an observation was made. The third of six loinc parts."}, {"name": "system", "description": "The thing upon which the observation was made. Also called specimen for laboratory tests. The fourth of six loinc parts."}, {"name": "scale_type", "description": "How the observation value is quantified or expressed (e.g. quantitative, ordinal, nominal, etc). The fifth of six loinc parts."}, {"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."}, {"name": "class_code", "description": "A code representing the general category of the loinc term"}, {"name": "class_description", "description": "The general category of the LOINC term"}, {"name": "class_type_code", "description": "A code representing the top level category for the test"}, {"name": "class_type_description", "description": "The top level category for the test; Laboratory, Clincal, Claims attachments, or Surveys"}, {"name": "external_copyright_notice", "description": "External copyright holders copyright notice for this LOINC code"}, {"name": "status", "description": "The status of the LOINC code concept. Active, Trial (experimental), Discouraged (not recommended), or Deprecated (should not be used)"}, {"name": "version_first_released", "description": "The first release version of LOINC that included this code"}, {"name": "version_last_changed", "description": "The last LOINC version in which this record was changed"}], "column_types": {"loinc": "varchar", "short_name": "varchar", "long_common_name": "varchar", "component": "varchar", "property": "varchar", "time_aspect": "varchar", "system": "varchar", "scale_type": "varchar", "method_type": "varchar", "class_code": "varchar", "class_description": "varchar", "class_type_code": "varchar", "class_type_description": "varchar", "external_copyright_notice": "varchar(3000)", "status": "varchar", "version_first_released": "varchar", "version_last_changed": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.0985768, "relation_name": "raw.terminology.loinc", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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/terminology','snomed_icd_10_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"id": "varchar", "effective_time": "varchar", "active": "varchar", "module_id": "varchar", "ref_set_id": "varchar", "referenced_component_id": "varchar", "referenced_component_name": "varchar", "map_group": "varchar", "map_priority": "varchar", "map_rule": "varchar(500)", "map_advice": "varchar(500)", "map_target": "varchar", "map_target_name": "varchar", "correlation_id": "varchar", "map_category_id": "varchar", "map_category_name": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "hcc_suspecting"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','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", "effective_time": "varchar", "active": "varchar", "module_id": "varchar", "ref_set_id": "varchar", "referenced_component_id": "varchar", "referenced_component_name": "varchar", "map_group": "varchar", "map_priority": "varchar", "map_rule": "varchar(500)", "map_advice": "varchar(500)", "map_target": "varchar", "map_target_name": "varchar", "correlation_id": "varchar", "map_category_id": "varchar", "map_category_name": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708461581.146541, "relation_name": "raw.terminology.snomed_icd_10_map", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.data_quality__test_catalog": {"database": "raw", "schema": "data_quality", "name": "data_quality__test_catalog", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__test_catalog.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__test_catalog.csv", "unique_id": "seed.the_tuva_project.data_quality__test_catalog", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__test_catalog"], "alias": "_value_set_test_catalog", "checksum": {"name": "sha256", "checksum": "bc9b83eedf11d59ad14860b4ff4b3a83c2ac1c8a882b6587be904319ef4fff2e"}, "config": {"enabled": true, "alias": "_value_set_test_catalog", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"source_table": "varchar", "test_category": "varchar", "test_name": "varchar", "test_field": "varchar", "claim_type": "varchar", "pipeline_test": "integer"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_value_set_test_catalog", "tags": ["data_quality", "claims_preprocessing"], "enabled": true, "column_types": {"source_table": "varchar", "test_category": "varchar", "test_name": "varchar", "test_field": "varchar", "claim_type": "varchar", "pipeline_test": "integer"}, "docs": {"node_color": "#141161"}}, "created_at": 1708461581.149847, "relation_name": "raw.data_quality._value_set_test_catalog", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.service_category__service_categories": {"database": "raw", "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": "_value_set_service_categories", "checksum": {"name": "sha256", "checksum": "8e26537c0e32a9a8dc6e9ed587f9fde623955d8c981a6c832527ae3988587143"}, "config": {"enabled": true, "alias": "_value_set_service_categories", "schema": "claims_preprocessing", "database": null, "tags": ["service_category", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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": ["service_category", "claims_preprocessing"], "description": "List of service categories and sub-categories", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/service_categories/service_categories_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_value_set_service_categories", "tags": ["service_category", "claims_preprocessing"], "enabled": true}, "created_at": 1708461581.151422, "relation_name": "raw.claims_preprocessing._value_set_service_categories", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.ed_classification__johnston_icd9": {"database": "raw", "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": "ff9a51b81f0b62a2059afdc216b4c9e1750c36c638c489f0fe1d99e943d32560"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"icd9": "varchar"}, "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": ["ed_classification"], "description": "A probabilistic mapping of icd9 codes to ed classification categories", "columns": {"icd9": {"name": "icd9", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnnpa": {"name": "edcnnpa", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnpa": {"name": "edcnpa", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "epct": {"name": "epct", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "noner": {"name": "noner", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "injury": {"name": "injury", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "psych": {"name": "psych", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "alcohol": {"name": "alcohol", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drug": {"name": "drug", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "alias": "_value_set_johnston_icd9", "tags": "ed_classification", "enabled": true, "column_types": {"icd9": "varchar"}}, "created_at": 1708461581.160871, "relation_name": "raw.ed_classification._value_set_johnston_icd9", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs": {"database": "raw", "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/value-sets','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar", "description": "varchar", "ccs_diagnosis_category": "varchar", "ccs_description": "varchar"}, "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": ["ed_classification"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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/value-sets','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", "column_types": {"icd_10_cm": "varchar", "description": "varchar", "ccs_diagnosis_category": "varchar", "ccs_description": "varchar"}, "enabled": true}, "created_at": 1708461581.157503, "relation_name": "raw.ed_classification._value_set_icd_10_cm_to_ccs", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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": "path", "checksum": "seeds/value_sets/ed_classification/ed_classification__johnston_icd10.csv"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"icd10": "varchar"}, "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": ["ed_classification"], "description": "A probabilistic mapping of icd9 codes to ed classification categories", "columns": {"icd10": {"name": "icd10", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnnpa": {"name": "edcnnpa", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnpa": {"name": "edcnpa", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "epct": {"name": "epct", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "noner": {"name": "noner", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "injury": {"name": "injury", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "psych": {"name": "psych", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "alcohol": {"name": "alcohol", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drug": {"name": "drug", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "alias": "_value_set_johnston_icd10", "tags": "ed_classification", "enabled": true, "column_types": {"icd10": "varchar"}}, "created_at": 1708461581.16308, "relation_name": "raw.ed_classification._value_set_johnston_icd10", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.ed_classification__categories": {"database": "raw", "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": "a4a1b0d731d19623e16365ea9739848d4758aa16bc57e9f6cfddb510f4aff769"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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": ["ed_classification"], "description": "A mapping of ED Classifications to human readable names", "columns": {"classification": {"name": "classification", "description": "code for classification", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "classification_name": {"name": "classification_name", "description": "human readable name for classification", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "classification_order": {"name": "classification_order", "description": "Sortable column that organizes the ED classes", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "alias": "_value_set_categories", "tags": "ed_classification", "enabled": true}, "created_at": 1708461581.1535208, "relation_name": "raw.ed_classification._value_set_categories", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category": {"database": "raw", "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": "5ada1d0d458400596baf1a5e284e7d6559bf47ef94418cba529d27e11753d0d4"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"ccs_procedure_category": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_potentially_planned_ccs_procedure_category", "tags": "readmissions", "column_types": {"ccs_procedure_category": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.187514, "relation_name": "raw.readmissions._value_set_potentially_planned_ccs_procedure_category", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs": {"database": "raw", "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/value-sets','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar", "description": "varchar", "ccs_diagnosis_category": "varchar", "ccs_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "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/value-sets','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_icd_10_cm_to_ccs", "tags": "readmissions", "column_types": {"icd_10_cm": "varchar", "description": "varchar", "ccs_diagnosis_category": "varchar", "ccs_description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.1811998, "relation_name": "raw.readmissions._value_set_icd_10_cm_to_ccs", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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": "fc6b0634ce61183117cfedfb07c3c5f30d3276096f752d6493364594621a0d6e"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_potentially_planned_icd_10_pcs", "tags": "readmissions", "column_types": {"icd_10_pcs": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.1898282, "relation_name": "raw.readmissions._value_set_potentially_planned_icd_10_pcs", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.readmissions__acute_diagnosis_ccs": {"database": "raw", "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": "74b06e3fd3a570c8110eb488a98469b0678787d8af13a28ac99bc61b94713eae"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_acute_diagnosis_ccs", "tags": "readmissions", "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.1681972, "relation_name": "raw.readmissions._value_set_acute_diagnosis_ccs", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.readmissions__specialty_cohort": {"database": "raw", "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": "65ba652be488ef65b44533359bbae6973a247524c5ec72469a5b6ca7f5d18a34"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"ccs": "varchar", "description": "varchar", "specialty_cohort": "varchar", "procedure_or_diagnosis": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_specialty_cohort", "tags": "readmissions", "column_types": {"ccs": "varchar", "description": "varchar", "specialty_cohort": "varchar", "procedure_or_diagnosis": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.192469, "relation_name": "raw.readmissions._value_set_specialty_cohort", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category": {"database": "raw", "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": "fa65f6e11fdd726743a6ba462794bd5d22d518f82cac73b8aa8f4e0a067a36b0"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar", "exclusion_category": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_exclusion_ccs_diagnosis_category", "tags": "readmissions", "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar", "exclusion_category": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.177131, "relation_name": "raw.readmissions._value_set_exclusion_ccs_diagnosis_category", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm": {"database": "raw", "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": "path", "checksum": "seeds/value_sets/readmissions/readmissions__acute_diagnosis_icd_10_cm.csv"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_acute_diagnosis_icd_10_cm", "tags": "readmissions", "column_types": {"icd_10_cm": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.170358, "relation_name": "raw.readmissions._value_set_acute_diagnosis_icd_10_cm", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.readmissions__surgery_gynecology_cohort": {"database": "raw", "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": "da4b148d09202dca95cf53d461f385cd3f339dbe1d13d4eced8d2170ee9a559c"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar", "description": "varchar", "ccs_code_and_description": "varchar", "specialty_cohort": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_surgery_gynecology_cohort", "tags": "readmissions", "column_types": {"icd_10_pcs": "varchar", "description": "varchar", "ccs_code_and_description": "varchar", "specialty_cohort": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.195607, "relation_name": "raw.readmissions._value_set_surgery_gynecology_cohort", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category": {"database": "raw", "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": "a216ba7955ea5bca4ad11fae4501633a172a4a73fff064dbcfcc70e15ce7560a"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"ccs_procedure_category": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_always_planned_ccs_procedure_category", "tags": "readmissions", "column_types": {"ccs_procedure_category": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.174654, "relation_name": "raw.readmissions._value_set_always_planned_ccs_procedure_category", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs": {"database": "raw", "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/value-sets','icd_10_pcs_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar", "description": "varchar", "ccs_procedure_category": "varchar", "ccs_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "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/value-sets','icd_10_pcs_to_ccs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_icd_10_pcs_to_ccs", "tags": "readmissions", "column_types": {"icd_10_pcs": "varchar", "description": "varchar", "ccs_procedure_category": "varchar", "ccs_description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.1853719, "relation_name": "raw.readmissions._value_set_icd_10_pcs_to_ccs", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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": "499c76e35337737047bd80bcba0426a67c55692eb22f45194313e167ded1afe5"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_always_planned_ccs_diagnosis_category", "tags": "readmissions", "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708461581.172578, "relation_name": "raw.readmissions._value_set_always_planned_ccs_diagnosis_category", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.cms_hcc__disabled_interaction_factors": {"database": "raw", "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": "f1fa62cd3a233f13f980da6bb35cb01a0bc20dcd817c0c7cbb600cb3ca6f21df"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"hcc_code": "varchar", "coefficient": "float"}, "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": ["cms_hcc"], "description": "Disease and disabled interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_disabled_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"hcc_code": "varchar", "coefficient": "float"}}, "created_at": 1708461581.202482, "relation_name": "raw.cms_hcc._value_set_disabled_interaction_factors", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.cms_hcc__disease_hierarchy": {"database": "raw", "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": "aa684c0c1fd853f779a92c34557bb314cbca812b39bb80d9f0844244cf2d3cdb"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"hcc_code": "varchar", "hccs_to_exclude": "varchar"}, "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": ["cms_hcc"], "description": "Disease hierarchies by model version. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_disease_hierarchy", "tags": "cms_hcc", "enabled": true, "column_types": {"hcc_code": "varchar", "hccs_to_exclude": "varchar"}}, "created_at": 1708461581.206366, "relation_name": "raw.cms_hcc._value_set_disease_hierarchy", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings": {"database": "raw", "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": "path", "checksum": "seeds/value_sets/cms_hcc/cms_hcc__icd_10_cm_mappings.csv"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"payment_year": "integer", "diagnosis_code": "varchar", "cms_hcc_v24": "varchar", "cms_hcc_v24_flag": "varchar"}, "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": ["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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_icd_10_cm_mappings", "tags": "cms_hcc", "enabled": true, "column_types": {"payment_year": "integer", "diagnosis_code": "varchar", "cms_hcc_v24": "varchar", "cms_hcc_v24_flag": "varchar"}}, "created_at": 1708461581.212445, "relation_name": "raw.cms_hcc._value_set_icd_10_cm_mappings", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.cms_hcc__disease_factors": {"database": "raw", "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": "86f87019959c2d247a4332b5322dade51fbf4dba566afdd05113f419e2530a1e"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"hcc_code": "varchar", "coefficient": "float"}, "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": ["cms_hcc"], "description": "Disease factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_disease_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"hcc_code": "varchar", "coefficient": "float"}}, "created_at": 1708461581.204364, "relation_name": "raw.cms_hcc._value_set_disease_factors", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.cms_hcc__disease_interaction_factors": {"database": "raw", "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": "39f200d1fb78e90a00c40d0648550ebf8ff39226ea4fc49466c7fef5906957e0"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"hcc_code_1": "varchar", "hcc_code_2": "varchar", "coefficient": "float"}, "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": ["cms_hcc"], "description": "Disease interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_disease_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"hcc_code_1": "varchar", "hcc_code_2": "varchar", "coefficient": "float"}}, "created_at": 1708461581.20838, "relation_name": "raw.cms_hcc._value_set_disease_interaction_factors", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.cms_hcc__cpt_hcpcs": {"database": "raw", "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": "8bfc9383a75a38f1fc1ce3b9090eb17f32a2189ef0e758d8bd4e9efe4b527a65"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"payment_year": "integer", "hcpcs_cpt_code": "varchar", "included_flag": "varchar"}, "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": ["cms_hcc"], "description": "CPT/HCPCS encounter filtering included list by payment year. Combined and cleaned version of code files on cms.gov.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_cpt_hcpcs", "tags": "cms_hcc", "enabled": true, "column_types": {"payment_year": "integer", "hcpcs_cpt_code": "varchar", "included_flag": "varchar"}}, "created_at": 1708461581.1992939, "relation_name": "raw.cms_hcc._value_set_cpt_hcpcs", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.cms_hcc__adjustment_rates": {"database": "raw", "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": "b04e9b46c651f17c76c76a61ae62c2502fd13bc48bc3841e64f1b42f53c98369"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"coefficient": "float"}, "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": ["cms_hcc"], "description": "Adjustment rates by payment year. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_adjustment_rates", "tags": "cms_hcc", "enabled": true, "column_types": {"coefficient": "float"}}, "created_at": 1708461581.1970801, "relation_name": "raw.cms_hcc._value_set_adjustment_rates", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors": {"database": "raw", "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": "65cdffd158fbb68d3f5660c1d04fcc178210ad4ae7d481d407bce8eda245c9e6"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"coefficient": "float"}, "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": ["cms_hcc"], "description": "Enrollment interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_enrollment_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"coefficient": "float"}}, "created_at": 1708461581.209949, "relation_name": "raw.cms_hcc._value_set_enrollment_interaction_factors", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors": {"database": "raw", "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": "ea1080598a705aeaeb5d2dec5dfb70915b9e890b169847cfd3e7a04d53a8391a"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"coefficient": "float"}, "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": ["cms_hcc"], "description": "Payment HCC count factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_payment_hcc_count_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"coefficient": "float"}}, "created_at": 1708461581.213973, "relation_name": "raw.cms_hcc._value_set_payment_hcc_count_factors", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.cms_hcc__demographic_factors": {"database": "raw", "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": "0548d96979eb37e9677eaf24e02fada20ac6e65f1cbf7b57e216eb2a018eaaec"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"coefficient": "float"}, "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": ["cms_hcc"], "description": "Demographic factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_demographic_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"coefficient": "float"}}, "created_at": 1708461581.200788, "relation_name": "raw.cms_hcc._value_set_demographic_factors", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.quality_measures__value_sets": {"database": "raw", "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": "ccf04d2ac1f7304567f472688af5ea8eef9dfecc0b35e3504edbccb95e577286"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"code": "varchar"}, "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": ["quality_measures"], "description": "Concepts to value sets crosswalk. List of codes in each concept.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_value_set_codes", "tags": "quality_measures", "enabled": true, "column_types": {"code": "varchar"}}, "created_at": 1708461581.218786, "relation_name": "raw.quality_measures._value_set_codes", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.quality_measures__measures": {"database": "raw", "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": "e23d53774fec57d7b8664ef8f86f175381c450bb0b9dbd79e63aa8915490eb25"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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": ["quality_measures"], "description": "Overview of reporting measures.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_value_set_measures", "tags": "quality_measures", "enabled": true}, "created_at": 1708461581.2154438, "relation_name": "raw.quality_measures._value_set_measures", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.quality_measures__concepts": {"database": "raw", "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": "5e10ba31fb1bffd24bcb68fffef57426d18f34ad50d772ccd13f4bbe19051102"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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": ["quality_measures"], "description": "Measures to concepts crosswalk. List of concepts used in each reporting measure.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_value_set_concepts", "tags": "quality_measures", "enabled": true}, "created_at": 1708461581.216966, "relation_name": "raw.quality_measures._value_set_concepts", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": {"database": "raw", "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/value-sets','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", "icd_10_cm_code_description": "varchar", "default_ccsr_category_ip": "varchar", "default_ccsr_category_description_ip": "varchar", "default_ccsr_category_op": "varchar", "default_ccsr_category_description_op": "varchar", "ccsr_category_1": "varchar", "ccsr_category_1_description": "varchar", "ccsr_category_2": "varchar", "ccsr_category_2_description": "varchar", "ccsr_category_3": "varchar", "ccsr_category_3_description": "varchar", "ccsr_category_4": "varchar", "ccsr_category_4_description": "varchar", "ccsr_category_5": "varchar", "ccsr_category_5_description": "varchar", "ccsr_category_6": "varchar", "ccsr_category_6_description": "varchar"}, "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": ["ccsr"], "description": "A table containing the CSV mapping file included with the DXCCSR SAS program. The original CSV was not natively seedable, and the file was transformed with the coded included in the README. For each ICD-10-CM code, the table contains up to six CCSR category codes and a default CCSR category code.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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/value-sets','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", "icd_10_cm_code_description": "varchar", "default_ccsr_category_ip": "varchar", "default_ccsr_category_description_ip": "varchar", "default_ccsr_category_op": "varchar", "default_ccsr_category_description_op": "varchar", "ccsr_category_1": "varchar", "ccsr_category_1_description": "varchar", "ccsr_category_2": "varchar", "ccsr_category_2_description": "varchar", "ccsr_category_3": "varchar", "ccsr_category_3_description": "varchar", "ccsr_category_4": "varchar", "ccsr_category_4_description": "varchar", "ccsr_category_5": "varchar", "ccsr_category_5_description": "varchar", "ccsr_category_6": "varchar", "ccsr_category_6_description": "varchar"}}, "created_at": 1708461581.2281752, "relation_name": "raw.ccsr._value_set_dxccsr_v2023_1_cleaned_map", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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/value-sets','prccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar", "icd_10_pcs_description": "varchar", "prccsr": "varchar", "prccsr_description": "varchar", "clinical_domain": "varchar"}, "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": ["ccsr"], "description": "A table containing the CSV mapping file included with the PRCCSR SAS program. The original CSV was not natively seedable, and the file was transformed with the coded included in the README.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "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/value-sets','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", "icd_10_pcs_description": "varchar", "prccsr": "varchar", "prccsr_description": "varchar", "clinical_domain": "varchar"}}, "created_at": 1708461581.232304, "relation_name": "raw.ccsr._value_set_prccsr_v2023_1_cleaned_map", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/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": "raw", "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": "dd8b64d00c38d7a99174fa8d2b6b82f2eae2b039e7ef0cd00da36d3233d6b326"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {}, "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": ["ccsr"], "description": "A table containing descriptions of the top level categories used in the CCSR condition mapper.\nThis was manually exctracted from the User Guide PDF included with the DXCCSR SAS program.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/ccsr/ccsr_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ccsr", "alias": "_value_set_dxccsr_v2023_1_body_systems", "tags": ["ccsr"], "enabled": true}, "created_at": 1708461581.2337248, "relation_name": "raw.ccsr._value_set_dxccsr_v2023_1_body_systems", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings": {"database": "raw", "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": "a1437c89f125f1d1ce46b34463c680ffd0b115f825920fa48af0001777d7bcbb"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"diagnosis_code": "varchar", "cms_hcc_esrd_v21": "varchar", "cms_hcc_esrd_v24": "varchar", "cms_hcc_v22": "varchar", "cms_hcc_v24": "varchar", "cms_hcc_v28": "varchar", "rx_hcc_v05": "varchar", "rx_hcc_v08": "varchar"}, "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": ["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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/hcc_suspecting/hcc_suspecting_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_value_set_icd_10_cm_mappings", "tags": "hcc_suspecting", "enabled": true, "column_types": {"diagnosis_code": "varchar", "cms_hcc_esrd_v21": "varchar", "cms_hcc_esrd_v24": "varchar", "cms_hcc_v22": "varchar", "cms_hcc_v24": "varchar", "cms_hcc_v28": "varchar", "rx_hcc_v05": "varchar", "rx_hcc_v08": "varchar"}}, "created_at": 1708461581.239488, "relation_name": "raw.hcc_suspecting._value_set_icd_10_cm_mappings", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.hcc_suspecting__hcc_descriptions": {"database": "raw", "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": "97e91a43a05c049e748292586795c3f7fbd85d070125e7d3bbd895b58774d42f"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {"hcc_code": "varchar", "hcc_description": "varchar"}, "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": ["hcc_suspecting"], "description": "Disease factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/hcc_suspecting/hcc_suspecting_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_value_set_hcc_descriptions", "tags": "hcc_suspecting", "enabled": true, "column_types": {"hcc_code": "varchar", "hcc_description": "varchar"}}, "created_at": 1708461581.235748, "relation_name": "raw.hcc_suspecting._value_set_hcc_descriptions", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": {"database": "raw", "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": "765b1e8cf4a724b2269f44bc43e1d1ad8bbcdaf693afc6e2750e3f3f62b29ab3"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#804912"}, "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": "A higher level rollup grouping of conditions from the condition column", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the condition that each diagnosis code rolls up into", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_code": {"name": "icd_10_cm_code", "description": "The icd10 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_description": {"name": "icd_10_cm_description", "description": "The description for the icd10 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_column_name": {"name": "condition_column_name", "description": "The name of the column as it will appear in chronic_conditions_wide", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#804912"}, "patch_path": "the_tuva_project://seeds/value_sets/chronic_conditions/tuva_chronic_conditions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "_value_set_tuva_chronic_conditions_hierarchy", "tags": ["tuva_chronic_conditions", "chronic_conditions"], "enabled": true, "docs": {"node_color": "#804912"}}, "created_at": 1708461581.2413518, "relation_name": "raw.chronic_conditions._value_set_tuva_chronic_conditions_hierarchy", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy": {"database": "raw", "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": "path", "checksum": "seeds/value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv"}, "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": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#804912"}, "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": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#804912"}, "patch_path": "the_tuva_project://seeds/value_sets/chronic_conditions/cms_chronic_conditions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "_value_set_cms_chronic_conditions_hierarchy", "tags": ["cms_chronic_conditions", "chronic_conditions"], "enabled": true, "docs": {"node_color": "#804912"}}, "created_at": 1708461581.243037, "relation_name": "raw.chronic_conditions._value_set_cms_chronic_conditions_hierarchy", "raw_code": "", "root_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "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": "raw", "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": "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": 1708461580.631138, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "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 raw.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__medical_claim__claim_id_claim_line_number_.b9ab42f1f0": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(claim_id||'-'||claim_line_number)", "model": "{{ get_where_subquery(ref('core__medical_claim')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "unique_core__medical_claim__claim_id_claim_line_number_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__medical_claim__claim_id_claim_line_number_.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0", "fqn": ["the_tuva_project", "core", "unique_core__medical_claim__claim_id_claim_line_number_"], "alias": "unique_core__medical_claim__claim_id_claim_line_number_", "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": 1708461580.632017, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "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__claim_id_claim_line_number_.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (claim_id||'-'||claim_line_number) as unique_field,\n count(*) as n_records\n\nfrom raw.core.medical_claim\nwhere (claim_id||'-'||claim_line_number) is not null\ngroup by (claim_id||'-'||claim_line_number)\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.core__medical_claim", "attached_node": "model.the_tuva_project.core__medical_claim"}, "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": "raw", "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": "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": 1708461580.63274, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "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 raw.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.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "source_table", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_summary')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_summary_source_table", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_summary_source_table"], "alias": "not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10", "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__claims__f679bb8922eec2815a77cfff081e9e10"}, "created_at": 1708461580.680287, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10\") }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_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__claims_preprocessing_summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom raw.data_quality.claims_preprocessing_summary\nwhere source_table is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "source_table", "file_key_name": "models.data_quality__claims_preprocessing_summary", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_summary"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_category", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_summary')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_summary_test_category", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_summary_test_category"], "alias": "not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477", "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__claims__336abc6fa3e364c103685e2faae83477"}, "created_at": 1708461580.681003, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477\") }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_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__claims_preprocessing_summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_category\nfrom raw.data_quality.claims_preprocessing_summary\nwhere test_category is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "test_category", "file_key_name": "models.data_quality__claims_preprocessing_summary", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_summary"}, "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468": {"test_metadata": {"name": "claims_preprocessing_pipeline_checks", "kwargs": {"model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_summary')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_", "resource_type": "test", "package_name": "the_tuva_project", "path": "claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_"], "alias": "claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c", "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": "claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c"}, "created_at": 1708461580.681982, "relation_name": null, "raw_code": "{{ test_claims_preprocessing_pipeline_checks(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",alias=\"claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c\") }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_summary", "package": null, "version": null}, {"name": "data_quality__claims_preprocessing_test_detail", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.test_claims_preprocessing_pipeline_checks", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c.sql", "compiled": true, "compiled_code": "\n\n select *\n from raw.data_quality.claims_preprocessing_test_detail\n where pipeline_test = 1\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.data_quality__claims_preprocessing_summary", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_summary"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "source_table", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_detail')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_detail_source_table", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_detail_source_table"], "alias": "not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08", "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__claims__5898c059411e7fc10ba8219c734e6e08"}, "created_at": 1708461580.685459, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08\") }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_detail", "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__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom raw.data_quality.claims_preprocessing_test_detail\nwhere source_table is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "source_table", "file_key_name": "models.data_quality__claims_preprocessing_test_detail", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_category", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_detail')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_detail_test_category", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_detail_test_category"], "alias": "not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80", "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__claims__56459226ea7065b8eb9a80d40b78ff80"}, "created_at": 1708461580.686582, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80\") }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_detail", "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__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_category\nfrom raw.data_quality.claims_preprocessing_test_detail\nwhere test_category is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "test_category", "file_key_name": "models.data_quality__claims_preprocessing_test_detail", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_name", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_detail')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_detail_test_name", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_detail_test_name"], "alias": "not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049", "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__claims__f05207c475588fc8a73c0e2b3a575049"}, "created_at": 1708461580.687262, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049\") }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_detail", "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__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_name\nfrom raw.data_quality.claims_preprocessing_test_detail\nwhere test_name is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "test_name", "file_key_name": "models.data_quality__claims_preprocessing_test_detail", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "source_table", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_result')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_result_source_table", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__412833294baa145f20c48137d8814886.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_result_source_table"], "alias": "not_null_data_quality__claims__412833294baa145f20c48137d8814886", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__412833294baa145f20c48137d8814886", "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__claims__412833294baa145f20c48137d8814886"}, "created_at": 1708461580.687928, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__412833294baa145f20c48137d8814886\") }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_result", "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__claims_preprocessing_test_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__412833294baa145f20c48137d8814886.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom raw.data_quality.claims_preprocessing_test_result\nwhere source_table is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "source_table", "file_key_name": "models.data_quality__claims_preprocessing_test_result", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_test_result"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_category", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_result')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_result_test_category", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_result_test_category"], "alias": "not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367", "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__claims__b2af6c316533f702a46cd6223fa65367"}, "created_at": 1708461580.688576, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367\") }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_result", "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__claims_preprocessing_test_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_category\nfrom raw.data_quality.claims_preprocessing_test_result\nwhere test_category is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "test_category", "file_key_name": "models.data_quality__claims_preprocessing_test_result", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_test_result"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_name", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_result')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_result_test_name", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_result_test_name"], "alias": "not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49", "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__claims__9b4fbcc2957c4f9bd554a6666f91ad49"}, "created_at": 1708461580.6892219, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49\") }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_test_result", "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__claims_preprocessing_test_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_name\nfrom raw.data_quality.claims_preprocessing_test_result\nwhere test_name is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "test_name", "file_key_name": "models.data_quality__claims_preprocessing_test_result", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_test_result"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "use_case", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_use_case')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_use_case_use_case", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims_preprocessing_use_case_use_case.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_use_case_use_case"], "alias": "not_null_data_quality__claims_preprocessing_use_case_use_case", "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": 1708461580.690333, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_use_case", "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__claims_preprocessing_use_case"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims_preprocessing_use_case_use_case.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect use_case\nfrom raw.data_quality.claims_preprocessing_use_case\nwhere use_case is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "use_case", "file_key_name": "models.data_quality__claims_preprocessing_use_case", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_use_case"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "source_table", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_use_case')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_use_case_source_table", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_use_case_source_table"], "alias": "not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37", "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__claims__e20e4fef5e6980ffb07c442849539e37"}, "created_at": 1708461580.6914291, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37\") }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_use_case", "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__claims_preprocessing_use_case"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom raw.data_quality.claims_preprocessing_use_case\nwhere source_table is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "source_table", "file_key_name": "models.data_quality__claims_preprocessing_use_case", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_use_case"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_name", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_use_case')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_use_case_test_name", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims_preprocessing_use_case_test_name.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_use_case_test_name"], "alias": "not_null_data_quality__claims_preprocessing_use_case_test_name", "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": 1708461580.6922429, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "data_quality__claims_preprocessing_use_case", "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__claims_preprocessing_use_case"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims_preprocessing_use_case_test_name.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_name\nfrom raw.data_quality.claims_preprocessing_use_case\nwhere test_name is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "test_name", "file_key_name": "models.data_quality__claims_preprocessing_use_case", "attached_node": "model.the_tuva_project.data_quality__claims_preprocessing_use_case"}, "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": "raw", "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": 1708461580.754229, "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 raw.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.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(patient_id||'-'||model_version)", "model": "{{ get_where_subquery(ref('cms_hcc__int_demographic_factors')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "unique_cms_hcc__int_demographic_factors__patient_id_model_version_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400", "fqn": ["the_tuva_project", "cms_hcc", "unique_cms_hcc__int_demographic_factors__patient_id_model_version_"], "alias": "unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87", "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_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87"}, "created_at": 1708461580.754952, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87\") }}", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "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_demographic_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id||'-'||model_version) as unique_field,\n count(*) as n_records\n\nfrom raw.cms_hcc._int_demographic_factors\nwhere (patient_id||'-'||model_version) is not null\ngroup by (patient_id||'-'||model_version)\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.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": "raw", "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": 1708461580.755625, "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 raw.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": "raw", "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": 1708461580.756454, "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 raw.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": "raw", "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": 1708461580.757173, "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 raw.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.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(claim_id||'-'||claim_line_number)", "model": "{{ get_where_subquery(ref('normalized_input__medical_claim')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "unique_normalized_input__medical_claim__claim_id_claim_line_number_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46.sql", "original_file_path": "models/claims_preprocessing/claims_preprocessing_models.yml", "unique_id": "test.the_tuva_project.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f", "fqn": ["the_tuva_project", "claims_preprocessing", "unique_normalized_input__medical_claim__claim_id_claim_line_number_"], "alias": "unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46", "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_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46"}, "created_at": 1708461580.8825622, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46\") }}", "language": "sql", "refs": [{"name": "normalized_input__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.normalized_input__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/claims_preprocessing_models.yml/unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (claim_id||'-'||claim_line_number) as unique_field,\n count(*) as n_records\n\nfrom raw.claims_preprocessing.normalized_input_medical_claim\nwhere (claim_id||'-'||claim_line_number) is not null\ngroup by (claim_id||'-'||claim_line_number)\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.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": "raw", "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": 1708461580.931801, "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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": 1708461580.932703, "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_type\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_type\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": 1708461580.933418, "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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": 1708461580.934138, "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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": 1708461580.935531, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": 1708461580.936325, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": 1708461580.937072, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": 1708461580.940846, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw", "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": 1708461580.941665, "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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('ccsr__singular_condition_category')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "not_null_ccsr__singular_condition_category_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_ccsr__singular_condition_category_claim_id.sql", "original_file_path": "models/ccsr/ccsr_models.yml", "unique_id": "test.the_tuva_project.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8", "fqn": ["the_tuva_project", "ccsr", "not_null_ccsr__singular_condition_category_claim_id"], "alias": "not_null_ccsr__singular_condition_category_claim_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": 1708461580.952099, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "ccsr__singular_condition_category", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.ccsr__singular_condition_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/ccsr_models.yml/not_null_ccsr__singular_condition_category_claim_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom raw.ccsr.singular_condition_category\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.ccsr__singular_condition_category", "attached_node": "model.the_tuva_project.ccsr__singular_condition_category"}, "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('ccsr__singular_condition_category')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "unique_ccsr__singular_condition_category_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_ccsr__singular_condition_category_claim_id.sql", "original_file_path": "models/ccsr/ccsr_models.yml", "unique_id": "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b", "fqn": ["the_tuva_project", "ccsr", "unique_ccsr__singular_condition_category_claim_id"], "alias": "unique_ccsr__singular_condition_category_claim_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": 1708461580.952735, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "ccsr__singular_condition_category", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.ccsr__singular_condition_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/ccsr_models.yml/unique_ccsr__singular_condition_category_claim_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n claim_id as unique_field,\n count(*) as n_records\n\nfrom raw.ccsr.singular_condition_category\nwhere claim_id is not null\ngroup by claim_id\nhaving count(*) > 1\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.ccsr__singular_condition_category", "attached_node": "model.the_tuva_project.ccsr__singular_condition_category"}, "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(patient_id || '_' || year_month || '_' || plan)", "model": "{{ get_where_subquery(ref('financial_pmpm__pmpm_prep')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf.sql", "original_file_path": "models/financial_pmpm/financial_pmpm_models.yml", "unique_id": "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e", "fqn": ["the_tuva_project", "financial_pmpm", "unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_"], "alias": "unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf", "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_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf"}, "created_at": 1708461580.97557, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf\") }}", "language": "sql", "refs": [{"name": "financial_pmpm__pmpm_prep", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/financial_pmpm_models.yml/unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id || '_' || year_month || '_' || plan) as unique_field,\n count(*) as n_records\n\nfrom raw.financial_pmpm.pmpm_prep\nwhere (patient_id || '_' || year_month || '_' || plan) is not null\ngroup by (patient_id || '_' || year_month || '_' || plan)\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.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": "raw", "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": 1708461581.010636, "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 raw.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": "raw", "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": 1708461581.011352, "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 raw.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": "raw", "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": 1708461581.012068, "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 raw.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": "raw", "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": 1708461581.012735, "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 raw.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": "raw", "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": 1708461581.013412, "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 raw.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.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(patient_id || claim_id || start_date || condition)", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_long')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320", "fqn": ["the_tuva_project", "chronic_conditions", "unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_"], "alias": "unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b", "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_a604d2d2a2cdd1e22a6855beff37d57b"}, "created_at": 1708461581.014081, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_long", "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_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id || claim_id || start_date || condition) as unique_field,\n count(*) as n_records\n\nfrom raw.chronic_conditions.cms_chronic_conditions_long\nwhere (patient_id || claim_id || start_date || condition) is not null\ngroup by (patient_id || claim_id || start_date || condition)\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__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": "raw", "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": 1708461581.01492, "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 raw.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": "raw", "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": 1708461581.015572, "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 raw.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": "raw", "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": 1708461581.016234, "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 raw.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": "raw", "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": 1708461581.0168939, "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 raw.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": "raw", "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": 1708461581.01757, "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 raw.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": "raw", "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": 1708461581.018384, "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 raw.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": "raw", "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": 1708461581.0190341, "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 raw.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": "raw", "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": 1708461581.020915, "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 raw.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": "raw", "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": 1708461581.021767, "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 raw.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": "raw", "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": 1708461581.0224252, "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 raw.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": "raw", "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": 1708461581.023105, "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 raw.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.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(patient_id || '_' || condition)", "model": "{{ get_where_subquery(ref('chronic_conditions__tuva_chronic_conditions_long')) }}"}, "namespace": null}, "database": "raw", "schema": "dbt_test__audit", "name": "unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423.sql", "original_file_path": "models/chronic_conditions/tuva_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f", "fqn": ["the_tuva_project", "chronic_conditions", "unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_"], "alias": "unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423", "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_5a5fdcf2a52369894b11527da0860423"}, "created_at": 1708461581.033833, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_long", "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_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/tuva_chronic_conditions_models.yml/unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id || '_' || condition) as unique_field,\n count(*) as n_records\n\nfrom raw.chronic_conditions.tuva_chronic_conditions_long\nwhere (patient_id || '_' || condition) is not null\ngroup by (patient_id || '_' || condition)\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_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": "raw", "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": 1708461581.0346398, "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 raw.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": "raw", "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": 1708461581.0353081, "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 raw.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.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": "raw", "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": 1708461581.1634681, "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 raw.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": "raw", "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": 1708461581.164157, "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 raw.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": "raw", "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": 1708461581.164809, "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 raw.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": "raw", "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": 1708461581.165619, "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 raw.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"}}, "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": 1708461578.4875252, "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": 1708461578.487714, "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": 1708461578.487803, "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 {%- if date_format == 'YYYY-MM-DD' -%}\r\n case\r\n when {{ column_name }} similar to '[0-9]{4}-[0-9]{2}-[0-9]{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 '[0-9]{4}[0-9]{2}[0-9]{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 '[0-9]{2}/[0-9]{2}/[0-9]{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 '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{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": 1708461578.488148, "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": 1708461578.488488, "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": 1708461578.488572, "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": 1708461578.488846, "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": 1708461578.492405, "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": 1708461578.4926789, "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": 1708461578.492844, "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": 1708461578.492935, "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": 1708461578.4929972, "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": 1708461578.493164, "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": 1708461578.493535, "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": 1708461578.5030642, "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": 1708461578.5032792, "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": 1708461578.503893, "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": 1708461578.5042691, "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": 1708461578.504956, "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": 1708461578.505568, "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": 1708461578.5057821, "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": 1708461578.50595, "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": 1708461578.5061681, "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": 1708461578.506612, "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": 1708461578.506741, "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": 1708461578.506853, "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": 1708461578.507186, "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": 1708461578.507319, "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": 1708461578.507654, "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": 1708461578.5082471, "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": 1708461578.508398, "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": 1708461578.508578, "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": 1708461578.508796, "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": 1708461578.508875, "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": 1708461578.509414, "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": 1708461578.509669, "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": 1708461578.510745, "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": 1708461578.510954, "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": 1708461578.5111868, "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": 1708461578.511337, "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": 1708461578.5130339, "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": 1708461578.5133078, "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": 1708461578.5136828, "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": 1708461578.515404, "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": 1708461578.515779, "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": 1708461578.515863, "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": 1708461578.517801, "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": 1708461578.520083, "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": 1708461578.520195, "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": 1708461578.520434, "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": 1708461578.523537, "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": 1708461578.524485, "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": 1708461578.524645, "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": 1708461578.524978, "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": 1708461578.525179, "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": 1708461578.525368, "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": 1708461578.525567, "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": 1708461578.5257988, "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": 1708461578.526103, "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": 1708461578.52629, "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": 1708461578.5265448, "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": 1708461578.526646, "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": 1708461578.526774, "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": 1708461578.526886, "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": 1708461578.530095, "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": 1708461578.5302012, "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": 1708461578.530323, "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": 1708461578.530436, "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": 1708461578.531898, "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": 1708461578.532053, "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": 1708461578.532923, "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": 1708461578.5330298, "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": 1708461578.533299, "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": 1708461578.533729, "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": 1708461578.5338721, "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": 1708461578.5346382, "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": 1708461578.5348742, "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": 1708461578.5351, "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": 1708461578.53522, "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": 1708461578.53529, "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": 1708461578.53536, "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": 1708461578.5354471, "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": 1708461578.535585, "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": 1708461578.535747, "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": 1708461578.53586, "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": 1708461578.535956, "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": 1708461578.5360792, "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": 1708461578.53686, "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": 1708461578.537003, "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": 1708461578.537106, "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": 1708461578.537204, "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": 1708461578.537301, "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": 1708461578.5376, "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": 1708461578.537811, "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": 1708461578.538032, "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": 1708461578.5383732, "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": 1708461578.53857, "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": 1708461578.541492, "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": 1708461578.541611, "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": 1708461578.541771, "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": 1708461578.54226, "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": 1708461578.542368, "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": 1708461578.542486, "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": 1708461578.5434098, "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": 1708461578.5443032, "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": 1708461578.548044, "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": 1708461578.548224, "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": 1708461578.548335, "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": 1708461578.548393, "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": 1708461578.548487, "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": 1708461578.54856, "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": 1708461578.548693, "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": 1708461578.549283, "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": 1708461578.54941, "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": 1708461578.549593, "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": 1708461578.549888, "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": 1708461578.554875, "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": 1708461578.556878, "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": 1708461578.5572212, "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": 1708461578.557434, "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": 1708461578.557724, "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": 1708461578.557991, "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": 1708461578.5622149, "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": 1708461578.5624819, "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": 1708461578.562657, "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": 1708461578.563482, "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": 1708461578.563649, "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": 1708461578.564096, "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": 1708461578.566218, "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": 1708461578.5683122, "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": 1708461578.569618, "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": 1708461578.56998, "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": 1708461578.5704021, "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": 1708461578.5705621, "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": 1708461578.5710552, "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": 1708461578.576843, "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": 1708461578.577983, "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": 1708461578.578169, "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": 1708461578.578849, "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": 1708461578.5790331, "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": 1708461578.579486, "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": 1708461578.579984, "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": 1708461578.5806441, "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": 1708461578.580789, "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": 1708461578.580914, "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": 1708461578.581107, "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": 1708461578.581236, "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": 1708461578.581432, "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": 1708461578.581559, "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": 1708461578.5817332, "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": 1708461578.581856, "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": 1708461578.5819578, "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": 1708461578.582149, "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": 1708461578.585933, "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": 1708461578.590969, "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": 1708461578.591743, "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": 1708461578.592561, "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": 1708461578.593159, "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": 1708461578.5933282, "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": 1708461578.593407, "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": 1708461578.593625, "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": 1708461578.593716, "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": 1708461578.596404, "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": 1708461578.59872, "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": 1708461578.60321, "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": 1708461578.603812, "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": 1708461578.6039732, "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": 1708461578.6042922, "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": 1708461578.604424, "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": 1708461578.6045141, "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": 1708461578.604609, "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": 1708461578.6046872, "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": 1708461578.604793, "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": 1708461578.6048698, "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": 1708461578.6051688, "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": 1708461578.6052868, "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": 1708461578.606125, "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": 1708461578.606436, "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": 1708461578.606693, "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": 1708461578.6071, "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": 1708461578.607278, "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": 1708461578.6074722, "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": 1708461578.6077719, "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": 1708461578.6079721, "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": 1708461578.608563, "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": 1708461578.608802, "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": 1708461578.608923, "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": 1708461578.60906, "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": 1708461578.609189, "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": 1708461578.609799, "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": 1708461578.6105752, "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": 1708461578.6108701, "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": 1708461578.6110451, "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": 1708461578.611277, "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": 1708461578.611417, "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": 1708461578.6119978, "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": 1708461578.612308, "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": 1708461578.612459, "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": 1708461578.612648, "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": 1708461578.6129, "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": 1708461578.613091, "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": 1708461578.613436, "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": 1708461578.6137972, "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": 1708461578.614031, "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": 1708461578.614162, "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": 1708461578.614339, "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": 1708461578.6144059, "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": 1708461578.6146, "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": 1708461578.614702, "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": 1708461578.614919, "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": 1708461578.6150138, "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": 1708461578.615211, "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": 1708461578.615314, "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": 1708461578.615786, "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": 1708461578.6159182, "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": 1708461578.61611, "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": 1708461578.616213, "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": 1708461578.616411, "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": 1708461578.616509, "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": 1708461578.6172512, "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": 1708461578.6173282, "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": 1708461578.617763, "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": 1708461578.61791, "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": 1708461578.618016, "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": 1708461578.618856, "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": 1708461578.619196, "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": 1708461578.619436, "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": 1708461578.619634, "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": 1708461578.6197069, "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": 1708461578.6199539, "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": 1708461578.6200562, "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": 1708461578.620248, "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": 1708461578.6203468, "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": 1708461578.621019, "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": 1708461578.621166, "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": 1708461578.6214569, "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": 1708461578.6219149, "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": 1708461578.622211, "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": 1708461578.622331, "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": 1708461578.622443, "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": 1708461578.622626, "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": 1708461578.6226938, "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": 1708461578.623383, "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": 1708461578.623478, "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": 1708461578.624191, "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": 1708461578.624328, "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": 1708461578.6244779, "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": 1708461578.624675, "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": 1708461578.624775, "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": 1708461578.625082, "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": 1708461578.625191, "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": 1708461578.625323, "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": 1708461578.625751, "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": 1708461578.626035, "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": 1708461578.626237, "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": 1708461578.6264079, "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": 1708461578.626818, "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": 1708461578.627861, "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": 1708461578.628237, "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": 1708461578.628424, "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": 1708461578.6299572, "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": 1708461578.6307142, "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": 1708461578.631254, "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": 1708461578.631413, "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": 1708461578.631574, "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": 1708461578.631627, "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": 1708461578.6322508, "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": 1708461578.632653, "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": 1708461578.632811, "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": 1708461578.633064, "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": 1708461578.633302, "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": 1708461578.633417, "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": 1708461578.633587, "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": 1708461578.633672, "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": 1708461578.634366, "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": 1708461578.634655, "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": 1708461578.634785, "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": 1708461578.6352289, "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": 1708461578.635411, "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": 1708461578.635484, "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": 1708461578.635728, "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": 1708461578.6358452, "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": 1708461578.636008, "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": 1708461578.636061, "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": 1708461578.636244, "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": 1708461578.636342, "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": 1708461578.6365619, "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": 1708461578.636659, "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": 1708461578.6372008, "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": 1708461578.6374788, "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": 1708461578.637739, "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": 1708461578.63787, "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": 1708461578.6380968, "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": 1708461578.638198, "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": 1708461578.63839, "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": 1708461578.638515, "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": 1708461578.6387, "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": 1708461578.638815, "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": 1708461578.638999, "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": 1708461578.639076, "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": 1708461578.6392908, "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": 1708461578.639394, "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": 1708461578.63957, "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": 1708461578.639641, "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": 1708461578.64044, "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": 1708461578.6405451, "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": 1708461578.640652, "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": 1708461578.640754, "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": 1708461578.640862, "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": 1708461578.640963, "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": 1708461578.641073, "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": 1708461578.6411939, "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": 1708461578.641303, "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": 1708461578.6414049, "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": 1708461578.641512, "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": 1708461578.641611, "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": 1708461578.641719, "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": 1708461578.6418188, "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": 1708461578.642016, "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": 1708461578.642113, "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": 1708461578.6422951, "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": 1708461578.6423712, "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": 1708461578.642633, "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": 1708461578.642818, "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": 1708461578.642926, "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": 1708461578.6433861, "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": 1708461578.643511, "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": 1708461578.643683, "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": 1708461578.6438909, "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": 1708461578.6439838, "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": 1708461578.6442702, "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": 1708461578.644523, "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": 1708461578.64472, "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": 1708461578.644813, "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": 1708461578.645118, "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": 1708461578.6452491, "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": 1708461578.64537, "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": 1708461578.645508, "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": 1708461578.645903, "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": 1708461578.646018, "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": 1708461578.646118, "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": 1708461578.646192, "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": 1708461578.6463091, "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": 1708461578.646365, "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": 1708461578.6464798, "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": 1708461578.646601, "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": 1708461578.6472802, "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": 1708461578.647377, "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": 1708461578.647485, "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": 1708461578.647767, "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": 1708461578.6479008, "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": 1708461578.647997, "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": 1708461578.648104, "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": 1708461578.6481888, "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": 1708461578.650063, "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": 1708461578.650186, "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": 1708461578.65034, "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": 1708461578.6506171, "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": 1708461578.650795, "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": 1708461578.651017, "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": 1708461578.651152, "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": 1708461578.6512692, "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": 1708461578.6514401, "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": 1708461578.651825, "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": 1708461578.652002, "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": 1708461578.652102, "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": 1708461578.652433, "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": 1708461578.652715, "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": 1708461578.65292, "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": 1708461578.6530728, "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": 1708461578.6545548, "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": 1708461578.654633, "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": 1708461578.65476, "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": 1708461578.654907, "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": 1708461578.655178, "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": 1708461578.655339, "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": 1708461578.655422, "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": 1708461578.655593, "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": 1708461578.655746, "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": 1708461578.6559172, "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": 1708461578.656055, "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": 1708461578.656221, "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": 1708461578.656768, "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": 1708461578.656897, "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": 1708461578.657067, "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": 1708461578.657218, "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": 1708461578.657973, "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": 1708461578.658368, "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": 1708461578.6584902, "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": 1708461578.6585972, "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": 1708461578.659173, "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": 1708461578.659292, "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": 1708461578.659429, "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": 1708461578.659555, "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": 1708461578.659734, "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": 1708461578.660083, "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": 1708461578.662709, "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": 1708461578.662888, "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": 1708461578.663029, "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": 1708461578.6632051, "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": 1708461578.6633332, "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": 1708461578.663446, "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": 1708461578.66357, "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": 1708461578.663736, "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": 1708461578.663882, "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": 1708461578.664098, "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": 1708461578.6642282, "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": 1708461578.664343, "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": 1708461578.664462, "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": 1708461578.664567, "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": 1708461578.6647801, "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": 1708461578.6649442, "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": 1708461578.6667671, "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": 1708461578.666891, "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": 1708461578.6670961, "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": 1708461578.667234, "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": 1708461578.66737, "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": 1708461578.667486, "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": 1708461578.668205, "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": 1708461578.668427, "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": 1708461578.668556, "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": 1708461578.6687841, "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": 1708461578.668939, "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": 1708461578.669313, "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": 1708461578.669475, "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": 1708461578.669984, "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": 1708461578.6713011, "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": 1708461578.671403, "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": 1708461578.6719291, "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": 1708461578.672194, "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": 1708461578.672571, "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": 1708461578.672887, "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": 1708461578.6729338, "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": 1708461578.673289, "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": 1708461578.6734421, "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": 1708461578.673632, "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": 1708461578.673813, "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": 1708461578.6740859, "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": 1708461578.674479, "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": 1708461578.674874, "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": 1708461578.675292, "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": 1708461578.675502, "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": 1708461578.675714, "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": 1708461578.676613, "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": 1708461578.677279, "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": 1708461578.6779819, "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": 1708461578.678705, "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": 1708461578.679161, "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": 1708461578.679383, "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": 1708461578.679899, "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": 1708461578.680423, "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": 1708461578.680757, "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": 1708461578.681068, "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": 1708461578.6815202, "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": 1708461578.681845, "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": 1708461578.682249, "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": 1708461578.682494, "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": 1708461578.682965, "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 where {{ column_name }} is not null\n limit 1\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": 1708461578.6834629, "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": 1708461578.683965, "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": 1708461578.6844091, "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": 1708461578.684841, "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": 1708461578.6851032, "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": 1708461578.6853719, "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": 1708461578.685812, "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": 1708461578.686296, "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 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": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708461578.686804, "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": 1708461578.687541, "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": 1708461578.6881769, "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) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\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": 1708461578.688729, "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) %}\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-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\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.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708461578.6893172, "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": 1708461578.689717, "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": 1708461578.689922, "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": 1708461578.692925, "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": 1708461578.693931, "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": 1708461578.69412, "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": 1708461578.694241, "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": 1708461578.694627, "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": 1708461578.6948102, "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": 1708461578.694939, "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": 1708461578.695106, "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": 1708461578.695214, "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{#- 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": 1708461578.695607, "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": 1708461578.696197, "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": 1708461578.696755, "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": 1708461578.697164, "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": 1708461578.6973271, "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": 1708461578.6975732, "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": 1708461578.6978612, "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": 1708461578.698246, "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": 1708461578.698484, "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": 1708461578.698768, "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": 1708461578.699292, "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": 1708461578.69988, "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": 1708461578.700586, "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": 1708461578.700852, "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": 1708461578.700991, "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": 1708461578.701408, "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": 1708461578.701971, "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": 1708461578.702503, "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": 1708461578.7027981, "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": 1708461578.702996, "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": 1708461578.703995, "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": 1708461578.704937, "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') -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708461578.706059, "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') -%}\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 select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ 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": 1708461578.707158, "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": 1708461578.70735, "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": 1708461578.7074401, "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": 1708461578.710358, "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": 1708461578.712687, "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": 1708461578.712904, "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": 1708461578.7130728, "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": 1708461578.7136981, "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": 1708461578.7138612, "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 {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708461578.714001, "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": 1708461578.7141252, "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": 1708461578.7142332, "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": 1708461578.714345, "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": 1708461578.7146099, "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": 1708461578.7147672, "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": 1708461578.7150369, "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": 1708461578.715403, "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": 1708461578.715651, "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": 1708461578.715882, "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": 1708461578.717301, "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": 1708461578.7175412, "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": 1708461578.7180579, "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": 1708461578.718414, "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": 1708461578.719334, "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": 1708461578.720312, "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": 1708461578.721167, "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": 1708461578.72174, "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": 1708461578.722101, "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": 1708461578.722559, "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": 1708461578.7232032, "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": 1708461578.723592, "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": 1708461578.723726, "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": 1708461578.724051, "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": 1708461578.724468, "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": 1708461578.7248378, "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": 1708461578.725247, "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": 1708461578.725687, "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": 1708461578.725779, "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": 1708461578.7258701, "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": 1708461578.725961, "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": 1708461578.726366, "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": 1708461578.7268631, "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": 1708461578.7277691, "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": 1708461578.727975, "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": 1708461578.728425, "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": 1708461578.728985, "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": 1708461578.7308428, "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": 1708461578.731, "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": 1708461578.731093, "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 {%- if date_format == 'YYYY-MM-DD' -%}\r\n case\r\n when {{ column_name }} similar to '[0-9]{4}-[0-9]{2}-[0-9]{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 '[0-9]{4}[0-9]{2}[0-9]{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 '[0-9]{2}/[0-9]{2}/[0-9]{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 '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{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": 1708461578.7314382, "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": 1708461578.731767, "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 -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708461578.7318468, "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": 1708461578.733678, "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 set s3_access_key_id='AKIA2EPVNTV4FLAEBFGE';\n set s3_secret_access_key='TARgblERrFP81Op+52KZW7HrP1Om6ObEDQAUVN2u';\n set s3_region='us-east-1';\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": 1708461578.734453, "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 %}\ncopy {{ this }}\n from 's3://{{ uri }}/{{ pattern }}'\n access_key_id 'AKIA2EPVNTV4FLAEBFGE'\n secret_access_key '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'\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": 1708461578.7349691, "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": 1708461578.735509, "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 )\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": 1708461578.7363079, "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') }}\",\n AWS_SECRET_KEY = \"{{ env_var('AWS_SECRET_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' = 'true',\n 'inferSchema' = 'false',\n 'sep' = ','\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": 1708461578.737638, "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": 1708461578.7378151, "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": 1708461578.738026, "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": 1708461578.7381172, "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": 1708461578.738206, "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": 1708461578.7384489, "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": 1708461578.738858, "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": 1708461578.73915, "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": 1708461578.739956, "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": 1708461578.740741, "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": 1708461578.741021, "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": 1708461578.7413518, "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": 1708461578.741695, "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('terminology__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": 1708461578.7421482, "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": 1708461578.742282, "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"}}, "exposures": {}, "metrics": {}, "groups": {}, "selectors": {}, "disabled": {"snapshot.the_tuva_project.cms_hcc__patient_risk_scores_snapshot": [{"database": "raw", "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": null}, "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": null}, "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}, "created_at": 1708461580.235764, "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": "raw.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": "raw", "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": null}, "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": null}, "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}, "created_at": 1708461580.25316, "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": "raw.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": "raw", "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": null}, "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": null}, "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}, "created_at": 1708461580.256611, "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": "raw.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": "raw", "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": null}, "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": null}, "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}, "created_at": 1708461580.260192, "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": "raw.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.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.lab_result_seed": [], "seed.input_layer.pharmacy_claim_seed": [], "model.the_tuva_project.insights__count_claim_by_claim_type": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.insights__count_claim_by_service_category": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.insights__trend_count_claim_by_claim_type": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.insights__trend_sum_amount_by_claim_type": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.insights__orphan_claim_by_claim_type": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.financial_pmpm__member_months"], "model.the_tuva_project.insights__count_claim_by_date_column": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.financial_pmpm__member_months", "seed.the_tuva_project.terminology__calendar"], "model.the_tuva_project.insights__trend_sum_amount_by_service_category": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.insights__sum_amount_by_claim_type": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.insights__sum_amount_by_service_category": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.insights__trend_count_claim_by_service_category": ["model.the_tuva_project.core__medical_claim"], "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__summary", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.emergency_department__summary"], "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.data_quality__claims_preprocessing_summary", "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.data_quality__claims_preprocessing_summary", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.core__stg_claims_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.core__stg_claims_medical_claim": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.emergency_department__int_encounter_id", "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.acute_inpatient__encounter_id", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.emergency_department__int_encounter_id", "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.acute_inpatient__encounter_id", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.emergency_department__int_encounter_id", "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.data_quality__claims_preprocessing_summary", "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.data_quality__claims_preprocessing_summary", "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"], "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"], "model.the_tuva_project.core__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"], "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__medication": ["model.the_tuva_project.core__stg_clinical_medication"], "model.the_tuva_project.core__observation": ["model.the_tuva_project.core__stg_clinical_observation"], "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.data_quality__claims_preprocessing_use_case": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_summary": ["model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "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__claim_type", "seed.the_tuva_project.terminology__code_type", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__present_on_admission", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__calendar"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__calendar"], "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details"], "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__gender", "seed.the_tuva_project.terminology__medicare_dual_eligibility", "seed.the_tuva_project.terminology__medicare_orec", "seed.the_tuva_project.terminology__medicare_status", "seed.the_tuva_project.terminology__payer_type", "seed.the_tuva_project.terminology__race"], "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__condition": ["model.the_tuva_project.core__condition"], "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__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", "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.emergency_department__stg_eligibility": ["model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.emergency_department__stg_medical_claim": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.emergency_department__stg_service_category": ["model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.emergency_department__summary": ["model.input_layer.eligibility", "model.input_layer.medical_claim", "model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "model.the_tuva_project.emergency_department__int_first_claim_values", "model.the_tuva_project.emergency_department__int_institutional_encounter_id", "model.the_tuva_project.emergency_department__int_last_claim_values", "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.emergency_department__int_encounter_id": ["model.the_tuva_project.emergency_department__int_institutional_encounter_id", "model.the_tuva_project.emergency_department__int_professional_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim"], "model.the_tuva_project.emergency_department__int_first_claim_values": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim"], "model.the_tuva_project.emergency_department__int_institutional_claims": ["model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.emergency_department__stg_service_category"], "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates": ["model.the_tuva_project.emergency_department__int_institutional_claims", "model.the_tuva_project.emergency_department__int_institutional_encounter_id"], "model.the_tuva_project.emergency_department__int_last_claim_values": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim"], "model.the_tuva_project.emergency_department__int_professional_encounter_id": ["model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.emergency_department__stg_service_category"], "model.the_tuva_project.emergency_department__int_institutional_encounter_id": ["model.the_tuva_project.emergency_department__int_institutional_claims"], "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"], "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.terminology__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_code_normalize", "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.terminology__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.terminology__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"], "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.service_category__stg_medical_claim": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.service_category__dq_input_layer_results": ["model.the_tuva_project.service_category__dq_input_layer_tests"], "model.the_tuva_project.service_category__dq_multiple_service_categories_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__dq_multiple_service_categories_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "model.the_tuva_project.service_category__dq_input_layer_tests": ["model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__claim_type", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.service_category__service_category_grouper": ["model.the_tuva_project.service_category__combined_institutional", "model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__hospice_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__ambulatory_surgery_professional": ["model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__home_health_professional": ["model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__urgent_care_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__duplicate_bill_types": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__dialysis_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__lab_institutional": ["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__dme_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "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__inpatient_psychiatric_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__skilled_nursing_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__hospice_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "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__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__lab_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__combined_institutional": ["model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__dialysis_institutional", "model.the_tuva_project.service_category__duplicate_bill_types", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__home_health_institutional", "model.the_tuva_project.service_category__hospice_institutional", "model.the_tuva_project.service_category__lab_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__skilled_nursing_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__emergency_department_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__acute_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__office_visit_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "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__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_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__skilled_nursing_professional", "model.the_tuva_project.service_category__urgent_care_professional"], "model.the_tuva_project.service_category__ambulance_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_psychiatric_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__emergency_department_institutional": ["model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": ["model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__urgent_care_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__acute_inpatient_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.acute_inpatient__stg_medical_claim": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.acute_inpatient__stg_service_category": ["model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.acute_inpatient__stg_eligibility": ["model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.acute_inpatient__summary": ["model.input_layer.medical_claim", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.the_tuva_project.acute_inpatient__first_claim_values", "model.the_tuva_project.acute_inpatient__institutional_encounter_id", "model.the_tuva_project.acute_inpatient__last_claim_values", "model.the_tuva_project.acute_inpatient__stg_eligibility", "model.the_tuva_project.acute_inpatient__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__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.acute_inpatient__professional_encounter_id": ["model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__stg_service_category"], "model.the_tuva_project.acute_inpatient__last_claim_values": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim"], "model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims": ["model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "model.the_tuva_project.acute_inpatient__professional_encounter_id"], "model.the_tuva_project.acute_inpatient__data_quality_summary": ["model.the_tuva_project.acute_inpatient__institutional_claims"], "model.the_tuva_project.acute_inpatient__institutional_encounter_id": ["model.the_tuva_project.acute_inpatient__institutional_claims"], "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates": ["model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_encounter_id"], "model.the_tuva_project.acute_inpatient__claims_with_encounter_data": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.the_tuva_project.acute_inpatient__institutional_claims"], "model.the_tuva_project.acute_inpatient__first_claim_values": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim"], "model.the_tuva_project.acute_inpatient__encounter_id": ["model.the_tuva_project.acute_inpatient__institutional_encounter_id", "model.the_tuva_project.acute_inpatient__professional_encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim"], "model.the_tuva_project.acute_inpatient__institutional_claims": ["model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__stg_service_category"], "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_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf2372_long"], "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__frailty": ["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", "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_advanced_illness": ["model.the_tuva_project.quality_measures__int_nqf2372__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_nqf2372_exclude_institutional": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__stg_medical_claim"], "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__stg_core__patient"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia": ["model.the_tuva_project.quality_measures__int_nqf2372__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_nqf2372_exclude_palliative": ["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_exclusions": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative"], "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_nqf2372_exclude_hospice": ["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_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_exclude_dementia": ["model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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_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", "model.the_tuva_project.quality_measures__stg_core__patient", "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_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp"], "model.the_tuva_project.quality_measures__int_nqf0034__frailty": ["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__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_exclude_hospice_palliative": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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_exclude_advanced_illness": ["model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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_exclude_institutional_snp": ["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_medical_claim"], "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.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_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.financial_pmpm__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__member_months": ["model.the_tuva_project.financial_pmpm__stg_eligibility", "seed.the_tuva_project.terminology__calendar"], "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__condition": ["model.the_tuva_project.core__condition"], "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_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__int_patient_hcc_history": ["model.the_tuva_project.hcc_suspecting__int_all_conditions"], "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_prep_conditions": ["model.the_tuva_project.hcc_suspecting__stg_core__condition", "seed.the_tuva_project.terminology__snomed_icd_10_map"], "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim": ["model.input_layer.pharmacy_claim"], "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__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_medical_claim": ["model.input_layer.medical_claim"], "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.tuva_chronic_conditions__stg_core__condition", "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy"], "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.tuva_chronic_conditions__stg_core__patient", "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy"], "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_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__procedure", "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim", "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__procedure", "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"], "seed.the_tuva_project.terminology__admit_type": [], "seed.the_tuva_project.terminology__ssa_fips_state": [], "seed.the_tuva_project.terminology__medicare_orec": [], "seed.the_tuva_project.terminology__gender": [], "seed.the_tuva_project.terminology__ethnicity": [], "seed.the_tuva_project.terminology__ms_drg": [], "seed.the_tuva_project.terminology__revenue_center": [], "seed.the_tuva_project.terminology__icd_9_cm": [], "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__calendar": [], "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__fips_county": [], "seed.the_tuva_project.terminology__ndc": [], "seed.the_tuva_project.terminology__ansi_fips_state": [], "seed.the_tuva_project.terminology__encounter_type": [], "seed.the_tuva_project.terminology__provider": [], "seed.the_tuva_project.terminology__payer_type": [], "seed.the_tuva_project.terminology__apr_drg": [], "seed.the_tuva_project.terminology__icd_10_pcs": [], "seed.the_tuva_project.terminology__code_type": [], "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.data_quality__test_catalog": [], "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.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__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": [], "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0": ["model.the_tuva_project.core__condition"], "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0": ["model.the_tuva_project.core__medical_claim"], "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5": ["model.the_tuva_project.core__procedure"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930": ["model.the_tuva_project.data_quality__claims_preprocessing_summary"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15": ["model.the_tuva_project.data_quality__claims_preprocessing_summary"], "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d": ["model.the_tuva_project.data_quality__claims_preprocessing_use_case"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47": ["model.the_tuva_project.data_quality__claims_preprocessing_use_case"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa": ["model.the_tuva_project.data_quality__claims_preprocessing_use_case"], "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.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400": ["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.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f": ["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.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8": ["model.the_tuva_project.ccsr__singular_condition_category"], "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b": ["model.the_tuva_project.ccsr__singular_condition_category"], "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e": ["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.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320": ["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.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f": ["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.procedure": ["model.the_tuva_project.core__stg_clinical_procedure"], "model.input_layer.practitioner": ["model.the_tuva_project.core__stg_clinical_practitioner"], "model.input_layer.encounter": ["model.the_tuva_project.core__stg_clinical_encounter"], "model.input_layer.eligibility": ["model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__stg_eligibility"], "model.input_layer.medical_claim": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim", "model.the_tuva_project.emergency_department__summary", "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.cms_chronic_conditions__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.input_layer.patient": ["model.the_tuva_project.core__stg_clinical_patient"], "model.input_layer.condition": ["model.the_tuva_project.core__stg_clinical_condition"], "model.input_layer.medication": ["model.the_tuva_project.core__stg_clinical_medication"], "model.input_layer.observation": ["model.the_tuva_project.core__stg_clinical_observation"], "model.input_layer.lab_result": ["model.the_tuva_project.core__stg_clinical_lab_result"], "seed.input_layer.eligibility_seed": ["model.input_layer.eligibility"], "seed.input_layer.medical_claim_seed": ["model.input_layer.medical_claim"], "seed.input_layer.lab_result_seed": [], "seed.input_layer.pharmacy_claim_seed": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.insights__count_claim_by_claim_type": [], "model.the_tuva_project.insights__count_claim_by_service_category": [], "model.the_tuva_project.insights__trend_count_claim_by_claim_type": [], "model.the_tuva_project.insights__trend_sum_amount_by_claim_type": [], "model.the_tuva_project.insights__orphan_claim_by_claim_type": [], "model.the_tuva_project.insights__count_claim_by_date_column": [], "model.the_tuva_project.insights__trend_sum_amount_by_service_category": [], "model.the_tuva_project.insights__sum_amount_by_claim_type": [], "model.the_tuva_project.insights__sum_amount_by_service_category": [], "model.the_tuva_project.insights__trend_count_claim_by_service_category": [], "model.the_tuva_project.medical_claim_expanded": [], "model.the_tuva_project.core__stg_claims_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_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.financial_pmpm__stg_pharmacy_claim", "model.the_tuva_project.insights__count_claim_by_claim_type", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__orphan_claim_by_claim_type", "model.the_tuva_project.insights__sum_amount_by_claim_type", "model.the_tuva_project.insights__trend_sum_amount_by_claim_type", "model.the_tuva_project.quality_measures__stg_pharmacy_claim"], "model.the_tuva_project.core__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.hcc_suspecting__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.readmissions__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.cms_chronic_conditions__stg_core__patient", "model.the_tuva_project.cms_hcc__stg_core__patient", "model.the_tuva_project.ed_classification__stg_patient", "model.the_tuva_project.hcc_suspecting__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient"], "model.the_tuva_project.core__lab_result": ["model.the_tuva_project.quality_measures__stg_core__lab_result"], "model.the_tuva_project.core__encounter": ["model.the_tuva_project.ed_classification__stg_encounter", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.readmissions__stg_core__encounter"], "model.the_tuva_project.core__eligibility": ["model.the_tuva_project.cms_hcc__stg_core__eligibility", "model.the_tuva_project.financial_pmpm__stg_eligibility"], "model.the_tuva_project.core__procedure": ["model.the_tuva_project.ccsr__stg_core__procedure", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "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_hcc__stg_core__medical_claim", "model.the_tuva_project.financial_pmpm__stg_medical_claim", "model.the_tuva_project.insights__count_claim_by_claim_type", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__count_claim_by_service_category", "model.the_tuva_project.insights__orphan_claim_by_claim_type", "model.the_tuva_project.insights__sum_amount_by_claim_type", "model.the_tuva_project.insights__sum_amount_by_service_category", "model.the_tuva_project.insights__trend_count_claim_by_claim_type", "model.the_tuva_project.insights__trend_count_claim_by_service_category", "model.the_tuva_project.insights__trend_sum_amount_by_claim_type", "model.the_tuva_project.insights__trend_sum_amount_by_service_category", "model.the_tuva_project.quality_measures__stg_medical_claim", "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0"], "model.the_tuva_project.core__location": [], "model.the_tuva_project.core__medication": ["model.the_tuva_project.quality_measures__stg_core__medication"], "model.the_tuva_project.core__observation": ["model.the_tuva_project.quality_measures__stg_core__observation"], "model.the_tuva_project.core__practitioner": [], "model.the_tuva_project.data_quality__claims_preprocessing_use_case": ["test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6"], "model.the_tuva_project.data_quality__claims_preprocessing_summary": ["model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_eligibility", "model.the_tuva_project.core__stg_claims_encounter", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_patient", "model.the_tuva_project.core__stg_claims_pharmacy_claim", "model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.core__stg_claims_procedure", "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result": ["test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"], "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"], "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.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__condition": [], "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.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__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.cms_hcc__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.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400"], "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.emergency_department__stg_eligibility": [], "model.the_tuva_project.emergency_department__stg_medical_claim": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_first_claim_values", "model.the_tuva_project.emergency_department__int_institutional_claims", "model.the_tuva_project.emergency_department__int_last_claim_values", "model.the_tuva_project.emergency_department__int_professional_encounter_id"], "model.the_tuva_project.emergency_department__stg_service_category": ["model.the_tuva_project.emergency_department__int_institutional_claims", "model.the_tuva_project.emergency_department__int_professional_encounter_id"], "model.the_tuva_project.emergency_department__summary": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.emergency_department__int_encounter_id": ["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.emergency_department__int_first_claim_values", "model.the_tuva_project.emergency_department__int_last_claim_values", "model.the_tuva_project.emergency_department__summary"], "model.the_tuva_project.emergency_department__int_first_claim_values": ["model.the_tuva_project.emergency_department__summary"], "model.the_tuva_project.emergency_department__int_institutional_claims": ["model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "model.the_tuva_project.emergency_department__int_institutional_encounter_id"], "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates": ["model.the_tuva_project.emergency_department__int_professional_encounter_id", "model.the_tuva_project.emergency_department__summary"], "model.the_tuva_project.emergency_department__int_last_claim_values": ["model.the_tuva_project.emergency_department__summary"], "model.the_tuva_project.emergency_department__int_professional_encounter_id": ["model.the_tuva_project.emergency_department__int_encounter_id"], "model.the_tuva_project.emergency_department__int_institutional_encounter_id": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "model.the_tuva_project.emergency_department__summary"], "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.acute_inpatient__stg_eligibility", "model.the_tuva_project.core__stg_claims_eligibility", "model.the_tuva_project.core__stg_claims_patient", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.emergency_department__stg_eligibility"], "model.the_tuva_project.normalized_input__pharmacy_claim": ["model.the_tuva_project.core__stg_claims_pharmacy_claim", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim", "model.the_tuva_project.data_quality__claims_preprocessing_use_case"], "model.the_tuva_project.normalized_input__medical_claim": ["model.the_tuva_project.acute_inpatient__stg_medical_claim", "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.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "test.the_tuva_project.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f"], "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_procedure_date_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.service_category__stg_medical_claim": ["model.the_tuva_project.service_category__acute_inpatient_institutional", "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_institutional", "model.the_tuva_project.service_category__dialysis_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__duplicate_bill_types", "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__hospice_institutional", "model.the_tuva_project.service_category__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_institutional", "model.the_tuva_project.service_category__lab_professional", "model.the_tuva_project.service_category__office_visit_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_psychiatric_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "model.the_tuva_project.service_category__outpatient_rehab_professional", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.service_category__skilled_nursing_institutional", "model.the_tuva_project.service_category__skilled_nursing_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__dq_input_layer_results": [], "model.the_tuva_project.service_category__dq_multiple_service_categories_professional": [], "model.the_tuva_project.service_category__dq_multiple_service_categories_institutional": [], "model.the_tuva_project.service_category__dq_input_layer_tests": ["model.the_tuva_project.service_category__dq_input_layer_results"], "model.the_tuva_project.service_category__service_category_grouper": ["model.the_tuva_project.acute_inpatient__stg_service_category", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.emergency_department__stg_service_category"], "model.the_tuva_project.service_category__hospice_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__duplicate_bill_types": ["model.the_tuva_project.service_category__combined_institutional"], "model.the_tuva_project.service_category__dialysis_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__lab_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "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"], "model.the_tuva_project.service_category__dme_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__skilled_nursing_professional"], "model.the_tuva_project.service_category__home_health_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "model.the_tuva_project.service_category__emergency_department_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__skilled_nursing_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "model.the_tuva_project.service_category__hospice_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "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__skilled_nursing_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__lab_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__combined_institutional": ["model.the_tuva_project.service_category__dq_multiple_service_categories_institutional", "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", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional"], "model.the_tuva_project.service_category__acute_inpatient_institutional": ["model.the_tuva_project.service_category__combined_institutional", "model.the_tuva_project.service_category__emergency_department_institutional"], "model.the_tuva_project.service_category__office_visit_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__combined_professional": ["model.the_tuva_project.service_category__dq_multiple_service_categories_professional", "model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.service_category__ambulance_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_psychiatric_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__emergency_department_institutional": ["model.the_tuva_project.service_category__combined_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__urgent_care_institutional"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "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"], "model.the_tuva_project.service_category__acute_inpatient_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.acute_inpatient__stg_medical_claim": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__first_claim_values", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__last_claim_values", "model.the_tuva_project.acute_inpatient__professional_encounter_id", "model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__stg_service_category": ["model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__professional_encounter_id"], "model.the_tuva_project.acute_inpatient__stg_eligibility": ["model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__summary": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.acute_inpatient__professional_encounter_id": ["model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims", "model.the_tuva_project.acute_inpatient__encounter_id"], "model.the_tuva_project.acute_inpatient__last_claim_values": ["model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims": [], "model.the_tuva_project.acute_inpatient__data_quality_summary": [], "model.the_tuva_project.acute_inpatient__institutional_encounter_id": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates": ["model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "model.the_tuva_project.acute_inpatient__professional_encounter_id", "model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__claims_with_encounter_data": ["model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims"], "model.the_tuva_project.acute_inpatient__first_claim_values": ["model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__encounter_id": ["model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "model.the_tuva_project.acute_inpatient__first_claim_values", "model.the_tuva_project.acute_inpatient__last_claim_values", "model.the_tuva_project.acute_inpatient__summary", "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.acute_inpatient__institutional_claims": ["model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.the_tuva_project.acute_inpatient__institutional_encounter_id"], "model.the_tuva_project.quality_measures__stg_medical_claim": ["model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "model.the_tuva_project.quality_measures__int_nqf2372_numerator"], "model.the_tuva_project.quality_measures__stg_core__patient": ["model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_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_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "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_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_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_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "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_nqf0034_numerator"], "model.the_tuva_project.quality_measures__stg_pharmacy_claim": ["model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia"], "model.the_tuva_project.quality_measures__stg_core__procedure": ["model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "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_nqf0034_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.quality_measures__summary_counts", "model.the_tuva_project.quality_measures__summary_wide"], "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__frailty": ["model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness": ["model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional": ["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_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_exclude_dementia": ["model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative": ["model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "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__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "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_nqf2372_exclude_hospice": ["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__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "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_exclude_dementia": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions"], "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__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "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__frailty": ["model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions"], "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.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": ["test.the_tuva_project.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8", "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b"], "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.ccsr__procedure_category_map": ["model.the_tuva_project.ccsr__long_procedure_category"], "model.the_tuva_project.financial_pmpm__stg_eligibility": ["model.the_tuva_project.financial_pmpm__member_months"], "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.financial_pmpm__pmpm_prep": ["model.the_tuva_project.financial_pmpm__pmpm_payer", "model.the_tuva_project.financial_pmpm__pmpm_payer_plan", "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e"], "model.the_tuva_project.financial_pmpm__member_months": ["model.the_tuva_project.financial_pmpm__pmpm_prep", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__orphan_claim_by_claim_type"], "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__condition": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions"], "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__summary"], "model.the_tuva_project.hcc_suspecting__summary": [], "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history": ["model.the_tuva_project.hcc_suspecting__list"], "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_prep_conditions": ["model.the_tuva_project.hcc_suspecting__int_all_conditions"], "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"], "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_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__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", "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f"], "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.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", "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320"], "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__summary", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_admit_type_voting"], "seed.the_tuva_project.terminology__ssa_fips_state": [], "seed.the_tuva_project.terminology__medicare_orec": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__gender": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__ethnicity": [], "seed.the_tuva_project.terminology__ms_drg": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_ms_drg_voting", "model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__revenue_center": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__icd_9_cm": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize"], "seed.the_tuva_project.terminology__race": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__rxnorm_to_atc": [], "seed.the_tuva_project.terminology__medicare_status": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__loinc_deprecated_mapping": [], "seed.the_tuva_project.terminology__place_of_service": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__discharge_disposition": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_discharge_disposition_voting", "model.the_tuva_project.readmissions__encounter_data_quality"], "seed.the_tuva_project.terminology__icd_9_pcs": ["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__claims_preprocessing_medical_claim_invalid_values", "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__summary", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_admit_source_voting"], "seed.the_tuva_project.terminology__calendar": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.financial_pmpm__member_months", "model.the_tuva_project.insights__count_claim_by_date_column", "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.terminology__other_provider_taxonomy": [], "seed.the_tuva_project.terminology__icd_10_cm": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "model.the_tuva_project.readmissions__encounter_with_ccs"], "seed.the_tuva_project.terminology__claim_type": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__hcpcs_level_2": ["model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__fips_county": [], "seed.the_tuva_project.terminology__ndc": [], "seed.the_tuva_project.terminology__ansi_fips_state": [], "seed.the_tuva_project.terminology__encounter_type": [], "seed.the_tuva_project.terminology__provider": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "model.the_tuva_project.ed_classification__summary", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_medical_npi_normalize"], "seed.the_tuva_project.terminology__payer_type": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__apr_drg": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_apr_drg_voting", "model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__icd_10_pcs": ["model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.readmissions__procedure_ccs"], "seed.the_tuva_project.terminology__code_type": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values"], "seed.the_tuva_project.terminology__medicare_dual_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__bill_type": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.normalized_input__int_bill_type_voting", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__loinc": [], "seed.the_tuva_project.terminology__snomed_icd_10_map": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions"], "seed.the_tuva_project.data_quality__test_catalog": ["model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details"], "seed.the_tuva_project.service_category__service_categories": [], "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_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "model.the_tuva_project.quality_measures__int_nqf2372_numerator"], "seed.the_tuva_project.quality_measures__measures": ["model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf2372__performance_period"], "seed.the_tuva_project.quality_measures__concepts": [], "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": ["model.the_tuva_project.ccsr__dx_vertical_pivot"], "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"], "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"], "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"], "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"], "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0": [], "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0": [], "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15": [], "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa": [], "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126": [], "test.the_tuva_project.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400": [], "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.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f": [], "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.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8": [], "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b": [], "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e": [], "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.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320": [], "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.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f": [], "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": {}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v8.json", "dbt_version": "1.4.9", "generated_at": "2024-02-21T19:58:22.236909Z", "invocation_id": "3b251ac3-6e0f-4d2f-8097-c3e7333acc05", "env": {}, "project_id": "c67fdb5d91230d67641e7c60c81d655e", "user_id": "e0288d5c-4d76-41ed-afd7-080af8fdeee9", "send_anonymous_usage_stats": true, "adapter_type": "snowflake"}, "nodes": {"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": "c92d7d6e8cdee32f1e4bc59cc1f1c496ee1c60a1798c38bd4f9a839fb2717ff3"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each person across all datasets.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "The claim on which the procedure was recorded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date": {"name": "procedure_date", "description": "Date when the procedure was performed.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the procedure code.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Description of the procedure code.", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "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\").", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.654786, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "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\nlimit 0", "extra_ctes_injected": true, "extra_ctes": []}, "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": "c0f8dcb63bbd8a89602af7d1991f7a22cbeb897b7a4fc5f53e138a9296f178b5"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "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, "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "First name of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Last name of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "practice_affiliation": {"name": "practice_affiliation", "description": "Practice affiliation of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "specialty": {"name": "specialty", "description": "Specialty of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sub_specialty": {"name": "sub_specialty", "description": "Sub specialty of the provider.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.6480289, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "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\nlimit 0", "extra_ctes_injected": true, "extra_ctes": []}, "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": "7d020e526e3f5694de500ea5e9f81717c18b2becabfc1dff236b0ffd40adb12f"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for a patient.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "attending_provider_id": {"name": "attending_provider_id", "description": "attending provider 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, "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI 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, "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, "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, "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid for the encounter by the insurer.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the encounter by the provider.\n", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.618064, "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 facility_npi\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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_numeric"], "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 INT ) 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 facility_npi\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\nlimit 0", "extra_ctes_injected": true, "extra_ctes": []}, "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": "982cfede679c0d134abc59c71a1c0aabffb2e5b01f2d84c122c717872f30cfc9"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "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, "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, "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, "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "Date the patient was born.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "Date the patient died.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "Indicates whether the patient has died.", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "Patient's first name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Patient's last name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Patient's street address.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "city": {"name": "city", "description": "Patient's city of address.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "state": {"name": "state", "description": "State the patient lives in (most recent known address)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "Zip code the patient lives in (most recent known address).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Patient's phone number.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.5370162, "relation_name": "tuva.input_layer.eligibility", "raw_code": "select\n patient_id\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\nfrom {{ ref('eligibility_seed') }}", "language": "sql", "refs": [["eligibility_seed"]], "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 , 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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\nfrom dev_sarah._tuva_synthetic.eligibility_seed", "extra_ctes_injected": true, "extra_ctes": []}, "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": "189006551e2aa9380319cb756893be2e208dcdc18183369dba7415bc90b4b0e0"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "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", "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "Start date for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_line_start_date": {"name": "claim_line_start_date", "description": "Start date for the claim line.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_line_end_date": {"name": "claim_line_end_date", "description": "End date for the claim line.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "Admission date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Discharge date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "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, "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, "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", "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, "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, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "The date the claim was paid.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid on the claim by the insurer.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "procedure_date_1": {"name": "procedure_date_1", "description": "Date of the 1st procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_2": {"name": "procedure_date_2", "description": "Date of the 2nd procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_3": {"name": "procedure_date_3", "description": "Date of the 3rd procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_4": {"name": "procedure_date_4", "description": "Date of the 4th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_5": {"name": "procedure_date_5", "description": "Date of the 5th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_6": {"name": "procedure_date_6", "description": "Date of the 6th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_7": {"name": "procedure_date_7", "description": "Date of the 7th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_8": {"name": "procedure_date_8", "description": "Date of the 8th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_9": {"name": "procedure_date_9", "description": "Date of the 9th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_10": {"name": "procedure_date_10", "description": "Date of the 10th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_11": {"name": "procedure_date_11", "description": "Date of the 11th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_12": {"name": "procedure_date_12", "description": "Date of the 12th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_13": {"name": "procedure_date_13", "description": "Date of the 13th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_14": {"name": "procedure_date_14", "description": "Date of the 14th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_15": {"name": "procedure_date_15", "description": "Date of the 15th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_16": {"name": "procedure_date_16", "description": "Date of the 16th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_17": {"name": "procedure_date_17", "description": "Date of the 17th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_18": {"name": "procedure_date_18", "description": "Date of the 18th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_19": {"name": "procedure_date_19", "description": "Date of the 19th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_20": {"name": "procedure_date_20", "description": "Date of the 20th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_21": {"name": "procedure_date_21", "description": "Date of the 21st procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_22": {"name": "procedure_date_22", "description": "Date of the 22nd procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_23": {"name": "procedure_date_23", "description": "Date of the 23rd procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_24": {"name": "procedure_date_24", "description": "Date of the 24th procedure on the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date_25": {"name": "procedure_date_25", "description": "Date of the 25th procedure on the claim.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.5985122, "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 , billing_npi\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 , data_source\nfrom {{ ref('medical_claim_seed') }}", "language": "sql", "refs": [["medical_claim_seed"]], "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 , billing_npi\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 , data_source\nfrom dev_sarah._tuva_synthetic.medical_claim_seed", "extra_ctes_injected": true, "extra_ctes": []}, "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": "9e6cd57222be5c6a03901fd513cdbdcd178e09f109de7c58b7afe513ae5c80ac"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "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", "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Number of doses.", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the prescription.", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date the claim was paid.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid by the health insurer for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "Contractual amount allowed to be paid by the payer + patient.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.\n", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.604851, "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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\nfrom {{ ref('pharmacy_claim_seed') }}", "language": "sql", "refs": [["pharmacy_claim_seed"]], "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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\nfrom dev_sarah._tuva_synthetic.pharmacy_claim_seed", "extra_ctes_injected": true, "extra_ctes": []}, "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": "ba8647dc0bcb914db16e0a9e250a0dc8137e68ce45ab3239a634be2e52a4ac5c"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "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, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "parent_organization": {"name": "parent_organization", "description": "The parent organization associated with the facility.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "The street address of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "city": {"name": "city", "description": "The city of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "state": {"name": "state", "description": "The state of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.629955, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_float"], "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\nlimit 0", "extra_ctes_injected": true, "extra_ctes": []}, "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": "ac6c7c9003e3ba687d20f4de3f3a049c14e446671a31c7d69f89970ffe599e3c"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "The first name of the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "The last name of the patient.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "The death date of the patient if there is one.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "A flag indicating if the patient has died.", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "address": {"name": "address", "description": "The address of the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "city": {"name": "city", "description": "The city where the patient lives.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "state": {"name": "state", "description": "The state where the patient lives.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code for the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "county": {"name": "county", "description": "The county for the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude for the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude for the patient.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.645159, "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 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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_float"], "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 INT ) as death_flag\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\nlimit 0", "extra_ctes_injected": true, "extra_ctes": []}, "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": "9e67f9077ebefb43b868ea2c8fe3ff38a588ae4fe6cc5690614789f2df29fe6a"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date when the condition was recorded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "onset_date": {"name": "onset_date", "description": "Date when the condition first occurred.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "resolved_date": {"name": "resolved_date", "description": "Date when the condition was resolved.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the condition.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition i.e. problem, admitting, or billing.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the condition code in the source system.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the condition code.", "meta": {}, "data_type": null, "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", "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.610594, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int"], "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 INT ) 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\nlimit 0", "extra_ctes_injected": true, "extra_ctes": []}, "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": "1e22d2c43fdffbfca36c3f69b287c7a45a81d97366aa8ffe3314f1e3f02c0a4a"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the medication was dispensed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "prescribing_date": {"name": "prescribing_date", "description": "Date the medication was prescribed.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The source code for the medication.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The source description of the medication.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code associated with the medication.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "rxnorm_description": {"name": "rxnorm_description", "description": "Description for the RxNorm code.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "atc_description": {"name": "atc_description", "description": "Description for the ATC code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "route": {"name": "route", "description": "The route used to administer the medication.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "strength": {"name": "strength", "description": "The strength of the medication.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "The quantity of the medication.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "quantity_unit": {"name": "quantity_unit", "description": "The units for the quantity.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "The number of days supply included.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "practitioner_id": {"name": "practitioner_id", "description": "Unique identifier for the practitioner who ordered the medication.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.635744, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int"], "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 INT ) as quantity\n , cast(null as TEXT ) as quantity_unit\n , cast(null as INT ) as days_supply\n , cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as data_source\nlimit 0", "extra_ctes_injected": true, "extra_ctes": []}, "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": "f811aa31586fe9cd5fce30d9b1160a415c09612da672b2957dd915dbfea5f030"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "panel_id": {"name": "panel_id", "description": "Unique identifier for the panel.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "Date the observation was recorded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "observation_type": {"name": "observation_type", "description": "Type of observation.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "Source code of the observation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Source description of the observation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "Normalized code type of the observation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "Normalized code of the observation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the observatino.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the observation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "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, "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, "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, "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, "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.640671, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "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\nlimit 0", "extra_ctes_injected": true, "extra_ctes": []}, "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": "2b70e3d7b8e2e7476af0eab32f835956d4a63d678b9cf9caa394030cb98da36f"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": [], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": [], "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "accession_number": {"name": "accession_number", "description": "The lab order number from the source system.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The description for the lab test from the source system.", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "The normalized description for the code.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the lab test.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the lab test.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "Date of the test result.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "collection_date": {"name": "collection_date", "description": "Date the test was collected.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "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, "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, "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, "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, "quote": null, "tags": []}, "source_abnormal_flag": {"name": "source_abnormal_flag", "description": "Indicates whether the result is abnormal or normal.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_abnormal_flag": {"name": "normalized_abnormal_flag", "description": "Normalized abnormal flag.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "specimen": {"name": "specimen", "description": "The type of specimen e.g. blood, plasma, urine.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "database": "tuva", "schema": "input_layer"}, "created_at": 1708545505.6262982, "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\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int"], "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 INT ) as source_abnormal_flag\n , cast(null as INT ) 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\nlimit 0", "extra_ctes_injected": true, "extra_ctes": []}, "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": "0f576b654df2062fa4770c70b5ee48bbf37333a5d8362500909ba7c280cbad63"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"patient_id": "varchar(255)", "member_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)", "address": "varchar(255)", "city": "varchar(255)", "state": "varchar(255)", "zip_code": "varchar(255)", "phone": "varchar(255)", "data_source": "varchar(255)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": [], "description": "", "columns": {}, "meta": {}, "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)", "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)", "address": "varchar(255)", "city": "varchar(255)", "state": "varchar(255)", "zip_code": "varchar(255)", "phone": "varchar(255)", "data_source": "varchar(255)"}}, "created_at": 1708545505.666404, "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": "253b54a7889f13cab9f6803280cd07105cfcf637cfa1253fe4b7158222ce0d51"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "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", "data_source": "varchar(255)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": [], "description": "", "columns": {}, "meta": {}, "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", "data_source": "varchar(255)"}}, "created_at": 1708545505.7315588, "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.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": "200211d64758e470275cc23e72be5ea67da2ed0355d3cf7cb950a84f6d121654"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "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)", "tuva_last_run": "varchar(255)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": [], "description": "", "columns": {}, "meta": {}, "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)", "tuva_last_run": "varchar(255)"}}, "created_at": 1708545505.678446, "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.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": "66096b86d7bd198c82e3c67c5546791e094b980d06ab9379d00e3b58c054dfd0"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "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", "data_source": "varchar(255)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": [], "description": "", "columns": {}, "meta": {}, "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", "data_source": "varchar(255)"}}, "created_at": 1708545505.7385678, "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.insights__count_claim_by_claim_type": {"database": "dev_sarah", "schema": "insights", "name": "insights__count_claim_by_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__count_claim_by_claim_type.sql", "original_file_path": "models/insights/final/insights__count_claim_by_claim_type.sql", "unique_id": "model.the_tuva_project.insights__count_claim_by_claim_type", "fqn": ["the_tuva_project", "insights", "final", "insights__count_claim_by_claim_type"], "alias": "count_claim_by_claim_type", "checksum": {"name": "sha256", "checksum": "aac53ff2bb99be715d6cad672ed44d502f2bf6ff0c6db695caa45600408b1b1f"}, "config": {"enabled": true, "alias": "count_claim_by_claim_type", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "columns": [{"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}], "post-hook": [], "pre-hook": []}, "tags": ["insights"], "description": "Count of distinct claims by claim type.", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "count_claim_by_claim_type", "tags": ["insights"], "materialized": "table", "columns": [{"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}], "enabled": true, "bind": false}, "created_at": 1708545506.073571, "relation_name": "dev_sarah.insights.count_claim_by_claim_type", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect \r\n claim_type\r\n , count(distinct claim_id) as distinct_claim_count\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by claim_type\r\nunion all\r\nselect \r\n 'pharmacy'\r\n , count(distinct claim_id) as distinct_claim_count\r\nfrom {{ ref('core__pharmacy_claim') }}", "language": "sql", "refs": [["core__medical_claim"], ["core__pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__count_claim_by_claim_type.sql", "compiled": true, "compiled_code": "\n\n\nselect \n claim_type\n , count(distinct claim_id) as distinct_claim_count\nfrom dev_sarah.core.medical_claim\ngroup by claim_type\nunion all\nselect \n 'pharmacy'\n , count(distinct claim_id) as distinct_claim_count\nfrom dev_sarah.core.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.insights__count_claim_by_service_category": {"database": "dev_sarah", "schema": "insights", "name": "insights__count_claim_by_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__count_claim_by_service_category.sql", "original_file_path": "models/insights/final/insights__count_claim_by_service_category.sql", "unique_id": "model.the_tuva_project.insights__count_claim_by_service_category", "fqn": ["the_tuva_project", "insights", "final", "insights__count_claim_by_service_category"], "alias": "count_claim_by_service_category", "checksum": {"name": "sha256", "checksum": "a609ab061fbf9f188e5f00f37160f10b8037dac58cb6f9aeb7791d235f3907ae"}, "config": {"enabled": true, "alias": "count_claim_by_service_category", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "columns": [{"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}], "post-hook": [], "pre-hook": []}, "tags": ["insights"], "description": "Count of distinct claims by service category.", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "count_claim_by_service_category", "tags": ["insights"], "materialized": "table", "columns": [{"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}], "enabled": true, "bind": false}, "created_at": 1708545506.083117, "relation_name": "dev_sarah.insights.count_claim_by_service_category", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect \r\n 'service_category_1' as service_category_type\r\n , service_category_1 as service_category\r\n , count(distinct claim_id) as distinct_claim_count\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by service_category_1\r\n\r\nunion all\r\n\r\nselect \r\n 'service_category_2' as service_category_type\r\n , service_category_2 as service_category\r\n , count(distinct claim_id) as distinct_claim_count\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by service_category_2", "language": "sql", "refs": [["core__medical_claim"], ["core__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__count_claim_by_service_category.sql", "compiled": true, "compiled_code": "\n\nselect \n 'service_category_1' as service_category_type\n , service_category_1 as service_category\n , count(distinct claim_id) as distinct_claim_count\nfrom dev_sarah.core.medical_claim\ngroup by service_category_1\n\nunion all\n\nselect \n 'service_category_2' as service_category_type\n , service_category_2 as service_category\n , count(distinct claim_id) as distinct_claim_count\nfrom dev_sarah.core.medical_claim\ngroup by service_category_2", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.insights__trend_count_claim_by_claim_type": {"database": "dev_sarah", "schema": "insights", "name": "insights__trend_count_claim_by_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__trend_count_claim_by_claim_type.sql", "original_file_path": "models/insights/final/insights__trend_count_claim_by_claim_type.sql", "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_claim_type", "fqn": ["the_tuva_project", "insights", "final", "insights__trend_count_claim_by_claim_type"], "alias": "trend_count_claim_by_claim_type", "checksum": {"name": "sha256", "checksum": "840c120c80c7edd82f4b970067c62781f8f517a7fde240f3dbfe0ed69f4b7ab4"}, "config": {"enabled": true, "alias": "trend_count_claim_by_claim_type", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "columns": [{"name": "year_month", "description": "Year and month of the claim end date."}, {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}, {"name": "distinct_claim_count_change", "description": "Change in distinct claim count from the previous year month."}, {"name": "distinct_claim_percentage_change", "description": "Percent in distinct claim count change from the previous year month."}], "post-hook": [], "pre-hook": []}, "tags": ["insights"], "description": "Monthly trend of distinct claims by claim type", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "trend_count_claim_by_claim_type", "tags": ["insights"], "materialized": "table", "columns": [{"name": "year_month", "description": "Year and month of the claim end date."}, {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}, {"name": "distinct_claim_count_change", "description": "Change in distinct claim count from the previous year month."}, {"name": "distinct_claim_percentage_change", "description": "Percent in distinct claim count change from the previous year month."}], "enabled": true, "bind": false}, "created_at": 1708545506.099433, "relation_name": "dev_sarah.insights.trend_count_claim_by_claim_type", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith trend_by_claim_type as(\r\n select\r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , claim_type\r\n , count(distinct claim_id) as distinct_claim_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , claim_type\r\n)\r\n, trend_with_previous_count as(\r\n select \r\n year_month\r\n , claim_type\r\n , distinct_claim_count\r\n , lag(distinct_claim_count) over (partition by claim_type order by year_month) as previous_distinct_claim_count\r\n from trend_by_claim_type\r\n)\r\n\r\nselect\r\n year_month\r\n , claim_type\r\n , distinct_claim_count\r\n , distinct_claim_count - previous_distinct_claim_count as distinct_claim_count_change\r\n , case\r\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \r\n else distinct_claim_count\r\n end as distinct_claim_percentage_change\r\nfrom trend_with_previous_count", "language": "sql", "refs": [["core__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__trend_count_claim_by_claim_type.sql", "compiled": true, "compiled_code": "\n\nwith trend_by_claim_type as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , claim_type\n , count(distinct claim_id) as distinct_claim_count\n from dev_sarah.core.medical_claim\n group by \n year_month\n , claim_type\n)\n, trend_with_previous_count as(\n select \n year_month\n , claim_type\n , distinct_claim_count\n , lag(distinct_claim_count) over (partition by claim_type order by year_month) as previous_distinct_claim_count\n from trend_by_claim_type\n)\n\nselect\n year_month\n , claim_type\n , distinct_claim_count\n , distinct_claim_count - previous_distinct_claim_count as distinct_claim_count_change\n , case\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \n else distinct_claim_count\n end as distinct_claim_percentage_change\nfrom trend_with_previous_count", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.insights__trend_sum_amount_by_claim_type": {"database": "dev_sarah", "schema": "insights", "name": "insights__trend_sum_amount_by_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__trend_sum_amount_by_claim_type.sql", "original_file_path": "models/insights/final/insights__trend_sum_amount_by_claim_type.sql", "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_claim_type", "fqn": ["the_tuva_project", "insights", "final", "insights__trend_sum_amount_by_claim_type"], "alias": "trend_sum_amount_by_claim_type", "checksum": {"name": "sha256", "checksum": "4e464a22d2d898b7d5fd096f3bd16bb3c57a887875544aef1e01c17ebd857ec6"}, "config": {"enabled": true, "alias": "trend_sum_amount_by_claim_type", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_paid_amount_change", "description": "Change in paid_amount from the previous month."}, {"name": "total_paid_amount_percent_change", "description": "Percent change in paid_amount from the previous month."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_allowed_amount_change", "description": "Change in allowed_amount from the previous month."}, {"name": "total_allowed_amount_percent_change", "description": "Percent change in allowed_amount from the previous month."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}, {"name": "total_charge_amount_change", "description": "Change in charge_amount from the previous month."}, {"name": "total_charge_amount_percent_change", "description": "Percent change in charge_amount from the previous month."}], "post-hook": [], "pre-hook": []}, "tags": ["insights"], "description": "Monthly trend of paid_amount, alllowed_amount, and charge_amount by claim type", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "trend_sum_amount_by_claim_type", "tags": ["insights"], "materialized": "table", "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_paid_amount_change", "description": "Change in paid_amount from the previous month."}, {"name": "total_paid_amount_percent_change", "description": "Percent change in paid_amount from the previous month."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_allowed_amount_change", "description": "Change in allowed_amount from the previous month."}, {"name": "total_allowed_amount_percent_change", "description": "Percent change in allowed_amount from the previous month."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}, {"name": "total_charge_amount_change", "description": "Change in charge_amount from the previous month."}, {"name": "total_charge_amount_percent_change", "description": "Percent change in charge_amount from the previous month."}], "enabled": true, "bind": false}, "created_at": 1708545506.1088011, "relation_name": "dev_sarah.insights.trend_sum_amount_by_claim_type", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith trend_by_medical_claim_type as(\r\n select\r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , claim_type\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , claim_type\r\n)\r\n, trend_by_pharmacy_claim_type as(\r\n select\r\n cast({{ date_part(\"year\", \"dispensing_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"dispensing_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , cast('pharmacy' as {{ dbt.type_string() }}) as claim_type\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , 0 as total_charge_amount\r\n from {{ ref('core__pharmacy_claim') }}\r\n group by \r\n year_month\r\n)\r\n, trend_with_previous_medical_sum as(\r\n select \r\n year_month\r\n , claim_type\r\n , total_paid_amount\r\n , lag(total_paid_amount) over (partition by claim_type order by year_month) as previous_total_paid_amount\r\n , total_allowed_amount\r\n , lag(total_allowed_amount) over (partition by claim_type order by year_month) as previous_total_allowed_amount\r\n , total_charge_amount\r\n , lag(total_charge_amount) over (partition by claim_type order by year_month) as previous_total_charge_amount\r\n from trend_by_medical_claim_type\r\n)\r\n, trend_with_previous_pharmacy_sum as(\r\n select \r\n year_month\r\n , claim_type\r\n , total_paid_amount\r\n , lag(total_paid_amount) over (partition by claim_type order by year_month) as previous_total_paid_amount\r\n , total_allowed_amount\r\n , lag(total_allowed_amount) over (partition by claim_type order by year_month) as previous_total_allowed_amount\r\n , total_charge_amount\r\n , lag(total_charge_amount) over (partition by claim_type order by year_month) as previous_total_charge_amount\r\n from trend_by_pharmacy_claim_type\r\n)\r\nselect\r\n year_month\r\n , claim_type\r\n , total_paid_amount\r\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\r\n , case \r\n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\r\n else total_paid_amount\r\n end as total_paid_amount_percent_change\r\n , total_allowed_amount\r\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\r\n , case \r\n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\r\n else total_allowed_amount\r\n end as total_allowed_amount_percent_change\r\n , total_charge_amount\r\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\r\n , case \r\n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\r\n else total_charge_amount\r\n end as total_charge_amount_percent_change\r\nfrom trend_with_previous_medical_sum\r\n\r\nunion all \r\n\r\nselect\r\n year_month\r\n , claim_type\r\n , total_paid_amount\r\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\r\n , case \r\n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\r\n else total_paid_amount\r\n end as total_paid_amount_percent_change\r\n , total_allowed_amount\r\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\r\n , case \r\n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\r\n else total_allowed_amount\r\n end as total_allowed_amount_percent_change\r\n , total_charge_amount\r\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\r\n , case \r\n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\r\n else total_charge_amount\r\n end as total_charge_amount_percent_change\r\nfrom trend_with_previous_pharmacy_sum", "language": "sql", "refs": [["core__medical_claim"], ["core__pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__trend_sum_amount_by_claim_type.sql", "compiled": true, "compiled_code": "\n\nwith trend_by_medical_claim_type as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , claim_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 from dev_sarah.core.medical_claim\n group by \n year_month\n , claim_type\n)\n, trend_by_pharmacy_claim_type as(\n select\n cast(date_part('year', dispensing_date) as TEXT) || right('0'||cast(date_part('month', dispensing_date) as TEXT),2) as year_month\n , cast('pharmacy' as TEXT) as claim_type\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , 0 as total_charge_amount\n from dev_sarah.core.pharmacy_claim\n group by \n year_month\n)\n, trend_with_previous_medical_sum as(\n select \n year_month\n , claim_type\n , total_paid_amount\n , lag(total_paid_amount) over (partition by claim_type order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by claim_type order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by claim_type order by year_month) as previous_total_charge_amount\n from trend_by_medical_claim_type\n)\n, trend_with_previous_pharmacy_sum as(\n select \n year_month\n , claim_type\n , total_paid_amount\n , lag(total_paid_amount) over (partition by claim_type order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by claim_type order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by claim_type order by year_month) as previous_total_charge_amount\n from trend_by_pharmacy_claim_type\n)\nselect\n year_month\n , claim_type\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_medical_sum\n\nunion all \n\nselect\n year_month\n , claim_type\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_pharmacy_sum", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.insights__orphan_claim_by_claim_type": {"database": "dev_sarah", "schema": "insights", "name": "insights__orphan_claim_by_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__orphan_claim_by_claim_type.sql", "original_file_path": "models/insights/final/insights__orphan_claim_by_claim_type.sql", "unique_id": "model.the_tuva_project.insights__orphan_claim_by_claim_type", "fqn": ["the_tuva_project", "insights", "final", "insights__orphan_claim_by_claim_type"], "alias": "orphan_claim_by_claim_type", "checksum": {"name": "sha256", "checksum": "fc94f0c9fcdd42adfdb72bc8a8d971a77a148619d31beb093850f9c46d9f5f6c"}, "config": {"enabled": true, "alias": "orphan_claim_by_claim_type", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "columns": [{"name": "claim_category", "description": "The broader claim type a claim belongs to e.g. medical or pharmacy."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}], "post-hook": [], "pre-hook": []}, "tags": ["insights"], "description": "Count of medical and pharmacy claims without a corresponding eligibilty record.", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "orphan_claim_by_claim_type", "tags": ["insights"], "materialized": "table", "columns": [{"name": "claim_category", "description": "The broader claim type a claim belongs to e.g. medical or pharmacy."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}], "enabled": true, "bind": false}, "created_at": 1708545506.0859032, "relation_name": "dev_sarah.insights.orphan_claim_by_claim_type", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith medical_claim_orphan as(\r\nselect\r\n 'medical_claim' as claim_category\r\n , claim_id\r\n , patient_id\r\n , cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\nfrom {{ ref('core__medical_claim') }}\r\n)\r\n\r\n, pharmacy_claim_orphan as(\r\nselect\r\n 'pharmacy_claim' as claim_category\r\n , claim_id\r\n , patient_id\r\n , cast({{ date_part(\"year\", \"dispensing_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"dispensing_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\nfrom {{ ref('core__pharmacy_claim') }}\r\n)\r\n, union_orphans as(\r\n select \r\n med.* \r\n from medical_claim_orphan med\r\n left join {{ ref('financial_pmpm__member_months') }} months\r\n on med.patient_id = months.patient_id\r\n and med.year_month = months.year_month\r\n where months.patient_id is null\r\n\r\n union all\r\n\r\n select \r\n med.* \r\n from pharmacy_claim_orphan med\r\n left join {{ ref('financial_pmpm__member_months') }} months\r\n on med.patient_id = months.patient_id\r\n and med.year_month = months.year_month\r\n where months.patient_id is null\r\n)\r\n\r\nselect\r\n claim_category\r\n , count(distinct claim_id) as distinct_claim_count\r\nfrom union_orphans\r\ngroup by claim_category", "language": "sql", "refs": [["core__medical_claim"], ["core__pharmacy_claim"], ["financial_pmpm__member_months"], ["financial_pmpm__member_months"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.financial_pmpm__member_months", "model.the_tuva_project.financial_pmpm__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__orphan_claim_by_claim_type.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim_orphan as(\nselect\n 'medical_claim' as claim_category\n , claim_id\n , patient_id\n , cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\nfrom dev_sarah.core.medical_claim\n)\n\n, pharmacy_claim_orphan as(\nselect\n 'pharmacy_claim' as claim_category\n , claim_id\n , patient_id\n , cast(date_part('year', dispensing_date) as TEXT) || right('0'||cast(date_part('month', dispensing_date) as TEXT),2) as year_month\nfrom dev_sarah.core.pharmacy_claim\n)\n, union_orphans as(\n select \n med.* \n from medical_claim_orphan med\n left join dev_sarah.financial_pmpm.member_months months\n on med.patient_id = months.patient_id\n and med.year_month = months.year_month\n where months.patient_id is null\n\n union all\n\n select \n med.* \n from pharmacy_claim_orphan med\n left join dev_sarah.financial_pmpm.member_months months\n on med.patient_id = months.patient_id\n and med.year_month = months.year_month\n where months.patient_id is null\n)\n\nselect\n claim_category\n , count(distinct claim_id) as distinct_claim_count\nfrom union_orphans\ngroup by claim_category", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.insights__count_claim_by_date_column": {"database": "dev_sarah", "schema": "insights", "name": "insights__count_claim_by_date_column", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__count_claim_by_date_column.sql", "original_file_path": "models/insights/final/insights__count_claim_by_date_column.sql", "unique_id": "model.the_tuva_project.insights__count_claim_by_date_column", "fqn": ["the_tuva_project", "insights", "final", "insights__count_claim_by_date_column"], "alias": "count_claim_by_date_column", "checksum": {"name": "sha256", "checksum": "f0cb82ac880516df2b77723c56e7e494b935730b8a41cf97b206a8dbcbbb9bb3"}, "config": {"enabled": true, "alias": "count_claim_by_date_column", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "columns": [{"name": "year_month", "description": "Year and month of the claim end date or the member enrollment."}, {"name": "member_months", "description": "Count of unique member months."}, {"name": "claim_start_date", "description": "Count of unique medical claims."}, {"name": "claim_end_date", "description": "Count of unique medical claims."}, {"name": "admission_date", "description": "Count of unique medical claims."}, {"name": "discharge_date", "description": "Count of unique medical claims."}, {"name": "medical_paid_date", "description": "Count of unique medical claims."}, {"name": "dispensing_date", "description": "Count of unique pharmacy claims."}, {"name": "pharmacy_paid_date", "description": "Count of unique pharmacy claims."}], "post-hook": [], "pre-hook": []}, "tags": ["insights"], "description": "Count of distinct claims by multiple dates.", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "count_claim_by_date_column", "tags": ["insights"], "materialized": "table", "columns": [{"name": "year_month", "description": "Year and month of the claim end date or the member enrollment."}, {"name": "member_months", "description": "Count of unique member months."}, {"name": "claim_start_date", "description": "Count of unique medical claims."}, {"name": "claim_end_date", "description": "Count of unique medical claims."}, {"name": "admission_date", "description": "Count of unique medical claims."}, {"name": "discharge_date", "description": "Count of unique medical claims."}, {"name": "medical_paid_date", "description": "Count of unique medical claims."}, {"name": "dispensing_date", "description": "Count of unique pharmacy claims."}, {"name": "pharmacy_paid_date", "description": "Count of unique pharmacy claims."}], "enabled": true, "bind": false}, "created_at": 1708545506.079249, "relation_name": "dev_sarah.insights.count_claim_by_date_column", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith date_stage as(\r\n\r\n select\r\n 'claim_start_date' as date_field\r\n , cast({{ date_part(\"year\", \"claim_start_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_start_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n\r\n union all\r\n\r\n select\r\n 'claim_end_date' as date_field\r\n , cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n union all\r\n\r\n select\r\n 'admission_date' as date_field\r\n , cast({{ date_part(\"year\", \"admission_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"admission_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n\r\n union all\r\n\r\n select\r\n 'discharge_date' as date_field\r\n , cast({{ date_part(\"year\", \"discharge_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"discharge_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n\r\n union all\r\n\r\n select\r\n 'medical paid_date' as date_field\r\n , cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n\r\n union all\r\n\r\n select\r\n 'dispensing_date' as date_field\r\n , cast({{ date_part(\"year\", \"dispensing_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"dispensing_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__pharmacy_claim') }}\r\n group by \r\n year_month\r\n\r\n union all\r\n\r\n select\r\n 'pharmacy paid_date' as date_field\r\n , cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , count(distinct claim_id) as distinct_count\r\n from {{ ref('core__pharmacy_claim') }}\r\n group by \r\n year_month\r\n\r\n union all \r\n\r\n select\r\n 'member_months' as date_field\r\n , year_month\r\n , count(*) as distinct_count\r\n from {{ ref('financial_pmpm__member_months') }}\r\n group by\r\n year_month\r\n)\r\n\r\n\r\n, all_date_range as (\r\n select distinct \r\n replace(cal.year_month,'-','') as year_month\r\n from {{ ref('terminology__calendar') }} cal\r\n where (cal.year_month >= (select min(year_month) from date_stage)\r\n and cal.year_month <= (select max(year_month) from date_stage))\r\n \r\n)\r\n\r\nselect\r\n cast(all_date.year_month as {{ dbt.type_int() }} ) as year_month\r\n , member_months.distinct_count as member_months\r\n , claim_start.distinct_count as claim_start_date\r\n , claim_end.distinct_count as claim_end_date\r\n , admission_date.distinct_count as admission_date\r\n , discharge_date.distinct_count as discharge_date\r\n , med_paid_date.distinct_count as medical_paid_date\r\n , dispensing_date.distinct_count as dispensing_date\r\n , pharm_paid_date.distinct_count as pharmacy_paid_date\r\nfrom all_date_range all_date\r\nleft join date_stage member_months\r\n on all_date.year_month = member_months.year_month\r\n and member_months.date_field = 'member_months'\r\nleft join date_stage claim_start\r\n on all_date.year_month = claim_start.year_month\r\n and claim_start.date_field = 'claim_start_date'\r\nleft join date_stage claim_end\r\n on all_date.year_month = claim_end.year_month\r\n and claim_end.date_field = 'claim_end_date'\r\nleft join date_stage admission_date\r\n on all_date.year_month = admission_date.year_month\r\n and admission_date.date_field = 'admission_date'\r\nleft join date_stage discharge_date\r\n on all_date.year_month = discharge_date.year_month\r\n and discharge_date.date_field = 'discharge_date'\r\nleft join date_stage med_paid_date\r\n on all_date.year_month = med_paid_date.year_month\r\n and med_paid_date.date_field = 'medical paid_date'\r\nleft join date_stage dispensing_date\r\n on all_date.year_month = dispensing_date.year_month\r\n and dispensing_date.date_field = 'dispensing_date'\r\nleft join date_stage pharm_paid_date\r\n on all_date.year_month = pharm_paid_date.year_month\r\n and pharm_paid_date.date_field = 'pharmacy paid_date'", "language": "sql", "refs": [["core__medical_claim"], ["core__medical_claim"], ["core__medical_claim"], ["core__medical_claim"], ["core__medical_claim"], ["core__pharmacy_claim"], ["core__pharmacy_claim"], ["financial_pmpm__member_months"], ["terminology__calendar"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.financial_pmpm__member_months", "seed.the_tuva_project.terminology__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__count_claim_by_date_column.sql", "compiled": true, "compiled_code": "\n\nwith date_stage as(\n\n select\n 'claim_start_date' as date_field\n , cast(date_part('year', claim_start_date) as TEXT) || right('0'||cast(date_part('month', claim_start_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from dev_sarah.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'claim_end_date' as date_field\n , cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from dev_sarah.core.medical_claim\n group by \n year_month\n union all\n\n select\n 'admission_date' as date_field\n , cast(date_part('year', admission_date) as TEXT) || right('0'||cast(date_part('month', admission_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from dev_sarah.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'discharge_date' as date_field\n , cast(date_part('year', discharge_date) as TEXT) || right('0'||cast(date_part('month', discharge_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from dev_sarah.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'medical paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) || right('0'||cast(date_part('month', paid_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from dev_sarah.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'dispensing_date' as date_field\n , cast(date_part('year', dispensing_date) as TEXT) || right('0'||cast(date_part('month', dispensing_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from dev_sarah.core.pharmacy_claim\n group by \n year_month\n\n union all\n\n select\n 'pharmacy paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) || right('0'||cast(date_part('month', paid_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from dev_sarah.core.pharmacy_claim\n group by \n year_month\n\n union all \n\n select\n 'member_months' as date_field\n , year_month\n , count(*) as distinct_count\n from dev_sarah.financial_pmpm.member_months\n group by\n year_month\n)\n\n\n, all_date_range as (\n select distinct \n replace(cal.year_month,'-','') as year_month\n from dev_sarah.terminology.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 INT ) as year_month\n , member_months.distinct_count as member_months\n , claim_start.distinct_count as claim_start_date\n , claim_end.distinct_count as claim_end_date\n , admission_date.distinct_count as admission_date\n , discharge_date.distinct_count as discharge_date\n , med_paid_date.distinct_count as medical_paid_date\n , dispensing_date.distinct_count as dispensing_date\n , pharm_paid_date.distinct_count as pharmacy_paid_date\nfrom all_date_range all_date\nleft join date_stage member_months\n on all_date.year_month = member_months.year_month\n and member_months.date_field = 'member_months'\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": []}, "model.the_tuva_project.insights__trend_sum_amount_by_service_category": {"database": "dev_sarah", "schema": "insights", "name": "insights__trend_sum_amount_by_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__trend_sum_amount_by_service_category.sql", "original_file_path": "models/insights/final/insights__trend_sum_amount_by_service_category.sql", "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_service_category", "fqn": ["the_tuva_project", "insights", "final", "insights__trend_sum_amount_by_service_category"], "alias": "trend_sum_amount_by_service_category", "checksum": {"name": "sha256", "checksum": "d1729b1b296fed0f471e170e1314fafbdbcacbab452faed47fb0731e2fc5f1e8"}, "config": {"enabled": true, "alias": "trend_sum_amount_by_service_category", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_paid_amount_change", "description": "Change in paid_amount from the previous month."}, {"name": "total_paid_amount_percent_change", "description": "Percent change in paid_amount from the previous month."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_allowed_amount_change", "description": "Change in allowed_amount from the previous month."}, {"name": "total_allowed_amount_percent_change", "description": "Percent change in allowed_amount from the previous month."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}, {"name": "total_charge_amount_change", "description": "Change in charge_amount from the previous month."}, {"name": "total_charge_amount_percent_change", "description": "Percent change in charge_amount from the previous month."}], "post-hook": [], "pre-hook": []}, "tags": ["insights"], "description": "Monthly trend of paid_amount, alllowed_amount, and charge_amount by service category", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "trend_sum_amount_by_service_category", "tags": ["insights"], "materialized": "table", "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_paid_amount_change", "description": "Change in paid_amount from the previous month."}, {"name": "total_paid_amount_percent_change", "description": "Percent change in paid_amount from the previous month."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_allowed_amount_change", "description": "Change in allowed_amount from the previous month."}, {"name": "total_allowed_amount_percent_change", "description": "Percent change in allowed_amount from the previous month."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}, {"name": "total_charge_amount_change", "description": "Change in charge_amount from the previous month."}, {"name": "total_charge_amount_percent_change", "description": "Percent change in charge_amount from the previous month."}], "enabled": true, "bind": false}, "created_at": 1708545506.115482, "relation_name": "dev_sarah.insights.trend_sum_amount_by_service_category", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith trend_by_service_category_1 as(\r\n select\r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , 'service_category_1' as service_category_type\r\n , service_category_1 as service_category\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , service_category_1\r\n)\r\n, trend_by_service_category_2 as(\r\n select\r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , 'service_category_2' as service_category_type\r\n , service_category_2 as service_category\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , service_category_2\r\n)\r\n, trend_with_previous_service_category_1_sum as(\r\n select \r\n year_month\r\n , service_category_type\r\n , service_category\r\n , total_paid_amount\r\n , lag(total_paid_amount) over (partition by service_category order by year_month) as previous_total_paid_amount\r\n , total_allowed_amount\r\n , lag(total_allowed_amount) over (partition by service_category order by year_month) as previous_total_allowed_amount\r\n , total_charge_amount\r\n , lag(total_charge_amount) over (partition by service_category order by year_month) as previous_total_charge_amount\r\n from trend_by_service_category_1\r\n)\r\n, trend_with_previous_service_category_2_sum as(\r\n select \r\n year_month\r\n , service_category_type\r\n , service_category\r\n , total_paid_amount\r\n , lag(total_paid_amount) over (partition by service_category order by year_month) as previous_total_paid_amount\r\n , total_allowed_amount\r\n , lag(total_allowed_amount) over (partition by service_category order by year_month) as previous_total_allowed_amount\r\n , total_charge_amount\r\n , lag(total_charge_amount) over (partition by service_category order by year_month) as previous_total_charge_amount\r\n from trend_by_service_category_2\r\n)\r\nselect\r\n year_month\r\n , service_category_type\r\n , service_category\r\n , total_paid_amount\r\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\r\n , case \r\n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\r\n else total_paid_amount\r\n end as total_paid_amount_percent_change\r\n , total_allowed_amount\r\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\r\n , case \r\n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\r\n else total_allowed_amount\r\n end as total_allowed_amount_percent_change\r\n , total_charge_amount\r\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\r\n , case \r\n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\r\n else total_charge_amount\r\n end as total_charge_amount_percent_change\r\nfrom trend_with_previous_service_category_1_sum\r\n\r\nunion all \r\n\r\nselect\r\n year_month\r\n , service_category_type\r\n , service_category\r\n , total_paid_amount\r\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\r\n , case \r\n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\r\n else total_paid_amount\r\n end as total_paid_amount_percent_change\r\n , total_allowed_amount\r\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\r\n , case \r\n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\r\n else total_allowed_amount\r\n end as total_allowed_amount_percent_change\r\n , total_charge_amount\r\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\r\n , case \r\n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\r\n else total_charge_amount\r\n end as total_charge_amount_percent_change\r\nfrom trend_with_previous_service_category_2_sum", "language": "sql", "refs": [["core__medical_claim"], ["core__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__trend_sum_amount_by_service_category.sql", "compiled": true, "compiled_code": "\n\n\nwith trend_by_service_category_1 as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , 'service_category_1' as service_category_type\n , service_category_1 as service_category\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 from dev_sarah.core.medical_claim\n group by \n year_month\n , service_category_1\n)\n, trend_by_service_category_2 as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , 'service_category_2' as service_category_type\n , service_category_2 as service_category\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 from dev_sarah.core.medical_claim\n group by \n year_month\n , service_category_2\n)\n, trend_with_previous_service_category_1_sum as(\n select \n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , lag(total_paid_amount) over (partition by service_category order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by service_category order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by service_category order by year_month) as previous_total_charge_amount\n from trend_by_service_category_1\n)\n, trend_with_previous_service_category_2_sum as(\n select \n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , lag(total_paid_amount) over (partition by service_category order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by service_category order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by service_category order by year_month) as previous_total_charge_amount\n from trend_by_service_category_2\n)\nselect\n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_service_category_1_sum\n\nunion all \n\nselect\n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_service_category_2_sum", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.insights__sum_amount_by_claim_type": {"database": "dev_sarah", "schema": "insights", "name": "insights__sum_amount_by_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__sum_amount_by_claim_type.sql", "original_file_path": "models/insights/final/insights__sum_amount_by_claim_type.sql", "unique_id": "model.the_tuva_project.insights__sum_amount_by_claim_type", "fqn": ["the_tuva_project", "insights", "final", "insights__sum_amount_by_claim_type"], "alias": "sum_amount_by_claim_type", "checksum": {"name": "sha256", "checksum": "1850231cfaf383fe60720e0636c24cd3a351e593aa2956e28565c008303a171d"}, "config": {"enabled": true, "alias": "sum_amount_by_claim_type", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "columns": [{"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}], "post-hook": [], "pre-hook": []}, "tags": ["insights"], "description": "Sum of paid_amount, allowed_amount, and charge_amount by claim type", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "sum_amount_by_claim_type", "tags": ["insights"], "materialized": "table", "columns": [{"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, vision, or pharmacy."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}], "enabled": true, "bind": false}, "created_at": 1708545506.089403, "relation_name": "dev_sarah.insights.sum_amount_by_claim_type", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect \r\n claim_type\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by claim_type\r\n\r\nunion all\r\n\r\nselect \r\n 'pharmacy'\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , null as total_charge_amount\r\nfrom {{ ref('core__pharmacy_claim') }}", "language": "sql", "refs": [["core__medical_claim"], ["core__pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__sum_amount_by_claim_type.sql", "compiled": true, "compiled_code": "\n\nselect \n claim_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\nfrom dev_sarah.core.medical_claim\ngroup by claim_type\n\nunion all\n\nselect \n 'pharmacy'\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , null as total_charge_amount\nfrom dev_sarah.core.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.insights__sum_amount_by_service_category": {"database": "dev_sarah", "schema": "insights", "name": "insights__sum_amount_by_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__sum_amount_by_service_category.sql", "original_file_path": "models/insights/final/insights__sum_amount_by_service_category.sql", "unique_id": "model.the_tuva_project.insights__sum_amount_by_service_category", "fqn": ["the_tuva_project", "insights", "final", "insights__sum_amount_by_service_category"], "alias": "sum_amount_by_service_category", "checksum": {"name": "sha256", "checksum": "d6b11197aed8609cfdb1117b04d8c31dabdd622025616b92b2d82264f9436cf8"}, "config": {"enabled": true, "alias": "sum_amount_by_service_category", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "columns": [{"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}], "post-hook": [], "pre-hook": []}, "tags": ["insights"], "description": "Sum of paid_amount, allowed_amount, and charge_amount by service category", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "sum_amount_by_service_category", "tags": ["insights"], "materialized": "table", "columns": [{"name": "service_category_type", "description": "The broader service category a claim belongs to."}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "total_paid_amount", "description": "Sum of paid_amount."}, {"name": "total_allowed_amount", "description": "Sum of allowed_amount."}, {"name": "total_charge_amount", "description": "Sum of charge_amount."}], "enabled": true, "bind": false}, "created_at": 1708545506.0938082, "relation_name": "dev_sarah.insights.sum_amount_by_service_category", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect\r\n 'service_category_1' as service_category_type\r\n , service_category_1\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by service_category_1\r\n\r\nunion all\r\n\r\nselect\r\n 'service_category_2' as service_category_type\r\n , service_category_2\r\n , sum(paid_amount) as total_paid_amount\r\n , sum(allowed_amount) as total_allowed_amount\r\n , sum(charge_amount) as total_charge_amount\r\nfrom {{ ref('core__medical_claim') }}\r\ngroup by service_category_2", "language": "sql", "refs": [["core__medical_claim"], ["core__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__sum_amount_by_service_category.sql", "compiled": true, "compiled_code": "\n\nselect\n 'service_category_1' as service_category_type\n , service_category_1\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\nfrom dev_sarah.core.medical_claim\ngroup by service_category_1\n\nunion all\n\nselect\n 'service_category_2' as service_category_type\n , service_category_2\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\nfrom dev_sarah.core.medical_claim\ngroup by service_category_2", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.insights__trend_count_claim_by_service_category": {"database": "dev_sarah", "schema": "insights", "name": "insights__trend_count_claim_by_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "insights/final/insights__trend_count_claim_by_service_category.sql", "original_file_path": "models/insights/final/insights__trend_count_claim_by_service_category.sql", "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_service_category", "fqn": ["the_tuva_project", "insights", "final", "insights__trend_count_claim_by_service_category"], "alias": "trend_count_claim_by_service_category", "checksum": {"name": "sha256", "checksum": "f3ca33dfdd8f451c8c44b16b2b2037d08430e93eb153e92965b8593be400562e"}, "config": {"enabled": true, "alias": "trend_count_claim_by_service_category", "schema": "insights", "database": null, "tags": ["insights"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}, {"name": "distinct_claim_count_change", "description": "Change in distinct claim count from the previous year month."}, {"name": "distinct_claim_percentage_change", "description": "Percent in distinct claim count change from the previous year month."}], "post-hook": [], "pre-hook": []}, "tags": ["insights"], "description": "Monthly trend of distinct claims by service category", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/insights/insights_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "insights", "alias": "trend_count_claim_by_service_category", "tags": ["insights"], "materialized": "table", "columns": [{"name": "year_month", "description": "Year and month of the claim end date"}, {"name": "service_category", "description": "The more specific service category a claim belongs to."}, {"name": "distinct_claim_count", "description": "Count of distinct claims."}, {"name": "distinct_claim_count_change", "description": "Change in distinct claim count from the previous year month."}, {"name": "distinct_claim_percentage_change", "description": "Percent in distinct claim count change from the previous year month."}], "enabled": true, "bind": false}, "created_at": 1708545506.103429, "relation_name": "dev_sarah.insights.trend_count_claim_by_service_category", "raw_code": "{{ config(\r\n enabled = var('insights_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith trend_by_service_category_1 as (\r\n select \r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , service_category_1\r\n , count(distinct claim_id) as distinct_claim_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , service_category_1\r\n)\r\n, trend_by_service_category_2 as (\r\n select \r\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) || right('0'||cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}),2) as year_month\r\n , service_category_2\r\n , count(distinct claim_id) as distinct_claim_count\r\n from {{ ref('core__medical_claim') }}\r\n group by \r\n year_month\r\n , service_category_2\r\n)\r\n, previous_service_category_1_claim_count as(\r\n select\r\n year_month\r\n , service_category_1\r\n , distinct_claim_count\r\n , lag(distinct_claim_count) over (partition by service_category_1 order by year_month) as previous_distinct_claim_count\r\n from trend_by_service_category_1\r\n)\r\n, previous_service_category_2_claim_count as(\r\n select\r\n year_month\r\n , service_category_2\r\n , distinct_claim_count\r\n , lag(distinct_claim_count) over (partition by service_category_2 order by year_month) as previous_distinct_claim_count\r\n from trend_by_service_category_2\r\n)\r\nselect \r\n year_month\r\n , service_category_1 as service_category\r\n , distinct_claim_count\r\n , distinct_claim_count-previous_distinct_claim_count as distinct_claim_count_change\r\n , case\r\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \r\n else distinct_claim_count\r\n end as distinct_claim_percentage_change\r\nfrom previous_service_category_1_claim_count\r\n\r\n union all\r\n\r\n select \r\n year_month\r\n , service_category_2 as service_category\r\n , distinct_claim_count\r\n , distinct_claim_count-previous_distinct_claim_count as distinct_claim_count_change\r\n , case\r\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \r\n else distinct_claim_count\r\n end as distinct_claim_percentage_change\r\nfrom previous_service_category_2_claim_count", "language": "sql", "refs": [["core__medical_claim"], ["core__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/insights/final/insights__trend_count_claim_by_service_category.sql", "compiled": true, "compiled_code": "\n\nwith trend_by_service_category_1 as (\n select \n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , service_category_1\n , count(distinct claim_id) as distinct_claim_count\n from dev_sarah.core.medical_claim\n group by \n year_month\n , service_category_1\n)\n, trend_by_service_category_2 as (\n select \n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , service_category_2\n , count(distinct claim_id) as distinct_claim_count\n from dev_sarah.core.medical_claim\n group by \n year_month\n , service_category_2\n)\n, previous_service_category_1_claim_count as(\n select\n year_month\n , service_category_1\n , distinct_claim_count\n , lag(distinct_claim_count) over (partition by service_category_1 order by year_month) as previous_distinct_claim_count\n from trend_by_service_category_1\n)\n, previous_service_category_2_claim_count as(\n select\n year_month\n , service_category_2\n , distinct_claim_count\n , lag(distinct_claim_count) over (partition by service_category_2 order by year_month) as previous_distinct_claim_count\n from trend_by_service_category_2\n)\nselect \n year_month\n , service_category_1 as service_category\n , distinct_claim_count\n , distinct_claim_count-previous_distinct_claim_count as distinct_claim_count_change\n , case\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \n else distinct_claim_count\n end as distinct_claim_percentage_change\nfrom previous_service_category_1_claim_count\n\n union all\n\n select \n year_month\n , service_category_2 as service_category\n , distinct_claim_count\n , distinct_claim_count-previous_distinct_claim_count as distinct_claim_count_change\n , case\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \n else distinct_claim_count\n end as distinct_claim_percentage_change\nfrom previous_service_category_2_claim_count", "extra_ctes_injected": true, "extra_ctes": []}, "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": "b72d0e88228249d91b1328118b4ce4e220ac01b0353414201f3c1a442be9b322"}, "config": {"enabled": true, "alias": null, "schema": "claims_expanded", "database": null, "tags": ["claims_expanded"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["claims_expanded"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.117692, "relation_name": "dev_sarah.claims_expanded.medical_claim_expanded", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n )\n}}\n\n\nselect *\nfrom {{ ref('medical_claim') }}", "language": "sql", "refs": [["medical_claim"]], "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": []}, "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": "63d30839cde4948c5913c472938d34b9d647c11fb6042c2c3072c8026f919a09"}, "config": {"enabled": true, "alias": "_stg_claims_encounter", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_claims"], "description": "Staging core claims encounters", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.22262, "relation_name": "dev_sarah.core._stg_claims_encounter", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the encounter table in core.\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('acute inpatient' as {{ dbt.type_string() }} ) as encounter_type\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(facility_npi as {{ dbt.type_string() }} ) as facility_npi\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(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('acute_inpatient__summary') }} \n\nunion all \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('emergency department' as {{ dbt.type_string() }} ) as encounter_type\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(facility_npi as {{ dbt.type_string() }} ) as facility_npi\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(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('emergency_department__summary') }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_summary"], ["acute_inpatient__summary"], ["emergency_department__summary"]], "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.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.emergency_department__summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_encounter.sql", "compiled": true, "compiled_code": "-- depends_on: dev_sarah.data_quality.claims_preprocessing_summary\n\n\n\n-- *************************************************\n-- This dbt model creates the encounter table in core.\n-- *************************************************\n\nselect\n cast(encounter_id as TEXT ) as encounter_id\n , cast(patient_id as TEXT ) as patient_id\n , cast('acute inpatient' as TEXT ) as encounter_type\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 INT ) 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(facility_npi as TEXT ) as facility_npi\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(data_source as TEXT ) as data_source\n , cast('2024-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom dev_sarah.claims_preprocessing.acute_inpatient_summary \n\nunion all \n\nselect\n cast(encounter_id as TEXT ) as encounter_id\n , cast(patient_id as TEXT ) as patient_id\n , cast('emergency department' as TEXT ) as encounter_type\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 INT ) 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(facility_npi as TEXT ) as facility_npi\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(data_source as TEXT ) as data_source\n , cast('2024-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom dev_sarah.claims_preprocessing.emergency_department_summary", "extra_ctes_injected": true, "extra_ctes": []}, "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": "d3889d8a95c2317831b0269c43788072e3e59a2c3c45d2ea457dcd50a56519c6"}, "config": {"enabled": true, "alias": "_stg_clinical_condition", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_clinical"], "description": "Staging core clinical conditions", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.2415, "relation_name": "dev_sarah.core._stg_clinical_condition", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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": [["condition"]], "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 INT ) 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-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom tuva.input_layer.condition", "extra_ctes_injected": true, "extra_ctes": []}, "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": "fe4f3fda4e8237056403ca4baf3602cb28c24f6249f6138ff1caad278ab8f0fb"}, "config": {"enabled": true, "alias": "_stg_claims_location", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_claims"], "description": "Staging core claims locations", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.22465, "relation_name": "dev_sarah.core._stg_claims_location", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\r\n\r\n{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\nwith all_providers_in_claims_dataset as (\r\nselect distinct facility_npi as npi, data_source\r\nfrom {{ ref('core__stg_claims_medical_claim') }}\r\n\r\nunion all\r\n\r\nselect distinct rendering_npi as npi, data_source\r\nfrom {{ ref('core__stg_claims_medical_claim') }}\r\n\r\nunion all\r\n\r\nselect distinct billing_npi as npi, data_source\r\nfrom {{ ref('core__stg_claims_medical_claim') }}\r\n),\r\n\r\n\r\nprovider as (\r\nselect aa.*, bb.data_source\r\nfrom {{ ref('terminology__provider') }} aa\r\ninner join all_providers_in_claims_dataset bb\r\non aa.npi = bb.npi\r\nwhere lower(aa.entity_type_description) = 'organization'\r\n)\r\n\r\n\r\n\r\nselect \r\n cast(npi as {{ dbt.type_string() }} ) as location_id\r\n , cast(npi as {{ dbt.type_string() }} ) as npi\r\n , cast(provider_organization_name as {{ dbt.type_string() }} ) as name\r\n , cast(null as {{ dbt.type_string() }} ) as facility_type\r\n , cast(parent_organization_name as {{ dbt.type_string() }} ) as parent_organization\r\n , cast(practice_address_line_1 as {{ dbt.type_string() }} ) as address\r\n , cast(practice_city as {{ dbt.type_string() }} ) as city\r\n , cast(practice_state as {{ dbt.type_string() }} ) as state\r\n , cast(practice_zip_code as {{ dbt.type_string() }} ) as zip_code\r\n , cast(null as {{ dbt.type_float() }} ) as latitude\r\n , cast(null 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 provider", "language": "sql", "refs": [["data_quality__claims_preprocessing_summary"], ["core__stg_claims_medical_claim"], ["core__stg_claims_medical_claim"], ["core__stg_claims_medical_claim"], ["terminology__provider"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_medical_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": "-- depends_on: dev_sarah.data_quality.claims_preprocessing_summary\n\n\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_npi as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct rendering_npi as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct billing_npi as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_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-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom provider", "extra_ctes_injected": true, "extra_ctes": []}, "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": "2d40e2e65c8797c64fa7862ae1b244334c1b9b78fa48a292a177c866753bb455"}, "config": {"enabled": true, "alias": "_stg_claims_practitioner", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_claims"], "description": "Staging core providers in the claims dataset", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.239316, "relation_name": "dev_sarah.core._stg_claims_practitioner", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\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_npi as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\nunion all\n\nselect distinct rendering_npi as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\nunion all\n\nselect distinct billing_npi as npi, data_source\nfrom {{ ref('core__stg_claims_medical_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": [["data_quality__claims_preprocessing_summary"], ["core__stg_claims_medical_claim"], ["core__stg_claims_medical_claim"], ["core__stg_claims_medical_claim"], ["terminology__provider"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_medical_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": "-- depends_on: dev_sarah.data_quality.claims_preprocessing_summary\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_npi as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct rendering_npi as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct billing_npi as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_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-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom provider", "extra_ctes_injected": true, "extra_ctes": []}, "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": "0f1a9157c557db6aae2dcadc439e6486a8ca0e94d35f9b508366d7b36c91790b"}, "config": {"enabled": true, "alias": "_stg_claims_eligibility", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_claims"], "description": "Staging core eligibility", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.236307, "relation_name": "dev_sarah.core._stg_claims_eligibility", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(member_id as {{ dbt.type_string() }} ) as member_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 , cast(plan as {{ dbt.type_string() }} ) as 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(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": [["data_quality__claims_preprocessing_summary"], ["normalized_input__eligibility"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "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": "-- depends_on: dev_sarah.data_quality.claims_preprocessing_summary\n\n\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_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 , cast(plan as TEXT ) as 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(data_source as TEXT ) as data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility", "extra_ctes_injected": true, "extra_ctes": []}, "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": "ce9df375e7438013d006dc6ce6e632e3a5b2d770d3889ccd057704587afe46c0"}, "config": {"enabled": true, "alias": "_stg_claims_medical_claim", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_claims"], "description": "Staging core medical claims", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.2205398, "relation_name": "dev_sarah.core._stg_claims_medical_claim", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\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\n\nselect\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(coalesce(ap.encounter_id,ed.encounter_id) as {{ dbt.type_string() }} ) as encounter_id \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 , cast(med.plan as {{ dbt.type_string() }} ) as 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(med.admit_source_code as {{ dbt.type_string() }} ) as admit_source_code\n , cast(med.admit_type_code as {{ dbt.type_string() }} ) as admit_type_code\n , cast(med.discharge_disposition_code as {{ dbt.type_string() }} ) as discharge_disposition_code\n , cast(med.place_of_service_code as {{ dbt.type_string() }} ) as place_of_service_code\n , cast(med.bill_type_code as {{ dbt.type_string() }} ) as bill_type_code\n , cast(med.ms_drg_code as {{ dbt.type_string() }} ) as ms_drg_code\n , cast(med.apr_drg_code as {{ dbt.type_string() }} ) as apr_drg_code\n , cast(med.revenue_center_code as {{ dbt.type_string() }} ) as revenue_center_code\n , cast(med.service_unit_quantity as {{ dbt.type_int() }} ) 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_npi as {{ dbt.type_string() }} ) as rendering_npi\n , cast(med.billing_npi as {{ dbt.type_string() }} ) as billing_npi\n , cast(med.facility_npi as {{ dbt.type_string() }} ) as facility_npi\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.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') }} med\nleft join {{ ref('service_category__service_category_grouper') }} srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\nleft join {{ ref('acute_inpatient__encounter_id') }} ap\n on med.claim_id = ap.claim_id\n and med.claim_line_number = ap.claim_line_number\nleft join {{ ref('emergency_department__int_encounter_id') }} ed\n on med.claim_id = ed.claim_id\n and med.claim_line_number = ed.claim_line_number", "language": "sql", "refs": [["data_quality__claims_preprocessing_summary"], ["normalized_input__medical_claim"], ["service_category__service_category_grouper"], ["acute_inpatient__encounter_id"], ["emergency_department__int_encounter_id"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_numeric", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.emergency_department__int_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_medical_claim.sql", "compiled": true, "compiled_code": "-- depends_on: dev_sarah.data_quality.claims_preprocessing_summary\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\n\nselect\n cast(med.claim_id as TEXT ) as claim_id\n , cast(med.claim_line_number as INT ) as claim_line_number\n , cast(coalesce(ap.encounter_id,ed.encounter_id) as TEXT ) as encounter_id \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 , cast(med.plan as TEXT ) as 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(med.admit_source_code as TEXT ) as admit_source_code\n , cast(med.admit_type_code as TEXT ) as admit_type_code\n , cast(med.discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(med.place_of_service_code as TEXT ) as place_of_service_code\n , cast(med.bill_type_code as TEXT ) as bill_type_code\n , cast(med.ms_drg_code as TEXT ) as ms_drg_code\n , cast(med.apr_drg_code as TEXT ) as apr_drg_code\n , cast(med.revenue_center_code as TEXT ) as revenue_center_code\n , cast(med.service_unit_quantity as INT ) 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_npi as TEXT ) as rendering_npi\n , cast(med.billing_npi as TEXT ) as billing_npi\n , cast(med.facility_npi as TEXT ) as facility_npi\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.data_source as TEXT ) as data_source\n , cast('2024-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim med\nleft join dev_sarah.claims_preprocessing.service_category_grouper srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\nleft join dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_id ap\n on med.claim_id = ap.claim_id\n and med.claim_line_number = ap.claim_line_number\nleft join dev_sarah.claims_preprocessing._int_emergency_department_encounter_id ed\n on med.claim_id = ed.claim_id\n and med.claim_line_number = ed.claim_line_number", "extra_ctes_injected": true, "extra_ctes": []}, "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": "2f3ce7d3b20e2b449909d12d98c0c93c7d2556a275fa10bf5b4dd4baf8236512"}, "config": {"enabled": true, "alias": "_stg_claims_procedure", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_claims"], "description": "Staging core claims procedures", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.231315, "relation_name": "dev_sarah.core._stg_claims_procedure", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\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 , 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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 \nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 \nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 cast(\n unpivot_cte.data_source\n ||'_'\n ||unpivot_cte.claim_id\n ||'_'\n ||unpivot_cte.source_code\n ||case when unpivot_cte.modifier_1 is not null then '_'||unpivot_cte.modifier_1 else '' end\n ||case when unpivot_cte.modifier_2 is not null then '_'||unpivot_cte.modifier_2 else '' end\n ||case when unpivot_cte.modifier_3 is not null then '_'||unpivot_cte.modifier_3 else '' end\n ||case when unpivot_cte.modifier_4 is not null then '_'||unpivot_cte.modifier_4 else '' end\n ||case when unpivot_cte.modifier_5 is not null then '_'||unpivot_cte.modifier_5 else '' end\n ||case when unpivot_cte.practitioner_npi is not null then '_'||unpivot_cte.practitioner_npi else '' end\n as {{ dbt.type_string() }} ) as procedure_id\n , cast(unpivot_cte.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(coalesce(ap.encounter_id, ed.encounter_id) as {{ dbt.type_string() }} ) as encounter_id\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\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\nleft join {{ ref('acute_inpatient__encounter_id')}} as ap\n on unpivot_cte.claim_id = ap.claim_id\nleft join {{ ref('emergency_department__int_encounter_id')}} as ed\n on unpivot_cte.claim_id = ed.claim_id", "language": "sql", "refs": [["data_quality__claims_preprocessing_summary"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["terminology__icd_10_pcs"], ["terminology__hcpcs_level_2"], ["acute_inpatient__encounter_id"], ["emergency_department__int_encounter_id"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__hcpcs_level_2", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.emergency_department__int_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_procedure.sql", "compiled": true, "compiled_code": "-- depends_on: dev_sarah.data_quality.claims_preprocessing_summary\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 , 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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 \nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 \nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 cast(\n unpivot_cte.data_source\n ||'_'\n ||unpivot_cte.claim_id\n ||'_'\n ||unpivot_cte.source_code\n ||case when unpivot_cte.modifier_1 is not null then '_'||unpivot_cte.modifier_1 else '' end\n ||case when unpivot_cte.modifier_2 is not null then '_'||unpivot_cte.modifier_2 else '' end\n ||case when unpivot_cte.modifier_3 is not null then '_'||unpivot_cte.modifier_3 else '' end\n ||case when unpivot_cte.modifier_4 is not null then '_'||unpivot_cte.modifier_4 else '' end\n ||case when unpivot_cte.modifier_5 is not null then '_'||unpivot_cte.modifier_5 else '' end\n ||case when unpivot_cte.practitioner_npi is not null then '_'||unpivot_cte.practitioner_npi else '' end\n as TEXT ) as procedure_id\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(coalesce(ap.encounter_id, ed.encounter_id) as TEXT ) as encounter_id\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-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom unpivot_cte\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\nleft join dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_id as ap\n on unpivot_cte.claim_id = ap.claim_id\nleft join dev_sarah.claims_preprocessing._int_emergency_department_encounter_id as ed\n on unpivot_cte.claim_id = ed.claim_id", "extra_ctes_injected": true, "extra_ctes": []}, "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": "3daa12aef291b5031181cfcb88268f82029fd207206c85657d8cd0d4f3bf7b09"}, "config": {"enabled": true, "alias": "_stg_clinical_patient", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_clinical"], "description": "Staging core clinical patients", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.256641, "relation_name": "dev_sarah.core._stg_clinical_patient", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\n )\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(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(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('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\n\nfrom {{ ref('patient') }}", "language": "sql", "refs": [["patient"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "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\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 INT ) as death_flag\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('2024-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\n\nfrom tuva.input_layer.patient", "extra_ctes_injected": true, "extra_ctes": []}, "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": "9f332ea3f889dc17ca47d3668380056beb9958919f436791d2d345119ba919bf"}, "config": {"enabled": true, "alias": "_stg_clinical_procedure", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_clinical"], "description": "Staging core clinical procedures", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.2616792, "relation_name": "dev_sarah.core._stg_clinical_procedure", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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": [["procedure"]], "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-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom tuva.input_layer.procedure", "extra_ctes_injected": true, "extra_ctes": []}, "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": "842c9dbc9adb69aabc5f4e69b627ad03506e01105ee084250a1c1451fbdee7ee"}, "config": {"enabled": true, "alias": "_stg_clinical_encounter", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_clinical"], "description": "Staging core clinical encounters", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.2441118, "relation_name": "dev_sarah.core._stg_clinical_encounter", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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 , {{ 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(facility_npi as {{ dbt.type_string() }} ) as facility_npi\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(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": [["encounter"]], "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 , 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 INT ) 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(facility_npi as TEXT ) as facility_npi\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(data_source as TEXT ) as data_source\n , cast('2024-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom tuva.input_layer.encounter", "extra_ctes_injected": true, "extra_ctes": []}, "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": "3534e17215e27b1fd8d009a8fd5a2f88343046667b640afb9e4fbb068db9e60b"}, "config": {"enabled": true, "alias": "_stg_clinical_medication", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_clinical"], "description": "Staging core clinical medications", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.251647, "relation_name": "dev_sarah.core._stg_clinical_medication", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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": [["medication"]], "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 INT ) as quantity\n , cast(quantity_unit as TEXT ) as quantity_unit\n , cast(days_supply as INT ) as days_supply\n , cast(practitioner_id as TEXT ) as practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom tuva.input_layer.medication", "extra_ctes_injected": true, "extra_ctes": []}, "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": "29743c49b66dc785a364b00fcd57c5793749851c2c030ac9c038cdcc1801a871"}, "config": {"enabled": true, "alias": "_stg_claims_condition", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_claims"], "description": "Staging core claims conditions", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.2288342, "relation_name": "dev_sarah.core._stg_claims_condition", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 cast(unpivot_cte.data_source||'_'||unpivot_cte.claim_id||'_'||unpivot_cte.diagnosis_rank||'_'||unpivot_cte.source_code as {{ dbt.type_string() }} ) as condition_id\n , cast(unpivot_cte.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(coalesce(ap.encounter_id, ed.encounter_id) as {{ dbt.type_string() }} ) as encounter_id\n , cast(unpivot_cte.claim_id as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('unpivot_cte.condition_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.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\nleft join {{ ref('acute_inpatient__encounter_id')}} as ap\n on unpivot_cte.claim_id = ap.claim_id\nleft join {{ ref('emergency_department__int_encounter_id')}} as ed\n on unpivot_cte.claim_id = ed.claim_id\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": [["data_quality__claims_preprocessing_summary"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["acute_inpatient__encounter_id"], ["emergency_department__int_encounter_id"], ["terminology__icd_10_cm"], ["terminology__present_on_admission"]], "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.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.emergency_department__int_encounter_id", "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": "-- depends_on: dev_sarah.data_quality.claims_preprocessing_summary\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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 cast(unpivot_cte.data_source||'_'||unpivot_cte.claim_id||'_'||unpivot_cte.diagnosis_rank||'_'||unpivot_cte.source_code as TEXT ) as condition_id\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(coalesce(ap.encounter_id, ed.encounter_id) as TEXT ) as encounter_id\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.condition_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.description as TEXT ) as normalized_description\n , cast(unpivot_cte.diagnosis_rank as INT ) 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-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom unpivot_cte\nleft join dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_id as ap\n on unpivot_cte.claim_id = ap.claim_id\nleft join dev_sarah.claims_preprocessing._int_emergency_department_encounter_id as ed\n on unpivot_cte.claim_id = ed.claim_id\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": []}, "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": "4861fe602fc9b4355ea3da9ae79829c4c4eb329b9423d304eadf2523c43b8937"}, "config": {"enabled": true, "alias": "_stg_clinical_lab_result", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_clinical"], "description": "Staging core clinical lab results", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.246418, "relation_name": "dev_sarah.core._stg_clinical_lab_result", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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_int() }} ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as {{ dbt.type_int() }} ) 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": [["lab_result"]], "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.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 INT ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as INT ) 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-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom tuva.input_layer.lab_result", "extra_ctes_injected": true, "extra_ctes": []}, "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": "e04f15cb36d85a844dd2b7fb431eedc8db9a6dfc6eb03e8fdbe604002558dfb1"}, "config": {"enabled": true, "alias": "_stg_clinical_practitioner", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_clinical"], "description": "Staging core clinical providers", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.2595131, "relation_name": "dev_sarah.core._stg_clinical_practitioner", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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": [["practitioner"]], "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-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom tuva.input_layer.practitioner", "extra_ctes_injected": true, "extra_ctes": []}, "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": "8418be15ac0dff620b48b750d2fcbb9cc68abbb72b2a7646798f772014088cfe"}, "config": {"enabled": true, "alias": "_stg_claims_pharmacy_claim", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_claims"], "description": "Staging core pharmacy claims", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.234102, "relation_name": "dev_sarah.core._stg_claims_pharmacy_claim", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n )\n}}\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 {{ 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 , cast(plan as {{ dbt.type_string() }} ) as plan\n , cast(prescribing_provider_npi as {{ dbt.type_string() }} ) as prescribing_provider_npi\n , cast(dispensing_provider_npi as {{ dbt.type_string() }} ) as dispensing_provider_npi\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as {{ dbt.type_string() }} ) as ndc_code\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(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(data_source as {{ dbt.type_string() }} ) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__pharmacy_claim') }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_summary"], ["normalized_input__pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "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": "-- depends_on: dev_sarah.data_quality.claims_preprocessing_summary\n\n\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 ) 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 , cast(plan as TEXT ) as plan\n , cast(prescribing_provider_npi as TEXT ) as prescribing_provider_npi\n , cast(dispensing_provider_npi as TEXT ) as dispensing_provider_npi\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\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(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(data_source as TEXT ) as data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": []}, "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": "d174a7c1a6034db5bd81239712dd36ba2a7d8ddebeda83eca4c9d86f00c169b8"}, "config": {"enabled": true, "alias": "_stg_clinical_location", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_clinical"], "description": "Staging core clinical locations", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.248703, "relation_name": "dev_sarah.core._stg_clinical_location", "raw_code": "{{ config(\r\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\r\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": [["location"]], "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-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom tuva.input_layer.location", "extra_ctes_injected": true, "extra_ctes": []}, "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": "c2eb3398c5ed5656eb0cba09d8ae943cb379d282d337a838a72c5751866c5985"}, "config": {"enabled": true, "alias": "_stg_claims_patient", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_claims"], "description": "Staging core claims patients", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.226829, "relation_name": "dev_sarah.core._stg_claims_patient", "raw_code": "-- depends_on: {{ ref('data_quality__claims_preprocessing_summary') }}\n\n{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\n\n\n\nwith patient_stage as(\n select\n patient_id\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,first_name\n ,last_name\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 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(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('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }}) as tuva_last_run\nfrom patient_stage\nwhere row_sequence = 1", "language": "sql", "refs": [["data_quality__claims_preprocessing_summary"], ["normalized_input__eligibility"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "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": "-- depends_on: dev_sarah.data_quality.claims_preprocessing_summary\n\n\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\n\n\n\nwith patient_stage as(\n select\n patient_id\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,first_name\n ,last_name\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 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(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('2024-02-21 19:58:21.989699+00:00' as TIMESTAMP) as tuva_last_run\nfrom patient_stage\nwhere row_sequence = 1", "extra_ctes_injected": true, "extra_ctes": []}, "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": "b31467cd0c59b6991f06f89f122a3e668b8620f30634b202c27e21905f6e9173"}, "config": {"enabled": true, "alias": "_stg_clinical_observation", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core_stage_clinical"], "description": "Staging core clinical observations", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.254155, "relation_name": "dev_sarah.core._stg_clinical_observation", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\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": [["observation"]], "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-02-21 19:58:21.989699+00:00' as TIMESTAMP ) as tuva_last_run\nfrom tuva.input_layer.observation", "extra_ctes_injected": true, "extra_ctes": []}, "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": "d6e2bac51e9f18580249d402ed5ddc88c616d33d70781c4adf4dfd980499f836"}, "config": {"enabled": true, "alias": "pharmacy_claim", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core"], "description": "The pharmacy claim table contains information on prescription drugs that were filled and billed to the insurer.\n", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "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", "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer", "meta": {}, "data_type": null, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Number of doses.", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the prescription.", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date the claim was paid.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid by the health insurer for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "Contractual amount allowed to be paid by the payer + patient.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.2035708, "relation_name": "dev_sarah.core.pharmacy_claim", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\nselect * from {{ ref('core__stg_claims_pharmacy_claim')}}", "language": "sql", "refs": [["core__stg_claims_pharmacy_claim"]], "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": []}, "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": "6bf20ce96592d16fd9ab798870231dc2cb5fd32632e677db4eccf028738d1a4f"}, "config": {"enabled": true, "alias": "condition", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date when the condition was recorded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "onset_date": {"name": "onset_date", "description": "Date when the condition first occurred.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "resolved_date": {"name": "resolved_date", "description": "Date when the condition was resolved.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the condition.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition i.e. problem, admitting, or billing.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the condition code in the source system.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the condition code.", "meta": {}, "data_type": null, "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", "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.12529, "relation_name": "dev_sarah.core.condition", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\n )\r\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_condition') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_condition') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_condition') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_condition') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [["core__stg_claims_condition"], ["core__stg_clinical_condition"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_clinical_condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__condition.sql", "compiled": true, "compiled_code": "\n\n\nselect * from dev_sarah.core._stg_claims_condition\nunion all\nselect * from dev_sarah.core._stg_clinical_condition\n\n", "extra_ctes_injected": true, "extra_ctes": []}, "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": "b61f67fdabee3aa43bcbc17b1deb9f655a317e812c6571a11caf3f26b22e2ed8"}, "config": {"enabled": true, "alias": "patient", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "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 person across all datasets.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "The death date of the patient if there is one.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "A flag indicating if the patient has died.", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "The first name of the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "The last name of the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "The address of the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "city": {"name": "city", "description": "The city where the patient lives.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "state": {"name": "state", "description": "The state where the patient lives.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code for the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "county": {"name": "county", "description": "The county for the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude for the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude for the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone": {"name": "phone", "description": "The phone number for the patient.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.194725, "relation_name": "dev_sarah.core.patient", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\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": [["core__stg_claims_patient"], ["core__stg_clinical_patient"]], "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": []}, "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": "f9476ba4518a0bd40ed1de34b409cd2a90558632afa56fb482ab58b016ad4ab9"}, "config": {"enabled": true, "alias": "lab_result", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "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 the lab test.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "accession_number": {"name": "accession_number", "description": "The lab order number from the source system.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The description for the lab test from the source system.", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "The normalized description for the code.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the lab test.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the lab test.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "Date of the test result.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "collection_date": {"name": "collection_date", "description": "Date the test was collected.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "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, "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, "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, "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, "quote": null, "tags": []}, "source_abnormal_flag": {"name": "source_abnormal_flag", "description": "Indicates whether the result is abnormal or normal.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_abnormal_flag": {"name": "normalized_abnormal_flag", "description": "Normalized abnormal flag.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "specimen": {"name": "specimen", "description": "The type of specimen e.g. blood, plasma, urine.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.150657, "relation_name": "dev_sarah.core.lab_result", "raw_code": "{{ config(\r\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\nselect * from {{ ref('core__stg_clinical_lab_result')}}", "language": "sql", "refs": [["core__stg_clinical_lab_result"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__lab_result.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.core._stg_clinical_lab_result", "extra_ctes_injected": true, "extra_ctes": []}, "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": "2cf0a388e7ed3dbd677997974437d8ac82992cf599c035a9b3e6a66d2cfeb133"}, "config": {"enabled": true, "alias": "encounter", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core"], "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for a patient.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "attending_provider_id": {"name": "attending_provider_id", "description": "attending provider 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, "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI 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, "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, "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, "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid for the encounter by the insurer.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the encounter by the provider.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "encounter", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.141734, "relation_name": "dev_sarah.core.encounter", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n{% if var('clinical_enabled', false) == true and var('claims_enabled', false) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_encounter') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_encounter') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_encounter') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_encounter') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [["core__stg_clinical_encounter"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["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 * from dev_sarah.core._stg_clinical_encounter\n\n", "extra_ctes_injected": true, "extra_ctes": []}, "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": "6c4444c95ace83c2f6bc4f2e9dfc69bef360c3b0a01bea5e67b3da4761485111"}, "config": {"enabled": true, "alias": "eligibility", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core"], "description": "The eligibility table contains information on patient health plan and supplemental insurance eligibility.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "Date the patient was born.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "Date the patient died.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.131357, "relation_name": "dev_sarah.core.eligibility", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\n\r\nselect * from {{ ref('core__stg_claims_eligibility')}}", "language": "sql", "refs": [["core__stg_claims_eligibility"]], "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": []}, "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": "2ec212aa41f812304773bc51f2ae8bd67767d75b2fb2f29f79ad916c04ba83d2"}, "config": {"enabled": true, "alias": "procedure", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "The claim on which the procedure was recorded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each person across all datasets.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date": {"name": "procedure_date", "description": "Date when the procedure was performed.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the procedure code.", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.218019, "relation_name": "dev_sarah.core.procedure", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\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_procedure') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_procedure') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_procedure') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_procedure') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [["core__stg_claims_procedure"], ["core__stg_clinical_procedure"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_clinical_procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__procedure.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.core._stg_claims_procedure\nunion all\nselect * from dev_sarah.core._stg_clinical_procedure\n\n", "extra_ctes_injected": true, "extra_ctes": []}, "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": "b126bbc3a07a5f93f701d0199e8fde6ef13a7fd9ac7ad71619de948a8d49fdc1"}, "config": {"enabled": true, "alias": "medical_claim", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["core"], "description": "The medical claim table contains information on services rendered to patients 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, "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", "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer", "meta": {}, "data_type": null, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "Start date for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_line_start_date": {"name": "claim_line_start_date", "description": "Start date for the claim line.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_line_end_date": {"name": "claim_line_end_date", "description": "End date for the claim line.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "Admission date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Discharge date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "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, "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, "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", "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, "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, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "The date the claim was paid.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid on the claim by the insurer.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "The type of encounter this claim belongs to.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "The encounter_id for the encounter that this claims belongs to.\n", "meta": {}, "data_type": null, "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "medical_claim", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.173109, "relation_name": "dev_sarah.core.medical_claim", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\n\r\nselect * from {{ ref('core__stg_claims_medical_claim')}}", "language": "sql", "refs": [["core__stg_claims_medical_claim"]], "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": []}, "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": "c37dfb21d3e6de4641e1cb7413e8f44db8eab3f488ee294f7cec3f1e04518273"}, "config": {"enabled": true, "alias": "location", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "parent_organization": {"name": "parent_organization", "description": "The parent organization associated with the facility.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "The street address of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "city": {"name": "city", "description": "The city of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "state": {"name": "state", "description": "The state of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude of the location.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.156353, "relation_name": "dev_sarah.core.location", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\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": [["core__stg_claims_location"], ["core__stg_clinical_location"]], "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": []}, "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": "465c23d0e83d37bcd661cec2d9e6b14101d171d7dc5b1481e9ef8e0580998512"}, "config": {"enabled": true, "alias": "medication", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the medication was dispensed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "prescribing_date": {"name": "prescribing_date", "description": "Date the medication was prescribed.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The source description of the medication.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "Description for the NDC.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "rxnorm_description": {"name": "rxnorm_description", "description": "Description for the RxNorm code.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "atc_description": {"name": "atc_description", "description": "Description for the ATC code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "route": {"name": "route", "description": "The route used to administer the medication.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "strength": {"name": "strength", "description": "The strength of the medication.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "The quantity of the medication.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "quantity_unit": {"name": "quantity_unit", "description": "The units for the quantity.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "The number of days supply included.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.181671, "relation_name": "dev_sarah.core.medication", "raw_code": "{{ config(\r\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\n\r\nselect * from {{ ref('core__stg_clinical_medication')}}", "language": "sql", "refs": [["core__stg_clinical_medication"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__medication.sql", "compiled": true, "compiled_code": "\n\n\nselect * from dev_sarah.core._stg_clinical_medication", "extra_ctes_injected": true, "extra_ctes": []}, "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": "8e922586d391bb227ab514044d20f47f328a489ae785158adf2d12a7f1c84d4b"}, "config": {"enabled": true, "alias": "observation", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "panel_id": {"name": "panel_id", "description": "Unique identifier for the panel.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "Date the observation was recorded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "observation_type": {"name": "observation_type", "description": "Type of observation.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "Source code of the observation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Source description of the observation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "Normalized code type of the observation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "Normalized code of the observation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the observatino.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the observation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "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, "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, "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, "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, "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.187917, "relation_name": "dev_sarah.core.observation", "raw_code": "{{ config(\r\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\r\n )\r\n}}\r\n\r\n\r\nselect * from {{ ref('core__stg_clinical_observation')}}", "language": "sql", "refs": [["core__stg_clinical_observation"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__observation.sql", "compiled": true, "compiled_code": "\n\n\nselect * from dev_sarah.core._stg_clinical_observation", "extra_ctes_injected": true, "extra_ctes": []}, "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": "775c1a9019c7dad8bd26cdb669cfa8f56e61ced3adcb492b805165d42f20eacf"}, "config": {"enabled": true, "alias": "practitioner", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "First name of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "Last name of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "practice_affiliation": {"name": "practice_affiliation", "description": "Practice affiliation of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "specialty": {"name": "specialty", "description": "Specialty of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sub_specialty": {"name": "sub_specialty", "description": "Sub specialty of the provider.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "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": "#0f3d0b"}}, "created_at": 1708545506.208392, "relation_name": "dev_sarah.core.practitioner", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r\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": [["core__stg_claims_practitioner"], ["core__stg_clinical_practitioner"]], "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": []}, "model.the_tuva_project.data_quality__claims_preprocessing_use_case": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_use_case", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_use_case.sql", "original_file_path": "models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_use_case.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "final", "data_quality__claims_preprocessing_use_case"], "alias": "claims_preprocessing_use_case", "checksum": {"name": "sha256", "checksum": "48696a2c60c3f6cdd20585fae8aa2a8731937164cfa95438fea455f7a54af1d4"}, "config": {"enabled": true, "alias": "claims_preprocessing_use_case", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {"use_case": {"name": "use_case", "description": "The mart or logic that would be affected by test failures", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_table": {"name": "source_table", "description": "Table this use case is in reference to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "test_name": {"name": "test_name", "description": "Name of the test being performed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "failures": {"name": "failures", "description": "Number of failures of this test", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "denominator": {"name": "denominator", "description": "Total number of records analyzed for this test", "meta": {}, "data_type": "integer", "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claims_preprocessing_use_case", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.283401, "relation_name": "dev_sarah.data_quality.claims_preprocessing_use_case", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\nwith use_case_stage as(\n select\n 'encounters' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__medical_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all\n\n select \n 'service_grouper' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__medical_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'hcpcs_code missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'readmissions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__medical_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'pmpm' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__medical_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('patient_id missing'\n ,'claim_start_date missing'\n ,'claim_type invalid'\n ,'claim_type missing'\n\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'readmissions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__pharmacy_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('patient_id missing'\n ,'dispensing_date missing'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'paid_amount missing'\n )\n and source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'member_months' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct patient_id||data_source) from {{ ref('normalized_input__eligibility') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('patient_id missing'\n ,'enrollment_start_date missing'\n ,'enrollment_end_date invalid'\n ,'payer missing'\n ,'payer missing'\n ,'payer_type invalid'\n )\n and source_table = 'normalized_input__eligibility'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'chronic_conditions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__medical_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'claim_start_date missing'\n ,'claim_start_date invalid'\n ,'patient_id missing'\n ,'patient_id invalid'\n ,'diagnosis_code_type missing'\n ,'diagnosis_code_type invalid'\n ,'procedure_code_1 missing'\n ,'procedure_code_1 invalid'\n ,'procedure_code_type invalid'\n ,'procedure_code_type missing'\n /** encounter fields **/\n ,'diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'chronic_conditions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from {{ ref('normalized_input__pharmacy_claim') }} ) as denominator\n from {{ ref('data_quality__claims_preprocessing_test_detail')}}\n where 1=1\n and test_name in ('ndc_code missing'\n ,'patient_id missing'\n ,'paid_date missing'\n )\n and source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , test_name\n)\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from use_case_stage", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__claims_preprocessing_test_detail"], ["normalized_input__medical_claim"], ["data_quality__claims_preprocessing_test_detail"], ["normalized_input__medical_claim"], ["data_quality__claims_preprocessing_test_detail"], ["normalized_input__medical_claim"], ["data_quality__claims_preprocessing_test_detail"], ["normalized_input__pharmacy_claim"], ["data_quality__claims_preprocessing_test_detail"], ["normalized_input__eligibility"], ["data_quality__claims_preprocessing_test_detail"], ["normalized_input__medical_claim"], ["data_quality__claims_preprocessing_test_detail"], ["normalized_input__pharmacy_claim"], ["data_quality__claims_preprocessing_test_detail"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__pharmacy_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__pharmacy_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_use_case.sql", "compiled": true, "compiled_code": "\nwith use_case_stage as(\n select\n 'encounters' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from dev_sarah.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all\n\n select \n 'service_grouper' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from dev_sarah.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'hcpcs_code missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'readmissions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from dev_sarah.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'pmpm' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from dev_sarah.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('patient_id missing'\n ,'claim_start_date missing'\n ,'claim_type invalid'\n ,'claim_type missing'\n\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'readmissions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim ) as denominator\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('patient_id missing'\n ,'dispensing_date missing'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'paid_amount missing'\n )\n and source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'member_months' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct patient_id||data_source) from dev_sarah.claims_preprocessing.normalized_input_eligibility ) as denominator\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('patient_id missing'\n ,'enrollment_start_date missing'\n ,'enrollment_end_date invalid'\n ,'payer missing'\n ,'payer missing'\n ,'payer_type invalid'\n )\n and source_table = 'normalized_input__eligibility'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'chronic_conditions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from dev_sarah.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'claim_start_date missing'\n ,'claim_start_date invalid'\n ,'patient_id missing'\n ,'patient_id invalid'\n ,'diagnosis_code_type missing'\n ,'diagnosis_code_type invalid'\n ,'procedure_code_1 missing'\n ,'procedure_code_1 invalid'\n ,'procedure_code_type invalid'\n ,'procedure_code_type missing'\n /** encounter fields **/\n ,'diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'chronic_conditions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim ) as denominator\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('ndc_code missing'\n ,'patient_id missing'\n ,'paid_date missing'\n )\n and source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , test_name\n)\n\nselect *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run from use_case_stage", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_detail", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_detail.sql", "original_file_path": "models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_detail.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "final", "data_quality__claims_preprocessing_test_detail"], "alias": "claims_preprocessing_test_detail", "checksum": {"name": "sha256", "checksum": "e6a08ca903b518c67318cb0cc79714ee9901d90f796de8b8ce59a760e7e30d09"}, "config": {"enabled": true, "alias": "claims_preprocessing_test_detail", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {"source_table": {"name": "source_table", "description": "Table this test is in reference to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "test_category": {"name": "test_category", "description": "Category of test", "meta": {}, "data_type": null, "quote": null, "tags": []}, "test_name": {"name": "test_name", "description": "Name of the test being performed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "grain": {"name": "grain", "description": "Grain of the test", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Specific claim type, if any, that this test is specific to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pipeline_test": {"name": "pipeline_test", "description": "Flag to indicate a pipeline stopping test", "meta": {}, "data_type": null, "quote": null, "tags": []}, "foreign_key": {"name": "foreign_key", "description": "The column this table can be used to join back to the source table\n", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claims_preprocessing_test_detail", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.273473, "relation_name": "dev_sarah.data_quality.claims_preprocessing_test_detail", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith test_detail_union as(\n\nselect * from {{ ref('data_quality__claims_preprocessing_test_detail_stage_medical_claim') }}\nunion all\nselect * from {{ ref('data_quality__claims_preprocessing_test_detail_stage_eligibility') }}\nunion all\nselect * from {{ ref('data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim') }}\n\n\n)\n\nselect \n source_table\n , case \n when source_table = 'normalized_input__medical_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__medical_claim' and test_category = 'claim_type'\n then '2_claim_type'\n when source_table = 'normalized_input__medical_claim' and test_category = 'header'\n then '3_header'\n when source_table = 'normalized_input__medical_claim' and test_category = 'invalid_values'\n then '4_invalid_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'missing_values'\n then '5_missing_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'plausibility'\n then '6_plausibility' \n when source_table = 'normalized_input__eligibility' and test_category = 'duplicate_eligibility'\n then '1_duplicate_eligibility'\n when source_table = 'normalized_input__eligibility' and test_category = 'invalid_values'\n then '2_invalid_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'missing_values'\n then '3_missing_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'plausibility'\n then '4_plausibility'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'missing_values'\n then '2_missing_values'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'plausibility'\n then '3_plausibility'\n else test_category \n end as test_category\n , test_name \n , grain\n , claim_type\n , pipeline_test\n , foreign_key\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom test_detail_union", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_detail_stage_medical_claim"], ["data_quality__claims_preprocessing_test_detail_stage_eligibility"], ["data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_detail.sql", "compiled": true, "compiled_code": "\n\nwith test_detail_union as(\n\nselect * from dev_sarah.data_quality._int_claims_preprocessing_test_detail_stage_medical_claim\nunion all\nselect * from dev_sarah.data_quality._int_claims_preprocessing_test_detail_stage_eligibility\nunion all\nselect * from dev_sarah.data_quality._int_claims_preprocessing_test_detail_stage_pharmacy_claim\n\n\n)\n\nselect \n source_table\n , case \n when source_table = 'normalized_input__medical_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__medical_claim' and test_category = 'claim_type'\n then '2_claim_type'\n when source_table = 'normalized_input__medical_claim' and test_category = 'header'\n then '3_header'\n when source_table = 'normalized_input__medical_claim' and test_category = 'invalid_values'\n then '4_invalid_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'missing_values'\n then '5_missing_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'plausibility'\n then '6_plausibility' \n when source_table = 'normalized_input__eligibility' and test_category = 'duplicate_eligibility'\n then '1_duplicate_eligibility'\n when source_table = 'normalized_input__eligibility' and test_category = 'invalid_values'\n then '2_invalid_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'missing_values'\n then '3_missing_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'plausibility'\n then '4_plausibility'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'missing_values'\n then '2_missing_values'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'plausibility'\n then '3_plausibility'\n else test_category \n end as test_category\n , test_name \n , grain\n , claim_type\n , pipeline_test\n , foreign_key\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom test_detail_union", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_summary": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_summary.sql", "original_file_path": "models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_summary.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_summary", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "final", "data_quality__claims_preprocessing_summary"], "alias": "claims_preprocessing_summary", "checksum": {"name": "sha256", "checksum": "507eea2f065d4c9d52e5f49ece43e2996ceed1d5dcd2726b7a0b7b2a8f92e6a8"}, "config": {"enabled": true, "alias": "claims_preprocessing_summary", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {"source_table": {"name": "source_table", "description": "Table this test category is in reference to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "test_category": {"name": "test_category", "description": "Category of test", "meta": {}, "data_type": null, "quote": null, "tags": []}, "counts": {"name": "counts", "description": "Aggregated counts of all tests in this category and table that failed\n", "meta": {}, "data_type": "integer", "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claims_preprocessing_summary", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.268487, "relation_name": "dev_sarah.data_quality.claims_preprocessing_summary", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith test_failure_summary as (\n select\n cast(source_table as {{ dbt.type_string() }} ) as source_table\n , cast(grain as {{ dbt.type_string() }} ) as grain\n , cast(test_category as {{ dbt.type_string() }} ) as test_category\n , cast(count(distinct foreign_key||data_source) as int) as counts\n from {{ ref('data_quality__claims_preprocessing_test_detail' )}}\n group by\n source_table\n ,grain\n ,test_category\n)\n\n, summary_union as(\n select\n cast(source_table as {{ dbt.type_string() }} ) as source_table\n , cast(grain as {{ dbt.type_string() }} ) as grain\n , cast(test_category as {{ dbt.type_string() }} ) as test_category\n , cast(counts as int) as counts\n from test_failure_summary\n\n /******* The tables below populate the test when no failures are present ******/\n union all\n\n select * from (\n select\n cast('normalized_input__medical_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('duplicate_claims' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_duplicates' )}} )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('claim_type' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts \n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_claim_type_mapping_failures' )}} )\n and not exists (select 1 from {{ ref('data_quality__claims_preprocessing_claim_type_unmapped' )}} )\n and not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_inst_missing_values' )}} where test_category = 'claim_type')\n and not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_prof_missing_values' )}} where test_category = 'claim_type')\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('header' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_institutional_header_fail_details' )}} )\n and not exists (select 1 from {{ ref('data_quality__claims_preprocessing_professional_header_fail_details' )}} )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('invalid_values' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_invalid_values' )}} )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('missing_values' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_inst_missing_values' )}} )\n and not exists (select 1 from {{ ref('data_quality__claims_preprocessing_medical_claim_prof_missing_values' )}} )\n\n /**** eligibility ****/\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as {{ dbt.type_string() }} ) as source_table\n , cast('patient_id' as {{ dbt.type_string() }} ) as grain\n , cast('duplicate_eligibility' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_eligibility_duplicates' )}} )\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as {{ dbt.type_string() }} ) as source_table\n , cast('patient_id' as {{ dbt.type_string() }} ) as grain\n , cast('invalid_values' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_eligibility_invalid_values' )}} )\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as {{ dbt.type_string() }} ) as source_table\n , cast('patient_id' as {{ dbt.type_string() }} ) as grain\n , cast('missing_values' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_eligibility_missing_values' )}} )\n\n /**** pharmacy_claim ****/\n union all\n select * from (\n select\n cast('normalized_input__pharmacy_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('duplicate_claims' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_pharmacy_claim_duplicates' )}} )\n union all\n select * from (\n select\n cast('normalized_input__pharmacy_claim' as {{ dbt.type_string() }} ) as source_table\n , cast('claim_id' as {{ dbt.type_string() }} ) as grain\n , cast('missing_values' as {{ dbt.type_string() }} ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from {{ ref('data_quality__claims_preprocessing_pharmacy_claim_missing_values' )}} )\n)\n\nselect \n cast(source_table as {{ dbt.type_string() }} ) as source_table\n , cast(case \n when source_table = 'normalized_input__medical_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__medical_claim' and test_category = 'claim_type'\n then '2_claim_type'\n when source_table = 'normalized_input__medical_claim' and test_category = 'header'\n then '3_header'\n when source_table = 'normalized_input__medical_claim' and test_category = 'invalid_values'\n then '4_invalid_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'missing_values'\n then '5_missing_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'plausibility'\n then '6_plausibility' \n when source_table = 'normalized_input__medical_claim' and test_category = 'good'\n then '7_good' \n when source_table = 'normalized_input__eligibility' and test_category = 'duplicate_eligibility'\n then '1_duplicate_eligibility'\n when source_table = 'normalized_input__eligibility' and test_category = 'invalid_values'\n then '2_invalid_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'missing_values'\n then '3_missing_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'plausibility'\n then '4_plausibility' \n when source_table = 'normalized_input__eligibility' and test_category = 'good'\n then '5_good'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'missing_values'\n then '2_missing_values'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'plausibility'\n then '3_plausibility' \n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'good'\n then '4_good'\n else test_category \n end as {{ dbt.type_string() }} ) as test_category\n , cast(counts as int) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom summary_union", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_detail"], ["data_quality__claims_preprocessing_medical_claim_duplicates"], ["data_quality__claims_preprocessing_claim_type_mapping_failures"], ["data_quality__claims_preprocessing_claim_type_unmapped"], ["data_quality__claims_preprocessing_medical_claim_inst_missing_values"], ["data_quality__claims_preprocessing_medical_claim_prof_missing_values"], ["data_quality__claims_preprocessing_institutional_header_fail_details"], ["data_quality__claims_preprocessing_professional_header_fail_details"], ["data_quality__claims_preprocessing_medical_claim_invalid_values"], ["data_quality__claims_preprocessing_medical_claim_inst_missing_values"], ["data_quality__claims_preprocessing_medical_claim_prof_missing_values"], ["data_quality__claims_preprocessing_eligibility_duplicates"], ["data_quality__claims_preprocessing_eligibility_invalid_values"], ["data_quality__claims_preprocessing_eligibility_missing_values"], ["data_quality__claims_preprocessing_pharmacy_claim_duplicates"], ["data_quality__claims_preprocessing_pharmacy_claim_missing_values"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_summary.sql", "compiled": true, "compiled_code": "\n\nwith test_failure_summary as (\n select\n cast(source_table as TEXT ) as source_table\n , cast(grain as TEXT ) as grain\n , cast(test_category as TEXT ) as test_category\n , cast(count(distinct foreign_key||data_source) as int) as counts\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n group by\n source_table\n ,grain\n ,test_category\n)\n\n, summary_union as(\n select\n cast(source_table as TEXT ) as source_table\n , cast(grain as TEXT ) as grain\n , cast(test_category as TEXT ) as test_category\n , cast(counts as int) as counts\n from test_failure_summary\n\n /******* The tables below populate the test when no failures are present ******/\n union all\n\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('duplicate_claims' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_medical_claim_duplicates )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('claim_type' as TEXT ) as test_category\n , cast(0 as int) as counts \n ) failure_stub\n where not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_claim_type_mapping_failures )\n and not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_claim_type_unmapped )\n and not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values where test_category = 'claim_type')\n and not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values where test_category = 'claim_type')\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('header' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_institutional_header_fail_details )\n and not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_professional_header_fail_details )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('invalid_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_medical_claim_invalid_values )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('missing_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values )\n and not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values )\n\n /**** eligibility ****/\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as TEXT ) as source_table\n , cast('patient_id' as TEXT ) as grain\n , cast('duplicate_eligibility' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_eligibility_duplicates )\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as TEXT ) as source_table\n , cast('patient_id' as TEXT ) as grain\n , cast('invalid_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_eligibility_invalid_values )\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as TEXT ) as source_table\n , cast('patient_id' as TEXT ) as grain\n , cast('missing_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_eligibility_missing_values )\n\n /**** pharmacy_claim ****/\n union all\n select * from (\n select\n cast('normalized_input__pharmacy_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('duplicate_claims' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_pharmacy_claim_duplicates )\n union all\n select * from (\n select\n cast('normalized_input__pharmacy_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('missing_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from dev_sarah.data_quality._int_claims_preprocessing_pharmacy_claim_missing_values )\n)\n\nselect \n cast(source_table as TEXT ) as source_table\n , cast(case \n when source_table = 'normalized_input__medical_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__medical_claim' and test_category = 'claim_type'\n then '2_claim_type'\n when source_table = 'normalized_input__medical_claim' and test_category = 'header'\n then '3_header'\n when source_table = 'normalized_input__medical_claim' and test_category = 'invalid_values'\n then '4_invalid_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'missing_values'\n then '5_missing_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'plausibility'\n then '6_plausibility' \n when source_table = 'normalized_input__medical_claim' and test_category = 'good'\n then '7_good' \n when source_table = 'normalized_input__eligibility' and test_category = 'duplicate_eligibility'\n then '1_duplicate_eligibility'\n when source_table = 'normalized_input__eligibility' and test_category = 'invalid_values'\n then '2_invalid_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'missing_values'\n then '3_missing_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'plausibility'\n then '4_plausibility' \n when source_table = 'normalized_input__eligibility' and test_category = 'good'\n then '5_good'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'missing_values'\n then '2_missing_values'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'plausibility'\n then '3_plausibility' \n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'good'\n then '4_good'\n else test_category \n end as TEXT ) as test_category\n , cast(counts as int) as counts\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom summary_union", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_test_result": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_result.sql", "original_file_path": "models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_result.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "final", "data_quality__claims_preprocessing_test_result"], "alias": "claims_preprocessing_test_result", "checksum": {"name": "sha256", "checksum": "add437e19ce37e4bde845dadb7bb35ef6855461139703c07e355befa2bf72238"}, "config": {"enabled": true, "alias": "claims_preprocessing_test_result", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {"source_table": {"name": "source_table", "description": "Table this test is in reference to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "grain": {"name": "grain", "description": "Grain of the test", "meta": {}, "data_type": null, "quote": null, "tags": []}, "test_category": {"name": "test_category", "description": "Category of test", "meta": {}, "data_type": null, "quote": null, "tags": []}, "test_name": {"name": "test_name", "description": "Name of the test being performed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Specific claim type, if any, that this test is specific to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pipeline_test": {"name": "pipeline_test", "description": "Flag to indicate a pipeline stopping test", "meta": {}, "data_type": null, "quote": null, "tags": []}, "failures": {"name": "failures", "description": "Number of failures of this test", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "denominator": {"name": "denominator", "description": "Total number of records analyzed for this test", "meta": {}, "data_type": "integer", "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claims_preprocessing_test_result", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.278993, "relation_name": "dev_sarah.data_quality.claims_preprocessing_test_result", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect * from {{ ref('data_quality__claims_preprocessing_test_result_stage_medical_claim') }}\n\nunion all\n\nselect * from {{ ref('data_quality__claims_preprocessing_test_result_stage_eligibility') }}\n\nunion all\n\nselect * from {{ ref('data_quality__claims_preprocessing_test_result_stage_pharmacy_claim') }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_result_stage_medical_claim"], ["data_quality__claims_preprocessing_test_result_stage_eligibility"], ["data_quality__claims_preprocessing_test_result_stage_pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/final/data_quality__claims_preprocessing_test_result.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.data_quality._int_claims_preprocessing_test_result_stage_medical_claim\n\nunion all\n\nselect * from dev_sarah.data_quality._int_claims_preprocessing_test_result_stage_eligibility\n\nunion all\n\nselect * from dev_sarah.data_quality._int_claims_preprocessing_test_result_stage_pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_result_stage_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_pharmacy_claim.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_result_stage_pharmacy_claim"], "alias": "_int_claims_preprocessing_test_result_stage_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "11c74f62639a1b7393e37d300b38cf87f5980119ccd8e5e7c142d81fb673ca3d"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_result_stage_pharmacy_claim", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_result_stage_pharmacy_claim", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.4010382, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_test_result_stage_pharmacy_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith pharmacy_claim_denominator as(\n select \n cast('all' as {{ dbt.type_string() }} ) as claim_type\n , cast(count(distinct claim_id||data_source) as int) as count\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\n from {{ ref('normalized_input__pharmacy_claim') }}\n)\n\n, distinct_patient_per_category as(\n select\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n from {{ ref('data_quality__claims_preprocessing_test_detail') }}\n where source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n )\n\n select\n source_table\n , grain\n , claim.test_category\n , claim.test_name\n , claim.claim_type\n , pipeline_test\n , claim.failures\n , denom.count as denominator\n , tuva_last_run\n from distinct_patient_per_category claim\n left join pharmacy_claim_denominator denom\n on claim.claim_type = denom.claim_type\n group by\n source_table\n , grain\n , claim.test_category\n , claim.test_name\n , claim.claim_type\n , pipeline_test\n , claim.failures\n , denom.count\n , tuva_last_run", "language": "sql", "refs": [["normalized_input__pharmacy_claim"], ["data_quality__claims_preprocessing_test_detail"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.normalized_input__pharmacy_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim_denominator as(\n select \n cast('all' as TEXT ) as claim_type\n , cast(count(distinct claim_id||data_source) as int) as count\n , cast('2024-02-21 19:58:21.989699+00:00' as TEXT ) as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n)\n\n, distinct_patient_per_category as(\n select\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n where source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n )\n\n select\n source_table\n , grain\n , claim.test_category\n , claim.test_name\n , claim.claim_type\n , pipeline_test\n , claim.failures\n , denom.count as denominator\n , tuva_last_run\n from distinct_patient_per_category claim\n left join pharmacy_claim_denominator denom\n on claim.claim_type = denom.claim_type\n group by\n source_table\n , grain\n , claim.test_category\n , claim.test_name\n , claim.claim_type\n , pipeline_test\n , claim.failures\n , denom.count\n , tuva_last_run", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_detail_stage_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_eligibility.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_eligibility.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_detail_stage_eligibility"], "alias": "_int_claims_preprocessing_test_detail_stage_eligibility", "checksum": {"name": "sha256", "checksum": "b04f520f2584760c3df5fc6247855112df25a989876ae4fd16e9bb38f218ba72"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_detail_stage_eligibility", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_detail_stage_eligibility", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.301345, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_test_detail_stage_eligibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_eligibility_duplicates') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_eligibility_missing_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_eligibility_invalid_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_eligibility_plausibility') }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_eligibility_duplicates"], ["data_quality__claims_preprocessing_eligibility_missing_values"], ["data_quality__claims_preprocessing_eligibility_invalid_values"], ["data_quality__claims_preprocessing_eligibility_plausibility"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_eligibility.sql", "compiled": true, "compiled_code": "\n\n\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_eligibility_duplicates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_eligibility_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_eligibility_invalid_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_eligibility_plausibility", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_invalid_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_npi.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_npi.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_invalid_npi"], "alias": "_int_claims_preprocessing_medical_claim_invalid_npi", "checksum": {"name": "sha256", "checksum": "a597aa1d75f2240878b8134e9f03bbe4b31f7632add407ebfd6b77075c70625d"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_invalid_npi", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_invalid_npi", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.3551848, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_medical_claim_invalid_npi", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith medical_claim as (\n\n select *\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, valid_billing_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.billing_npi) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__provider')}} pro\n on medical_claim.billing_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'billing_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.billing_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_facility_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.facility_npi) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__provider')}} pro\n on medical_claim.facility_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'facility_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.facility_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_rendering_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.rendering_npi) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__provider')}} pro\n on medical_claim.rendering_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'rendering_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.rendering_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_billing_npi\nunion all\nselect * from valid_facility_npi\nunion all\nselect * from valid_rendering_npi", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__test_catalog"], ["terminology__provider"], ["terminology__provider"], ["terminology__provider"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_npi.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select *\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\n, valid_billing_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.billing_npi) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.provider pro\n on medical_claim.billing_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'billing_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.billing_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_facility_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.facility_npi) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.provider pro\n on medical_claim.facility_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'facility_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.facility_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_rendering_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.rendering_npi) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.provider pro\n on medical_claim.rendering_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'rendering_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.rendering_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_billing_npi\nunion all\nselect * from valid_facility_npi\nunion all\nselect * from valid_rendering_npi", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_eligibility_missing_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_missing_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_missing_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_eligibility_missing_values"], "alias": "_int_claims_preprocessing_eligibility_missing_values", "checksum": {"name": "sha256", "checksum": "d2e6e2bfbd26ec32ccb9262ed739f2a429b7d0b74776853b2406dfc3bec60424"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_eligibility_missing_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_eligibility_missing_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.291724, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_eligibility_missing_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set eligibility_missing_column_list = [\n 'patient_id'\n , 'member_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 , 'dual_status_code'\n , 'medicare_status_code'\n , 'first_name'\n , 'last_name'\n , 'address'\n , 'city'\n , 'state'\n , 'zip_code'\n , 'phone'\n , 'data_source'\n] -%}\n\nwith eligibility_missing as (\n\n {{ eligibility_missing_column_check(builtins.ref('normalized_input__eligibility'), eligibility_missing_column_list) }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'patient_id' as grain\n , eligibility_missing.patient_id\n , eligibility_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom eligibility_missing\n left join test_catalog\n on test_catalog.test_name = eligibility_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__eligibility'\ngroup by\n eligibility_missing.patient_id\n , eligibility_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__eligibility"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.eligibility_missing_column_check"], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_missing_values.sql", "compiled": true, "compiled_code": "\n\nwith eligibility_missing as (\n\n \n select\n patient_id\n , data_source\n , 'patient_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where patient_id is null\n union all\n select\n patient_id\n , data_source\n , 'member_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where member_id is null\n union all\n select\n patient_id\n , data_source\n , 'gender' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where gender is null\n union all\n select\n patient_id\n , data_source\n , 'race' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where race is null\n union all\n select\n patient_id\n , data_source\n , 'birth_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where birth_date is null\n union all\n select\n patient_id\n , data_source\n , 'death_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where death_date is null\n union all\n select\n patient_id\n , data_source\n , 'death_flag' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where death_flag is null\n union all\n select\n patient_id\n , data_source\n , 'enrollment_start_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where enrollment_start_date is null\n union all\n select\n patient_id\n , data_source\n , 'enrollment_end_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where enrollment_end_date is null\n union all\n select\n patient_id\n , data_source\n , 'payer' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where payer is null\n union all\n select\n patient_id\n , data_source\n , 'payer_type' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where payer_type is null\n union all\n select\n patient_id\n , data_source\n , 'dual_status_code' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where dual_status_code is null\n union all\n select\n patient_id\n , data_source\n , 'medicare_status_code' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where medicare_status_code is null\n union all\n select\n patient_id\n , data_source\n , 'first_name' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where first_name is null\n union all\n select\n patient_id\n , data_source\n , 'last_name' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where last_name is null\n union all\n select\n patient_id\n , data_source\n , 'address' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where address is null\n union all\n select\n patient_id\n , data_source\n , 'city' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where city is null\n union all\n select\n patient_id\n , data_source\n , 'state' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where state is null\n union all\n select\n patient_id\n , data_source\n , 'zip_code' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where zip_code is null\n union all\n select\n patient_id\n , data_source\n , 'phone' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where phone is null\n union all\n select\n patient_id\n , data_source\n , 'data_source' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n where data_source is null\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'patient_id' as grain\n , eligibility_missing.patient_id\n , eligibility_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom eligibility_missing\n left join test_catalog\n on test_catalog.test_name = eligibility_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__eligibility'\ngroup by\n eligibility_missing.patient_id\n , eligibility_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_pharmacy_claim_duplicates", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_duplicates.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_duplicates.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_pharmacy_claim_duplicates"], "alias": "_int_claims_preprocessing_pharmacy_claim_duplicates", "checksum": {"name": "sha256", "checksum": "b95ed8a0bc634462973a923f9e3dfeb32d9b17e41ec66d72fb86f356f4f6b2df"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_pharmacy_claim_duplicates", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_pharmacy_claim_duplicates", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.393662, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_pharmacy_claim_duplicates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__pharmacy_claim') }}\n left join test_catalog\n on test_catalog.test_name = 'duplicate pharmacy claims'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n claim_id\n , claim_line_number\n , data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "language": "sql", "refs": [["data_quality__test_catalog"], ["normalized_input__pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.data_quality__test_catalog", "model.the_tuva_project.normalized_input__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_duplicates.sql", "compiled": true, "compiled_code": "\n\nwith test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n left join test_catalog\n on test_catalog.test_name = 'duplicate pharmacy claims'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n claim_id\n , claim_line_number\n , data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_eligibility_plausibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_plausibility.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_plausibility.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_eligibility_plausibility"], "alias": "_int_claims_preprocessing_eligibility_plausibility", "checksum": {"name": "sha256", "checksum": "5c0a56afedaf7f81a45427652011c15bc5aa77266f0987de893c5881c5b38522"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_eligibility_plausibility", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_eligibility_plausibility", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.29888, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_eligibility_plausibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith eligiblity as (\n\n select *\n from {{ ref('normalized_input__eligibility') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, multiple_genders_test as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple genders'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.gender) > 1\n\n)\n\n, multiple_races_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple races'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.race) > 1\n\n)\n\n, multiple_birth_dates_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple birth dates'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.birth_date) > 1\n\n)\n\n, multiple_death_dates_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple death dates'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.death_date) > 1\n\n)\n\n, birth_date_after_death_date as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'birth date after death date'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where eligiblity.birth_date > eligiblity.death_date\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from multiple_genders_test\nunion all\nselect * from multiple_races_test\nunion all\nselect * from multiple_birth_dates_test\nunion all\nselect * from multiple_death_dates_test\nunion all\nselect * from birth_date_after_death_date", "language": "sql", "refs": [["normalized_input__eligibility"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_plausibility.sql", "compiled": true, "compiled_code": "\n\nwith eligiblity as (\n\n select *\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\n, multiple_genders_test as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple genders'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.gender) > 1\n\n)\n\n, multiple_races_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple races'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.race) > 1\n\n)\n\n, multiple_birth_dates_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple birth dates'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.birth_date) > 1\n\n)\n\n, multiple_death_dates_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple death dates'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.death_date) > 1\n\n)\n\n, birth_date_after_death_date as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'birth date after death date'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where eligiblity.birth_date > eligiblity.death_date\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from multiple_genders_test\nunion all\nselect * from multiple_races_test\nunion all\nselect * from multiple_birth_dates_test\nunion all\nselect * from multiple_death_dates_test\nunion all\nselect * from birth_date_after_death_date", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_inst_missing_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_inst_missing_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_inst_missing_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_inst_missing_values"], "alias": "_int_claims_preprocessing_medical_claim_inst_missing_values", "checksum": {"name": "sha256", "checksum": "5feee9116be1eb359dd57e13e1f6b25926d2ea1c7bdc5993702f608354105159"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_inst_missing_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_inst_missing_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.352443, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set institutional_missing_column_list = [\n 'claim_id'\n , 'claim_line_number'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'bill_type_code'\n , 'revenue_center_code'\n , 'hcpcs_code'\n , 'rendering_npi'\n , 'billing_npi'\n , 'facility_npi'\n , 'paid_date'\n , 'paid_amount'\n , 'diagnosis_code_type'\n , 'diagnosis_code_1'\n , 'data_source'\n] -%}\n\nwith institutional_missing as (\n\n {{ medical_claim_missing_column_check(builtins.ref('normalized_input__medical_claim'), institutional_missing_column_list, 'institutional') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , institutional_missing.claim_id\n , institutional_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom institutional_missing\n left join test_catalog\n on test_catalog.test_name = institutional_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n institutional_missing.claim_id\n , institutional_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_missing_column_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_inst_missing_values.sql", "compiled": true, "compiled_code": "\n\nwith institutional_missing as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_id is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'claim_line_number' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_line_number is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where patient_id is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where member_id is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where payer is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where plan is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_start_date is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_end_date is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where bill_type_code is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'revenue_center_code' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where revenue_center_code is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'hcpcs_code' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where hcpcs_code is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'rendering_npi' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where rendering_npi is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where billing_npi is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'facility_npi' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where facility_npi is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where paid_date is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'paid_amount' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where paid_amount is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_type is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_1 is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where data_source is null\n and claim_type = 'institutional'\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , institutional_missing.claim_id\n , institutional_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom institutional_missing\n left join test_catalog\n on test_catalog.test_name = institutional_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n institutional_missing.claim_id\n , institutional_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_pharmacy_header_fail_details", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_header_fail_details.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_header_fail_details.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_pharmacy_header_fail_details"], "alias": "_int_claims_preprocessing_pharmacy_header_fail_details", "checksum": {"name": "sha256", "checksum": "37a628cc32db63424c1759946a5db79ca68ab304cc0f5c7a31c100addc2d7e10"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_pharmacy_header_fail_details", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_pharmacy_header_fail_details", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.3116002, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_pharmacy_header_fail_details", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set pharmacy_header_column_list = [\n 'claim_id'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'data_source'\n] -%}\n\nwith pharmacy_header_duplicates as (\n\n {{ pharmacy_claim_header_duplicate_check(builtins.ref('normalized_input__pharmacy_claim'), pharmacy_header_column_list) }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , pharmacy_header_duplicates.claim_id\n , pharmacy_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom pharmacy_header_duplicates\n left join test_catalog\n on test_catalog.test_name = pharmacy_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by \n pharmacy_header_duplicates.claim_id\n , pharmacy_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__pharmacy_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.pharmacy_claim_header_duplicate_check"], "nodes": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_header_fail_details.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_header_duplicates as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n , count(distinct claim_id) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct claim_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n , count(distinct patient_id) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct patient_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n , count(distinct member_id) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct member_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n , count(distinct payer) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct payer) > 1\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n , count(distinct plan) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct plan) > 1\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n , count(distinct data_source) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct data_source) > 1\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , pharmacy_header_duplicates.claim_id\n , pharmacy_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom pharmacy_header_duplicates\n left join test_catalog\n on test_catalog.test_name = pharmacy_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by \n pharmacy_header_duplicates.claim_id\n , pharmacy_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_professional_header_fail_details", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_professional_header_fail_details.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_professional_header_fail_details.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_professional_header_fail_details"], "alias": "_int_claims_preprocessing_professional_header_fail_details", "checksum": {"name": "sha256", "checksum": "5b05422d8e84979c2e858816d8ea00f89bc0cbccee2b6e7cdbc4eb362afa7a3a"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_professional_header_fail_details", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_professional_header_fail_details", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.309379, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_professional_header_fail_details", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set professional_header_column_list = [\n 'claim_id'\n , 'claim_type'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'place_of_service_code'\n , 'billing_npi'\n , 'paid_date'\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 , 'data_source'\n] -%}\n\nwith professional_header_duplicates as (\n\n {{ medical_claim_header_duplicate_check(builtins.ref('normalized_input__medical_claim'), professional_header_column_list, 'professional') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'professional' as claim_type\n , 'claim_id' as grain\n , professional_header_duplicates.claim_id\n , professional_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom professional_header_duplicates\n left join test_catalog\n on test_catalog.test_name = professional_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n and test_catalog.claim_type = 'professional'\ngroup by \n professional_header_duplicates.claim_id\n , professional_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_header_duplicate_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_professional_header_fail_details.sql", "compiled": true, "compiled_code": "\n\nwith professional_header_duplicates as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n , count(distinct claim_id) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_type' as column_checked\n , count(distinct claim_type) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n , count(distinct patient_id) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct patient_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n , count(distinct member_id) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct member_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n , count(distinct payer) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct payer) > 1\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n , count(distinct plan) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct plan) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n , count(distinct claim_start_date) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_start_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n , count(distinct claim_end_date) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_end_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'place_of_service_code' as column_checked\n , count(distinct place_of_service_code) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct place_of_service_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n , count(distinct billing_npi) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct billing_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n , count(distinct paid_date) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct paid_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n , count(distinct diagnosis_code_type) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n , count(distinct diagnosis_code_1) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_2' as column_checked\n , count(distinct diagnosis_code_2) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_3' as column_checked\n , count(distinct diagnosis_code_3) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_4' as column_checked\n , count(distinct diagnosis_code_4) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_5' as column_checked\n , count(distinct diagnosis_code_5) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_6' as column_checked\n , count(distinct diagnosis_code_6) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_7' as column_checked\n , count(distinct diagnosis_code_7) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_8' as column_checked\n , count(distinct diagnosis_code_8) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_9' as column_checked\n , count(distinct diagnosis_code_9) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_10' as column_checked\n , count(distinct diagnosis_code_10) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_11' as column_checked\n , count(distinct diagnosis_code_11) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_12' as column_checked\n , count(distinct diagnosis_code_12) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_13' as column_checked\n , count(distinct diagnosis_code_13) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_14' as column_checked\n , count(distinct diagnosis_code_14) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_15' as column_checked\n , count(distinct diagnosis_code_15) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_16' as column_checked\n , count(distinct diagnosis_code_16) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_17' as column_checked\n , count(distinct diagnosis_code_17) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_18' as column_checked\n , count(distinct diagnosis_code_18) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_19' as column_checked\n , count(distinct diagnosis_code_19) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_20' as column_checked\n , count(distinct diagnosis_code_20) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_21' as column_checked\n , count(distinct diagnosis_code_21) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_22' as column_checked\n , count(distinct diagnosis_code_22) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_23' as column_checked\n , count(distinct diagnosis_code_23) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_24' as column_checked\n , count(distinct diagnosis_code_24) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_25' as column_checked\n , count(distinct diagnosis_code_25) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n , count(distinct data_source) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct data_source) > 1\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'professional' as claim_type\n , 'claim_id' as grain\n , professional_header_duplicates.claim_id\n , professional_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom professional_header_duplicates\n left join test_catalog\n on test_catalog.test_name = professional_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n and test_catalog.claim_type = 'professional'\ngroup by \n professional_header_duplicates.claim_id\n , professional_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_eligibility_duplicates", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_duplicates.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_duplicates.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_eligibility_duplicates"], "alias": "_int_claims_preprocessing_eligibility_duplicates", "checksum": {"name": "sha256", "checksum": "6d5abb7f253bb640bfeee840b0232e14dff93e474286afa1fd6a61c8020eea12"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_eligibility_duplicates", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_eligibility_duplicates", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.286279, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_eligibility_duplicates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith eligibility as (\n\n select\n patient_id\n , member_id\n , payer\n , plan\n , enrollment_start_date\n , enrollment_end_date\n , data_source\n from {{ ref('normalized_input__eligibility') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'patient_id' as grain\n , patient_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom eligibility\n left join test_catalog\n on test_catalog.test_name = 'duplicate eligibility'\n and test_catalog.source_table = 'normalized_input__eligibility'\ngroup by\n eligibility.patient_id\n , eligibility.member_id\n , eligibility.payer\n , eligibility.plan\n , eligibility.enrollment_start_date\n , eligibility.enrollment_end_date\n , eligibility.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "language": "sql", "refs": [["normalized_input__eligibility"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_duplicates.sql", "compiled": true, "compiled_code": "\n\nwith eligibility as (\n\n select\n patient_id\n , member_id\n , payer\n , plan\n , enrollment_start_date\n , enrollment_end_date\n , data_source\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'patient_id' as grain\n , patient_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom eligibility\n left join test_catalog\n on test_catalog.test_name = 'duplicate eligibility'\n and test_catalog.source_table = 'normalized_input__eligibility'\ngroup by\n eligibility.patient_id\n , eligibility.member_id\n , eligibility.payer\n , eligibility.plan\n , eligibility.enrollment_start_date\n , eligibility.enrollment_end_date\n , eligibility.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_claim_type_unmapped", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_unmapped.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_unmapped.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_claim_type_unmapped"], "alias": "_int_claims_preprocessing_claim_type_unmapped", "checksum": {"name": "sha256", "checksum": "48e0b867c4bfac43b1ad76d39a4c844372f60bf5dc1a8bbdabc6f71987e056ae"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_claim_type_unmapped", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_claim_type_unmapped", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.304186, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_claim_type_unmapped", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith medical_claim as (\n\n select\n claim_id\n , data_source\n , claim_type\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom medical_claim\n left join test_catalog\n on test_catalog.test_name = 'claim_type missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\nwhere medical_claim.claim_type is null\ngroup by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_unmapped.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select\n claim_id\n , data_source\n , claim_type\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom medical_claim\n left join test_catalog\n on test_catalog.test_name = 'claim_type missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\nwhere medical_claim.claim_type is null\ngroup by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_invalid_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_invalid_values"], "alias": "_int_claims_preprocessing_medical_claim_invalid_values", "checksum": {"name": "sha256", "checksum": "00fc1edabd9d8489e3a56535cf5e1027e073187f1c5d734624110fd73904ac30"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_invalid_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_invalid_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.345886, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_medical_claim_invalid_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith medical_claim as (\n\n select *\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, valid_bill_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.bill_type_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__bill_type')}} tob\n on medical_claim.bill_type_code = tob.bill_type_code\n left join test_catalog\n on test_catalog.test_name = 'bill_type_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and tob.bill_type_code is null\n and medical_claim.bill_type_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_revenue_center as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.revenue_center_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__revenue_center') }} rev\n on medical_claim.revenue_center_code = rev.revenue_center_code\n left join test_catalog\n on test_catalog.test_name = 'revenue_center_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and rev.revenue_center_code is null\n and medical_claim.revenue_center_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_discharge_disposition as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.discharge_disposition_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__discharge_disposition') }} discharge\n on medical_claim.discharge_disposition_code = discharge.discharge_disposition_code\n left join test_catalog\n on test_catalog.test_name = 'discharge_disposition_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and discharge.discharge_disposition_code is null\n and medical_claim.discharge_disposition_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_admit_source as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.admit_source_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__admit_source') }} adsource\n on medical_claim.admit_source_code = adsource.admit_source_code\n left join test_catalog\n on test_catalog.test_name = 'admit_source_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and adsource.admit_source_code is null\n and medical_claim.admit_source_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_admit_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.admit_type_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__admit_type') }} adtype\n on medical_claim.admit_type_code = adtype.admit_type_code\n left join test_catalog\n on test_catalog.test_name = 'admit_type_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and adtype.admit_type_code is null\n and medical_claim.admit_type_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_ms_drg as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.ms_drg_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__ms_drg') }} msdrg\n on medical_claim.ms_drg_code = msdrg.ms_drg_code\n left join test_catalog\n on test_catalog.test_name = 'ms_drg_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and msdrg.ms_drg_code is null\n and medical_claim.ms_drg_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_apr_drg as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.apr_drg_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__apr_drg') }} aprdrg\n on medical_claim.apr_drg_code = aprdrg.apr_drg_code\n left join test_catalog\n on test_catalog.test_name = 'apr_drg_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and aprdrg.apr_drg_code is null\n and medical_claim.apr_drg_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_present_on_admission as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_poa_1) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__present_on_admission') }} poa\n on medical_claim.diagnosis_poa_1 = poa.present_on_admit_code\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_poa_1 invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and poa.present_on_admit_code is null\n and medical_claim.diagnosis_poa_1 is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_procedure_code_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.procedure_code_type) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__code_type') }} codetype\n on medical_claim.procedure_code_type = codetype.code_type\n left join test_catalog\n on test_catalog.test_name = 'procedure_code_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claim_type = 'institutional'\n and codetype.code_type is null\n and medical_claim.procedure_code_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_place_of_service as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.place_of_service_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__place_of_service') }} pos\n on medical_claim.place_of_service_code = pos.place_of_service_code\n left join test_catalog\n on test_catalog.test_name = 'place_of_service_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claim_type = 'professional'\n and pos.place_of_service_code is null\n and medical_claim.place_of_service_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_diagnosis_code_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_code_type) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__code_type') }} codetype\n on medical_claim.diagnosis_code_type = codetype.code_type\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_code_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where codetype.code_type is null\n and medical_claim.diagnosis_code_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_diagnosis_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_code_1) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__icd_10_cm') }} icd\n on medical_claim.diagnosis_code_1 = icd.icd_10_cm\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_code_1 invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where diagnosis_code_type = 'icd-10-cm'\n and icd.icd_10_cm is null\n and medical_claim.diagnosis_code_1 is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_claim_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.claim_type) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join {{ ref('terminology__claim_type') }} claimtype\n on medical_claim.claim_type = claimtype.claim_type\n left join test_catalog\n on test_catalog.test_name = 'claim_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claimtype.claim_type is null\n and medical_claim.claim_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_bill_type\nunion all \nselect * from valid_revenue_center\nunion all \nselect * from valid_discharge_disposition\nunion all \nselect * from valid_admit_source\nunion all \nselect * from valid_admit_type\nunion all \nselect * from valid_ms_drg\nunion all \nselect * from valid_apr_drg\nunion all \nselect * from valid_present_on_admission\nunion all \nselect * from valid_diagnosis_code_type\nunion all \nselect * from valid_procedure_code_type\nunion all \nselect * from valid_diagnosis_code\nunion all \nselect * from valid_claim_type\nunion all \nselect * from valid_place_of_service", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__test_catalog"], ["terminology__bill_type"], ["terminology__revenue_center"], ["terminology__discharge_disposition"], ["terminology__admit_source"], ["terminology__admit_type"], ["terminology__ms_drg"], ["terminology__apr_drg"], ["terminology__present_on_admission"], ["terminology__code_type"], ["terminology__place_of_service"], ["terminology__code_type"], ["terminology__icd_10_cm"], ["terminology__claim_type"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__revenue_center", "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__present_on_admission", "seed.the_tuva_project.terminology__code_type", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__code_type", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__claim_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_invalid_values.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select *\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\n, valid_bill_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.bill_type_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.bill_type tob\n on medical_claim.bill_type_code = tob.bill_type_code\n left join test_catalog\n on test_catalog.test_name = 'bill_type_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and tob.bill_type_code is null\n and medical_claim.bill_type_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_revenue_center as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.revenue_center_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.revenue_center rev\n on medical_claim.revenue_center_code = rev.revenue_center_code\n left join test_catalog\n on test_catalog.test_name = 'revenue_center_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and rev.revenue_center_code is null\n and medical_claim.revenue_center_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_discharge_disposition as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.discharge_disposition_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.discharge_disposition discharge\n on medical_claim.discharge_disposition_code = discharge.discharge_disposition_code\n left join test_catalog\n on test_catalog.test_name = 'discharge_disposition_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and discharge.discharge_disposition_code is null\n and medical_claim.discharge_disposition_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_admit_source as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.admit_source_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.admit_source adsource\n on medical_claim.admit_source_code = adsource.admit_source_code\n left join test_catalog\n on test_catalog.test_name = 'admit_source_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and adsource.admit_source_code is null\n and medical_claim.admit_source_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_admit_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.admit_type_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.admit_type adtype\n on medical_claim.admit_type_code = adtype.admit_type_code\n left join test_catalog\n on test_catalog.test_name = 'admit_type_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and adtype.admit_type_code is null\n and medical_claim.admit_type_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_ms_drg as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.ms_drg_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.ms_drg msdrg\n on medical_claim.ms_drg_code = msdrg.ms_drg_code\n left join test_catalog\n on test_catalog.test_name = 'ms_drg_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and msdrg.ms_drg_code is null\n and medical_claim.ms_drg_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_apr_drg as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.apr_drg_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.apr_drg aprdrg\n on medical_claim.apr_drg_code = aprdrg.apr_drg_code\n left join test_catalog\n on test_catalog.test_name = 'apr_drg_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and aprdrg.apr_drg_code is null\n and medical_claim.apr_drg_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_present_on_admission as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_poa_1) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.present_on_admission poa\n on medical_claim.diagnosis_poa_1 = poa.present_on_admit_code\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_poa_1 invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and poa.present_on_admit_code is null\n and medical_claim.diagnosis_poa_1 is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_procedure_code_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.procedure_code_type) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.code_type codetype\n on medical_claim.procedure_code_type = codetype.code_type\n left join test_catalog\n on test_catalog.test_name = 'procedure_code_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claim_type = 'institutional'\n and codetype.code_type is null\n and medical_claim.procedure_code_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_place_of_service as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.place_of_service_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.place_of_service pos\n on medical_claim.place_of_service_code = pos.place_of_service_code\n left join test_catalog\n on test_catalog.test_name = 'place_of_service_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claim_type = 'professional'\n and pos.place_of_service_code is null\n and medical_claim.place_of_service_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_diagnosis_code_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_code_type) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.code_type codetype\n on medical_claim.diagnosis_code_type = codetype.code_type\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_code_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where codetype.code_type is null\n and medical_claim.diagnosis_code_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_diagnosis_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_code_1) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.icd_10_cm icd\n on medical_claim.diagnosis_code_1 = icd.icd_10_cm\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_code_1 invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where diagnosis_code_type = 'icd-10-cm'\n and icd.icd_10_cm is null\n and medical_claim.diagnosis_code_1 is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_claim_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.claim_type) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join dev_sarah.terminology.claim_type claimtype\n on medical_claim.claim_type = claimtype.claim_type\n left join test_catalog\n on test_catalog.test_name = 'claim_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claimtype.claim_type is null\n and medical_claim.claim_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_bill_type\nunion all \nselect * from valid_revenue_center\nunion all \nselect * from valid_discharge_disposition\nunion all \nselect * from valid_admit_source\nunion all \nselect * from valid_admit_type\nunion all \nselect * from valid_ms_drg\nunion all \nselect * from valid_apr_drg\nunion all \nselect * from valid_present_on_admission\nunion all \nselect * from valid_diagnosis_code_type\nunion all \nselect * from valid_procedure_code_type\nunion all \nselect * from valid_diagnosis_code\nunion all \nselect * from valid_claim_type\nunion all \nselect * from valid_place_of_service", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_denominators", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_denominators.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_denominators.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_denominators"], "alias": "_int_claims_preprocessing_medical_claim_denominators", "checksum": {"name": "sha256", "checksum": "dc9cb9b97fd99d9c96893688dbd1ad350f0d4464a40edda3cb9b7e67a31f0305"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_denominators", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_denominators", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.3723168, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_medical_claim_denominators", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n/*\n Denominator logic for invalid value tests is dependent on whether that\n specific field is populated or not. We created a macro to automatically\n generate the CTE. All invalid value tests must have a\n test_category = 'invalid_values' in the catalog seed.\n*/\nwith professional_denominator as (\n\n select\n cast('professional' as {{ dbt.type_string() }} ) as test_denominator_name\n , cast(count(distinct claim_id||data_source) as int) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('normalized_input__medical_claim') }}\n where claim_type = 'professional'\n\n)\n\n, institutional_denominator as (\n\n select\n cast('institutional' as {{ dbt.type_string() }} ) as test_denominator_name\n , count(distinct claim_id||data_source) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('normalized_input__medical_claim') }}\n where claim_type = 'institutional'\n\n)\n\n, all_claim_denominator as (\n\n select\n cast('all' as {{ dbt.type_string() }} ) as test_denominator_name\n , count(distinct claim_id||data_source) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('normalized_input__medical_claim') }}\n where claim_type is not null\n\n)\n\n, invalid_value_denominators as (\n\n {{ medical_claim_denominator_invalid_values(builtins.ref('normalized_input__medical_claim')) }}\n\n)\n\nselect * from institutional_denominator\nunion all \nselect * from professional_denominator\nunion all\nselect * from all_claim_denominator\nunion all\nselect * from invalid_value_denominators", "language": "sql", "refs": [["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["normalized_input__medical_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.medical_claim_denominator_invalid_values"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_denominators.sql", "compiled": true, "compiled_code": "\n/*\n Denominator logic for invalid value tests is dependent on whether that\n specific field is populated or not. We created a macro to automatically\n generate the CTE. All invalid value tests must have a\n test_category = 'invalid_values' in the catalog seed.\n*/\nwith professional_denominator as (\n\n select\n cast('professional' as TEXT ) as test_denominator_name\n , cast(count(distinct claim_id||data_source) as int) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n\n)\n\n, institutional_denominator as (\n\n select\n cast('institutional' as TEXT ) as test_denominator_name\n , count(distinct claim_id||data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n\n)\n\n, all_claim_denominator as (\n\n select\n cast('all' as TEXT ) as test_denominator_name\n , count(distinct claim_id||data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type is not null\n\n)\n\n, invalid_value_denominators as (\n\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'admit_source_code'\n where rel.admit_source_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'admit_type_code'\n where rel.admit_type_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'apr_drg_code'\n where rel.apr_drg_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'bill_type_code'\n where rel.bill_type_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'billing_npi'\n where rel.billing_npi is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'claim_type'\n where rel.claim_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'diagnosis_code_1'\n where rel.diagnosis_code_1 is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'diagnosis_code_type'\n where rel.diagnosis_code_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'diagnosis_poa_1'\n where rel.diagnosis_poa_1 is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'discharge_disposition_code'\n where rel.discharge_disposition_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'facility_npi'\n where rel.facility_npi is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'ms_drg_code'\n where rel.ms_drg_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'place_of_service_code'\n where rel.place_of_service_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'procedure_code_type'\n where rel.procedure_code_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'rendering_npi'\n where rel.rendering_npi is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.data_quality._value_set_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 = 'revenue_center_code'\n where rel.revenue_center_code is not null\n group by cat.test_name\n \n\n)\n\nselect * from institutional_denominator\nunion all \nselect * from professional_denominator\nunion all\nselect * from all_claim_denominator\nunion all\nselect * from invalid_value_denominators", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_result_stage_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_eligibility.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_eligibility.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_result_stage_eligibility"], "alias": "_int_claims_preprocessing_test_result_stage_eligibility", "checksum": {"name": "sha256", "checksum": "753569040691376d857bdd73fb8791e45075deb95919342a7ee81013f9e6fda1"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_result_stage_eligibility", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_result_stage_eligibility", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.294009, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_test_result_stage_eligibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n/*\n Tests with the category 'invalid_values' are joined to the denominator model\n on test_name since that denominator logic is dependent on whether that\n specific field is populated or not.\n\n All other tests are joined to the denominator model on claim_type.\n*/\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__claims_preprocessing_test_detail') }} det\ninner join {{ ref('data_quality__claims_preprocessing_eligibility_denominators') }} denom\n on det.claim_type = denom.test_denominator_name\nwhere source_table = 'normalized_input__eligibility'\nand test_category <> 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator\n\nunion all\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__claims_preprocessing_test_detail') }} det\ninner join {{ ref('data_quality__claims_preprocessing_eligibility_denominators') }} denom\n on det.test_name = denom.test_denominator_name\nwhere source_table = 'normalized_input__eligibility'\nand test_category = 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_detail"], ["data_quality__claims_preprocessing_eligibility_denominators"], ["data_quality__claims_preprocessing_test_detail"], ["data_quality__claims_preprocessing_eligibility_denominators"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_eligibility.sql", "compiled": true, "compiled_code": "\n/*\n Tests with the category 'invalid_values' are joined to the denominator model\n on test_name since that denominator logic is dependent on whether that\n specific field is populated or not.\n\n All other tests are joined to the denominator model on claim_type.\n*/\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.data_quality.claims_preprocessing_test_detail det\ninner join dev_sarah.data_quality._int_claims_preprocessing_eligibility_denominators denom\n on det.claim_type = denom.test_denominator_name\nwhere source_table = 'normalized_input__eligibility'\nand test_category <> 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator\n\nunion all\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.data_quality.claims_preprocessing_test_detail det\ninner join dev_sarah.data_quality._int_claims_preprocessing_eligibility_denominators denom\n on det.test_name = denom.test_denominator_name\nwhere source_table = 'normalized_input__eligibility'\nand test_category = 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_dates_inst", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates_inst.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates_inst.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_dates_inst"], "alias": "_int_claims_preprocessing_medical_claim_dates_inst", "checksum": {"name": "sha256", "checksum": "6be9a7b6f055b101d3e9c22b9456b0f6cbbc6160ab81b685ad0a18a94789cce3"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_dates_inst", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_dates_inst", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.3881888, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_medical_claim_dates_inst", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set claim_date_column_list = [\n 'admission_date'\n , 'discharge_date'\n] -%}\n\nwith claim_dates as (\n\n {{ medical_claim_date_check(builtins.ref('normalized_input__medical_claim'), claim_date_column_list, 'institutional') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom claim_dates\n left join test_catalog\n on test_catalog.test_name = claim_dates.column_checked||' invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__medical_claim"], ["terminology__calendar"], ["terminology__calendar"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_date_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates_inst.sql", "compiled": true, "compiled_code": "\n\nwith claim_dates as (\n\n select\n claim_id\n , data_source\n , 'admission_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.admission_date = cal.full_date\n where cal.full_date is null\n and rel.admission_date is not null\n and rel.claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'discharge_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.discharge_date = cal.full_date\n where cal.full_date is null\n and rel.discharge_date is not null\n and rel.claim_type = 'institutional'\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom claim_dates\n left join test_catalog\n on test_catalog.test_name = claim_dates.column_checked||' invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_eligibility_denominators", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_denominators.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_denominators.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_eligibility_denominators"], "alias": "_int_claims_preprocessing_eligibility_denominators", "checksum": {"name": "sha256", "checksum": "56012ed85540b96749b6aa611bf2946b4712d502a1025505a6fab8fba8591912"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_eligibility_denominators", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_eligibility_denominators", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.296486, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_eligibility_denominators", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n/*\n Denominator logic for invalid value tests is dependent on whether that\n specific field is populated or not. We created a macro to automatically\n generate the CTE. All invalid value tests must have a\n test_category = 'invalid_values' in the catalog seed.\n*/\nwith all_denominator as (\n\n select\n cast('all' as {{ dbt.type_string() }} ) as test_denominator_name\n , count(distinct patient_id) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('normalized_input__eligibility') }}\n\n)\n\n, invalid_value_denominators as (\n\n {{ eligibility_denominator_invalid_values(builtins.ref('normalized_input__eligibility')) }}\n\n)\n\nselect * from all_denominator\nunion all\nselect * from invalid_value_denominators", "language": "sql", "refs": [["normalized_input__eligibility"], ["normalized_input__eligibility"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.eligibility_denominator_invalid_values"], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_denominators.sql", "compiled": true, "compiled_code": "\n/*\n Denominator logic for invalid value tests is dependent on whether that\n specific field is populated or not. We created a macro to automatically\n generate the CTE. All invalid value tests must have a\n test_category = 'invalid_values' in the catalog seed.\n*/\nwith all_denominator as (\n\n select\n cast('all' as TEXT ) as test_denominator_name\n , count(distinct patient_id) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, invalid_value_denominators as (\n\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_eligibility as rel\n left join dev_sarah.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'dual_status_code'\n where rel.dual_status_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_eligibility as rel\n left join dev_sarah.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'gender'\n where rel.gender is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_eligibility as rel\n left join dev_sarah.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'medicare_status_code'\n where rel.medicare_status_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_eligibility as rel\n left join dev_sarah.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'original_reason_entitlement_code'\n where rel.original_reason_entitlement_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_eligibility as rel\n left join dev_sarah.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'payer_type'\n where rel.payer_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing.normalized_input_eligibility as rel\n left join dev_sarah.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'race'\n where rel.race is not null\n group by cat.test_name\n \n\n)\n\nselect * from all_denominator\nunion all\nselect * from invalid_value_denominators", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_plausibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_plausibility.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_plausibility.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_plausibility"], "alias": "_int_claims_preprocessing_medical_claim_plausibility", "checksum": {"name": "sha256", "checksum": "10f44a5f456acec65c5efd13c52edb1cc815fd756a2449b6fe1058bfaabd1efd"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_plausibility", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_plausibility", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.382228, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_medical_claim_plausibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith medical_claim as (\n\n select *\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, claim_start_date_after_claim_end_date as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'claim_start_date after claim_end_date'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_start_date > medical_claim.claim_end_date\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, admission_date_after_discharge_date as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'admission_date after discharge_date'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and medical_claim.admission_date > medical_claim.discharge_date\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, admission_date_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'admission_date incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.admission_date is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, discharge_date_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'discharge_date incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.discharge_date is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, revenue_center_code_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'revenue_center_code incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.revenue_center_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, institutional_header_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'institutional header-level fields incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and (\n medical_claim.admit_type_code is not null\n or medical_claim.admit_type_code is not null\n or medical_claim.admit_source_code is not null\n or medical_claim.discharge_disposition_code is not null\n or medical_claim.bill_type_code is not null\n or medical_claim.ms_drg_code is not null\n or medical_claim.apr_drg_code is not null\n )\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, place_of_service_code_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'place_of_service_code incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and medical_claim.place_of_service_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from claim_start_date_after_claim_end_date\nunion all\nselect * from admission_date_after_discharge_date\nunion all\nselect * from admission_date_incorrect\nunion all\nselect * from discharge_date_incorrect\nunion all\nselect * from revenue_center_code_incorrect\nunion all\nselect * from institutional_header_incorrect\nunion all\nselect * from place_of_service_code_incorrect", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_plausibility.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select *\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\n, claim_start_date_after_claim_end_date as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'claim_start_date after claim_end_date'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_start_date > medical_claim.claim_end_date\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, admission_date_after_discharge_date as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'admission_date after discharge_date'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and medical_claim.admission_date > medical_claim.discharge_date\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, admission_date_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'admission_date incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.admission_date is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, discharge_date_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'discharge_date incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.discharge_date is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, revenue_center_code_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'revenue_center_code incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.revenue_center_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, institutional_header_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'institutional header-level fields incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and (\n medical_claim.admit_type_code is not null\n or medical_claim.admit_type_code is not null\n or medical_claim.admit_source_code is not null\n or medical_claim.discharge_disposition_code is not null\n or medical_claim.bill_type_code is not null\n or medical_claim.ms_drg_code is not null\n or medical_claim.apr_drg_code is not null\n )\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, place_of_service_code_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'place_of_service_code incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and medical_claim.place_of_service_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from claim_start_date_after_claim_end_date\nunion all\nselect * from admission_date_after_discharge_date\nunion all\nselect * from admission_date_incorrect\nunion all\nselect * from discharge_date_incorrect\nunion all\nselect * from revenue_center_code_incorrect\nunion all\nselect * from institutional_header_incorrect\nunion all\nselect * from place_of_service_code_incorrect", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_duplicates", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_duplicates.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_duplicates.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_duplicates"], "alias": "_int_claims_preprocessing_medical_claim_duplicates", "checksum": {"name": "sha256", "checksum": "2fbf09a6f1e10336741cd2b4ed5c173232e22a3add41a4d91e6050f597300429"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_duplicates", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_duplicates", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.3625941, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_medical_claim_duplicates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }}\n left join test_catalog\n on test_catalog.test_name = 'duplicate medical claims'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_id\n , claim_line_number\n , data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "language": "sql", "refs": [["data_quality__test_catalog"], ["normalized_input__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.data_quality__test_catalog", "model.the_tuva_project.normalized_input__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_duplicates.sql", "compiled": true, "compiled_code": "\n\nwith test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n left join test_catalog\n on test_catalog.test_name = 'duplicate medical claims'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_id\n , claim_line_number\n , data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_dates"], "alias": "_int_claims_preprocessing_medical_claim_dates", "checksum": {"name": "sha256", "checksum": "3fb80a26a99074269c5d81b49d39e18c36c8c3a4cf9b6696d0a68a9e9dd32dea"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_dates", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_dates", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.385674, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_medical_claim_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set claim_date_column_list = [\n 'claim_start_date'\n , 'claim_end_date'\n , 'claim_line_start_date'\n , 'claim_line_end_date'\n , 'paid_date'\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] -%}\n\nwith claim_dates as (\n\n {{ medical_claim_date_check(builtins.ref('normalized_input__medical_claim'), claim_date_column_list) }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom claim_dates\n left join test_catalog\n on test_catalog.test_name = claim_dates.column_checked||' invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__medical_claim"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_date_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_dates.sql", "compiled": true, "compiled_code": "\n\nwith claim_dates as (\n\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.claim_start_date = cal.full_date\n where cal.full_date is null\n and rel.claim_start_date is not null\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.claim_end_date = cal.full_date\n where cal.full_date is null\n and rel.claim_end_date is not null\n union all\n select\n claim_id\n , data_source\n , 'claim_line_start_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.claim_line_start_date = cal.full_date\n where cal.full_date is null\n and rel.claim_line_start_date is not null\n union all\n select\n claim_id\n , data_source\n , 'claim_line_end_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.claim_line_end_date = cal.full_date\n where cal.full_date is null\n and rel.claim_line_end_date is not null\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.paid_date = cal.full_date\n where cal.full_date is null\n and rel.paid_date is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_1' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_1 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_1 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_2' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_2 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_2 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_3' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_3 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_3 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_4' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_4 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_4 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_5' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_5 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_5 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_6' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_6 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_6 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_7' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_7 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_7 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_8' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_8 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_8 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_9' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_9 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_9 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_10' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_10 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_10 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_11' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_11 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_11 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_12' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_12 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_12 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_13' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_13 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_13 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_14' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_14 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_14 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_15' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_15 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_15 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_16' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_16 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_16 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_17' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_17 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_17 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_18' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_18 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_18 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_19' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_19 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_19 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_20' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_20 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_20 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_21' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_21 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_21 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_22' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_22 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_22 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_23' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_23 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_23 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_24' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_24 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_24 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_25' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim as rel\n left join dev_sarah.terminology.calendar as cal\n on rel.procedure_date_25 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_25 is not null\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom claim_dates\n left join test_catalog\n on test_catalog.test_name = claim_dates.column_checked||' invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_institutional_header_fail_details", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_institutional_header_fail_details.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_institutional_header_fail_details.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_institutional_header_fail_details"], "alias": "_int_claims_preprocessing_institutional_header_fail_details", "checksum": {"name": "sha256", "checksum": "75f3a4e11c345a50688ca8c027aa7d06520d0455bd39c2bee57cde06a7bbcb14"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_institutional_header_fail_details", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_institutional_header_fail_details", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.3066518, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_institutional_header_fail_details", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set institutional_header_column_list = [\n 'claim_id'\n , 'claim_type'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'admission_date'\n , 'discharge_date'\n , 'admit_source_code'\n , 'admit_type_code'\n , 'discharge_disposition_code'\n , 'bill_type_code'\n , 'ms_drg_code'\n , 'facility_npi'\n , 'billing_npi'\n , 'rendering_npi'\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] -%}\n\n\nwith institutional_header_duplicates as (\n\n {{ medical_claim_header_duplicate_check(builtins.ref('normalized_input__medical_claim'), institutional_header_column_list, 'institutional') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , institutional_header_duplicates.claim_id\n , institutional_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom institutional_header_duplicates\n left join test_catalog\n on test_catalog.test_name = institutional_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n and test_catalog.claim_type = 'institutional'\ngroup by \n institutional_header_duplicates.claim_id\n , institutional_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_header_duplicate_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_institutional_header_fail_details.sql", "compiled": true, "compiled_code": "\n\nwith institutional_header_duplicates as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n , count(distinct claim_id) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_type' as column_checked\n , count(distinct claim_type) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n , count(distinct patient_id) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct patient_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n , count(distinct member_id) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct member_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n , count(distinct payer) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct payer) > 1\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n , count(distinct plan) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct plan) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n , count(distinct claim_start_date) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_start_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n , count(distinct claim_end_date) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_end_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'admission_date' as column_checked\n , count(distinct admission_date) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct admission_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'discharge_date' as column_checked\n , count(distinct discharge_date) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct discharge_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'admit_source_code' as column_checked\n , count(distinct admit_source_code) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct admit_source_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'admit_type_code' as column_checked\n , count(distinct admit_type_code) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct admit_type_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'discharge_disposition_code' as column_checked\n , count(distinct discharge_disposition_code) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct discharge_disposition_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_checked\n , count(distinct bill_type_code) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct bill_type_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'ms_drg_code' as column_checked\n , count(distinct ms_drg_code) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct ms_drg_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'facility_npi' as column_checked\n , count(distinct facility_npi) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct facility_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n , count(distinct billing_npi) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct billing_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'rendering_npi' as column_checked\n , count(distinct rendering_npi) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct rendering_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n , count(distinct diagnosis_code_type) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n , count(distinct diagnosis_code_1) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_2' as column_checked\n , count(distinct diagnosis_code_2) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_3' as column_checked\n , count(distinct diagnosis_code_3) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_4' as column_checked\n , count(distinct diagnosis_code_4) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_5' as column_checked\n , count(distinct diagnosis_code_5) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_6' as column_checked\n , count(distinct diagnosis_code_6) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_7' as column_checked\n , count(distinct diagnosis_code_7) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_8' as column_checked\n , count(distinct diagnosis_code_8) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_9' as column_checked\n , count(distinct diagnosis_code_9) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_10' as column_checked\n , count(distinct diagnosis_code_10) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_11' as column_checked\n , count(distinct diagnosis_code_11) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_12' as column_checked\n , count(distinct diagnosis_code_12) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_13' as column_checked\n , count(distinct diagnosis_code_13) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_14' as column_checked\n , count(distinct diagnosis_code_14) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_15' as column_checked\n , count(distinct diagnosis_code_15) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_16' as column_checked\n , count(distinct diagnosis_code_16) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_17' as column_checked\n , count(distinct diagnosis_code_17) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_18' as column_checked\n , count(distinct diagnosis_code_18) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_19' as column_checked\n , count(distinct diagnosis_code_19) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_20' as column_checked\n , count(distinct diagnosis_code_20) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_21' as column_checked\n , count(distinct diagnosis_code_21) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_22' as column_checked\n , count(distinct diagnosis_code_22) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_23' as column_checked\n , count(distinct diagnosis_code_23) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_24' as column_checked\n , count(distinct diagnosis_code_24) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_25' as column_checked\n , count(distinct diagnosis_code_25) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_1' as column_checked\n , count(distinct diagnosis_poa_1) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_2' as column_checked\n , count(distinct diagnosis_poa_2) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_3' as column_checked\n , count(distinct diagnosis_poa_3) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_4' as column_checked\n , count(distinct diagnosis_poa_4) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_5' as column_checked\n , count(distinct diagnosis_poa_5) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_6' as column_checked\n , count(distinct diagnosis_poa_6) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_7' as column_checked\n , count(distinct diagnosis_poa_7) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_8' as column_checked\n , count(distinct diagnosis_poa_8) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_9' as column_checked\n , count(distinct diagnosis_poa_9) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_10' as column_checked\n , count(distinct diagnosis_poa_10) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_11' as column_checked\n , count(distinct diagnosis_poa_11) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_12' as column_checked\n , count(distinct diagnosis_poa_12) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_13' as column_checked\n , count(distinct diagnosis_poa_13) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_14' as column_checked\n , count(distinct diagnosis_poa_14) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_15' as column_checked\n , count(distinct diagnosis_poa_15) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_16' as column_checked\n , count(distinct diagnosis_poa_16) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_17' as column_checked\n , count(distinct diagnosis_poa_17) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_18' as column_checked\n , count(distinct diagnosis_poa_18) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_19' as column_checked\n , count(distinct diagnosis_poa_19) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_20' as column_checked\n , count(distinct diagnosis_poa_20) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_21' as column_checked\n , count(distinct diagnosis_poa_21) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_22' as column_checked\n , count(distinct diagnosis_poa_22) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_23' as column_checked\n , count(distinct diagnosis_poa_23) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_24' as column_checked\n , count(distinct diagnosis_poa_24) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_25' as column_checked\n , count(distinct diagnosis_poa_25) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_type' as column_checked\n , count(distinct procedure_code_type) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_1' as column_checked\n , count(distinct procedure_code_1) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_2' as column_checked\n , count(distinct procedure_code_2) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_3' as column_checked\n , count(distinct procedure_code_3) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_4' as column_checked\n , count(distinct procedure_code_4) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_5' as column_checked\n , count(distinct procedure_code_5) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_6' as column_checked\n , count(distinct procedure_code_6) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_7' as column_checked\n , count(distinct procedure_code_7) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_8' as column_checked\n , count(distinct procedure_code_8) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_9' as column_checked\n , count(distinct procedure_code_9) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_10' as column_checked\n , count(distinct procedure_code_10) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_11' as column_checked\n , count(distinct procedure_code_11) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_12' as column_checked\n , count(distinct procedure_code_12) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_13' as column_checked\n , count(distinct procedure_code_13) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_14' as column_checked\n , count(distinct procedure_code_14) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_15' as column_checked\n , count(distinct procedure_code_15) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_16' as column_checked\n , count(distinct procedure_code_16) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_17' as column_checked\n , count(distinct procedure_code_17) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_18' as column_checked\n , count(distinct procedure_code_18) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_19' as column_checked\n , count(distinct procedure_code_19) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_20' as column_checked\n , count(distinct procedure_code_20) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_21' as column_checked\n , count(distinct procedure_code_21) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_22' as column_checked\n , count(distinct procedure_code_22) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_23' as column_checked\n , count(distinct procedure_code_23) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_24' as column_checked\n , count(distinct procedure_code_24) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_25' as column_checked\n , count(distinct procedure_code_25) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_1' as column_checked\n , count(distinct procedure_date_1) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_2' as column_checked\n , count(distinct procedure_date_2) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_3' as column_checked\n , count(distinct procedure_date_3) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_4' as column_checked\n , count(distinct procedure_date_4) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_5' as column_checked\n , count(distinct procedure_date_5) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_6' as column_checked\n , count(distinct procedure_date_6) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_7' as column_checked\n , count(distinct procedure_date_7) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_8' as column_checked\n , count(distinct procedure_date_8) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_9' as column_checked\n , count(distinct procedure_date_9) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_10' as column_checked\n , count(distinct procedure_date_10) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_11' as column_checked\n , count(distinct procedure_date_11) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_12' as column_checked\n , count(distinct procedure_date_12) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_13' as column_checked\n , count(distinct procedure_date_13) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_14' as column_checked\n , count(distinct procedure_date_14) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_15' as column_checked\n , count(distinct procedure_date_15) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_16' as column_checked\n , count(distinct procedure_date_16) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_17' as column_checked\n , count(distinct procedure_date_17) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_18' as column_checked\n , count(distinct procedure_date_18) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_19' as column_checked\n , count(distinct procedure_date_19) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_20' as column_checked\n , count(distinct procedure_date_20) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_21' as column_checked\n , count(distinct procedure_date_21) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_22' as column_checked\n , count(distinct procedure_date_22) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_23' as column_checked\n , count(distinct procedure_date_23) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_24' as column_checked\n , count(distinct procedure_date_24) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_25' as column_checked\n , count(distinct procedure_date_25) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n , count(distinct data_source) as duplicate_count\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct data_source) > 1\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , institutional_header_duplicates.claim_id\n , institutional_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom institutional_header_duplicates\n left join test_catalog\n on test_catalog.test_name = institutional_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n and test_catalog.claim_type = 'institutional'\ngroup by \n institutional_header_duplicates.claim_id\n , institutional_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_line_numbers.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_line_numbers.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_pharmacy_claim_line_numbers"], "alias": "_int_claims_preprocessing_pharmacy_claim_line_numbers", "checksum": {"name": "sha256", "checksum": "1c91805299434e6ad218c8c6152f060e7c0d39beb06b79043036893c8664f15d"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_pharmacy_claim_line_numbers", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_pharmacy_claim_line_numbers", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.3963342, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_pharmacy_claim_line_numbers", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith pharmacy_claim as (\n\n select\n claim_id\n , claim_line_number\n , data_source\n from {{ ref('normalized_input__pharmacy_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, add_row_num as (\n\n select\n claim_id\n , data_source\n , claim_line_number\n , row_number() over (\n partition by claim_id, data_source\n order by claim_line_number\n ) as expected_line_number\n from pharmacy_claim\n\n)\n\n, line_num_check as (\n\n select\n add_row_num.claim_id\n , add_row_num.data_source\n , add_row_num.claim_line_number\n , add_row_num.expected_line_number\n from add_row_num\n left join pharmacy_claim\n on add_row_num.claim_id = pharmacy_claim.claim_id\n and add_row_num.data_source = pharmacy_claim.data_source\n and add_row_num.expected_line_number = pharmacy_claim.claim_line_number\n where pharmacy_claim.claim_line_number is null\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom line_num_check\n left join test_catalog\n on test_catalog.test_name = 'claim_line_number non-sequential'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__pharmacy_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_line_numbers.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n\n select\n claim_id\n , claim_line_number\n , data_source\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\n, add_row_num as (\n\n select\n claim_id\n , data_source\n , claim_line_number\n , row_number() over (\n partition by claim_id, data_source\n order by claim_line_number\n ) as expected_line_number\n from pharmacy_claim\n\n)\n\n, line_num_check as (\n\n select\n add_row_num.claim_id\n , add_row_num.data_source\n , add_row_num.claim_line_number\n , add_row_num.expected_line_number\n from add_row_num\n left join pharmacy_claim\n on add_row_num.claim_id = pharmacy_claim.claim_id\n and add_row_num.data_source = pharmacy_claim.data_source\n and add_row_num.expected_line_number = pharmacy_claim.claim_line_number\n where pharmacy_claim.claim_line_number is null\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom line_num_check\n left join test_catalog\n on test_catalog.test_name = 'claim_line_number non-sequential'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_detail_stage_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_medical_claim.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_medical_claim.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "alias": "_int_claims_preprocessing_test_detail_stage_medical_claim", "checksum": {"name": "sha256", "checksum": "a294751cfd6776ad5e75e9047166ad87cebec0c639e759d01d851f31de155c19"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_detail_stage_medical_claim", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_detail_stage_medical_claim", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.391021, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_test_detail_stage_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n \nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_institutional_header_fail_details') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_professional_header_fail_details') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_inst_missing_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_prof_missing_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_invalid_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_claim_type_unmapped') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_claim_type_mapping_failures') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_duplicates') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_plausibility') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_dates') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_dates_inst') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_line_numbers') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_medical_claim_invalid_npi') }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_institutional_header_fail_details"], ["data_quality__claims_preprocessing_professional_header_fail_details"], ["data_quality__claims_preprocessing_medical_claim_inst_missing_values"], ["data_quality__claims_preprocessing_medical_claim_prof_missing_values"], ["data_quality__claims_preprocessing_medical_claim_invalid_values"], ["data_quality__claims_preprocessing_claim_type_unmapped"], ["data_quality__claims_preprocessing_claim_type_mapping_failures"], ["data_quality__claims_preprocessing_medical_claim_duplicates"], ["data_quality__claims_preprocessing_medical_claim_plausibility"], ["data_quality__claims_preprocessing_medical_claim_dates"], ["data_quality__claims_preprocessing_medical_claim_dates_inst"], ["data_quality__claims_preprocessing_medical_claim_line_numbers"], ["data_quality__claims_preprocessing_medical_claim_invalid_npi"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_medical_claim.sql", "compiled": true, "compiled_code": "\n \nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_institutional_header_fail_details\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_professional_header_fail_details\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_medical_claim_invalid_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_claim_type_unmapped\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_claim_type_mapping_failures\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_medical_claim_duplicates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_medical_claim_plausibility\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_medical_claim_dates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_medical_claim_dates_inst\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_medical_claim_line_numbers\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_medical_claim_invalid_npi", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_claim_type_mapping_failures", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_mapping_failures.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_mapping_failures.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_claim_type_mapping_failures"], "alias": "_int_claims_preprocessing_claim_type_mapping_failures", "checksum": {"name": "sha256", "checksum": "c7f9f6ece097d661fdd2ebaaae833e508a840e267a9743c4157db3a6806ef18f"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_claim_type_mapping_failures", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_claim_type_mapping_failures", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.360375, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_claim_type_mapping_failures", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith claim_type_mapping as (\n\n select \n claim_id\n , claim_line_number\n , data_source\n , claim_type as source_claim_type\n , case\n when bill_type_code is not null or revenue_center_code is not null \n then 'institutional'\n when place_of_service_code is not null\n then 'professional'\n else null\n end as data_profiling_claim_type\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_type_mapping.claim_id\n , claim_type_mapping.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom claim_type_mapping\n left join test_catalog\n on test_catalog.test_name = 'claim_type mapping incorrect'\n and test_catalog.source_table = 'normalized_input__medical_claim'\nwhere claim_type_mapping.source_claim_type <> claim_type_mapping.data_profiling_claim_type\ngroup by\n claim_type_mapping.claim_id\n , claim_type_mapping.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_claim_type_mapping_failures.sql", "compiled": true, "compiled_code": "\n\nwith claim_type_mapping as (\n\n select \n claim_id\n , claim_line_number\n , data_source\n , claim_type as source_claim_type\n , case\n when bill_type_code is not null or revenue_center_code is not null \n then 'institutional'\n when place_of_service_code is not null\n then 'professional'\n else null\n end as data_profiling_claim_type\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_type_mapping.claim_id\n , claim_type_mapping.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom claim_type_mapping\n left join test_catalog\n on test_catalog.test_name = 'claim_type mapping incorrect'\n and test_catalog.source_table = 'normalized_input__medical_claim'\nwhere claim_type_mapping.source_claim_type <> claim_type_mapping.data_profiling_claim_type\ngroup by\n claim_type_mapping.claim_id\n , claim_type_mapping.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_prof_missing_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_prof_missing_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_prof_missing_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_prof_missing_values"], "alias": "_int_claims_preprocessing_medical_claim_prof_missing_values", "checksum": {"name": "sha256", "checksum": "8b0cea71d418a60bb765be2656c3f410adee4e57ea7cef3e1206a13d7b61a551"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_prof_missing_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_prof_missing_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.3577821, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set professional_missing_column_list = [\n 'claim_id'\n , 'claim_line_number'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'place_of_service_code'\n , 'hcpcs_code'\n , 'rendering_npi'\n , 'billing_npi'\n , 'paid_date'\n , 'paid_amount'\n , 'diagnosis_code_type'\n , 'diagnosis_code_1'\n , 'data_source'\n] -%}\n\nwith professional_missing as (\n\n {{ medical_claim_missing_column_check(builtins.ref('normalized_input__medical_claim'), professional_missing_column_list, 'professional') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'professional' as claim_type\n , 'claim_id' as grain\n , professional_missing.claim_id\n , professional_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom professional_missing\n left join test_catalog\n on test_catalog.test_name = professional_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n professional_missing.claim_id\n , professional_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.medical_claim_missing_column_check"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_prof_missing_values.sql", "compiled": true, "compiled_code": "\n\nwith professional_missing as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_id is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'claim_line_number' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_line_number is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where patient_id is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where member_id is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where payer is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where plan is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_start_date is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where claim_end_date is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'place_of_service_code' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where place_of_service_code is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'hcpcs_code' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where hcpcs_code is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'rendering_npi' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where rendering_npi is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where billing_npi is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where paid_date is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'paid_amount' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where paid_amount is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_type is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_1 is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n where data_source is null\n and claim_type = 'professional'\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'professional' as claim_type\n , 'claim_id' as grain\n , professional_missing.claim_id\n , professional_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom professional_missing\n left join test_catalog\n on test_catalog.test_name = professional_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n professional_missing.claim_id\n , professional_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_pharmacy_claim_missing_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_missing_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_missing_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_pharmacy_claim_missing_values"], "alias": "_int_claims_preprocessing_pharmacy_claim_missing_values", "checksum": {"name": "sha256", "checksum": "0d9d6bdf7d07d356c3e5d413309250d0390bcebf13191d438073ec4bbd15caab"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_pharmacy_claim_missing_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_pharmacy_claim_missing_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.398746, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_pharmacy_claim_missing_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n{% set pharmacy_claim_missing_column_list = [\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 , 'data_source'\n] -%}\n\nwith pharmacy_claim_missing as (\n\n {{ pharmacy_claim_missing_column_check(builtins.ref('normalized_input__pharmacy_claim'), pharmacy_claim_missing_column_list) }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , pharmacy_claim_missing.claim_id\n , pharmacy_claim_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom pharmacy_claim_missing\n left join test_catalog\n on test_catalog.test_name = pharmacy_claim_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n pharmacy_claim_missing.claim_id\n , pharmacy_claim_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__pharmacy_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.pharmacy_claim_missing_column_check"], "nodes": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_pharmacy_claim_missing_values.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim_missing as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where claim_id is null\n union all\n select\n claim_id\n , data_source\n , 'claim_line_number' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where claim_line_number is null\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where patient_id is null\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where member_id is null\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where payer is null\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where plan is null\n union all\n select\n claim_id\n , data_source\n , 'prescribing_provider_npi' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where prescribing_provider_npi is null\n union all\n select\n claim_id\n , data_source\n , 'dispensing_provider_npi' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where dispensing_provider_npi is null\n union all\n select\n claim_id\n , data_source\n , 'dispensing_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where dispensing_date is null\n union all\n select\n claim_id\n , data_source\n , 'ndc_code' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where ndc_code is null\n union all\n select\n claim_id\n , data_source\n , 'quantity' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where quantity is null\n union all\n select\n claim_id\n , data_source\n , 'days_supply' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where days_supply is null\n union all\n select\n claim_id\n , data_source\n , 'refills' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where refills is null\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where paid_date is null\n union all\n select\n claim_id\n , data_source\n , 'paid_amount' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where paid_amount is null\n union all\n select\n claim_id\n , data_source\n , 'allowed_amount' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where allowed_amount is null\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n from dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim\n where data_source is null\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , pharmacy_claim_missing.claim_id\n , pharmacy_claim_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom pharmacy_claim_missing\n left join test_catalog\n on test_catalog.test_name = pharmacy_claim_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n pharmacy_claim_missing.claim_id\n , pharmacy_claim_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_medical_claim_line_numbers", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_line_numbers.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_line_numbers.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_medical_claim_line_numbers"], "alias": "_int_claims_preprocessing_medical_claim_line_numbers", "checksum": {"name": "sha256", "checksum": "deef4d1bde66ded6dd64f62752f9897f3468af41277dde6023a1db235a7dbee0"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_medical_claim_line_numbers", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_medical_claim_line_numbers", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.3495638, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_medical_claim_line_numbers", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith medical_claim as (\n\n select\n claim_id\n , claim_line_number\n , data_source\n from {{ ref('normalized_input__medical_claim') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, add_row_num as (\n\n select\n claim_id\n , data_source\n , claim_line_number\n , row_number() over (\n partition by claim_id, data_source\n order by claim_line_number\n ) as expected_line_number\n from medical_claim\n\n)\n\n, line_num_check as (\n\n select\n add_row_num.claim_id\n , add_row_num.data_source\n , add_row_num.claim_line_number\n , add_row_num.expected_line_number\n from add_row_num\n left join medical_claim\n on add_row_num.claim_id = medical_claim.claim_id\n and add_row_num.data_source = medical_claim.data_source\n and add_row_num.expected_line_number = medical_claim.claim_line_number\n where medical_claim.claim_line_number is null\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom line_num_check\n left join test_catalog\n on test_catalog.test_name = 'claim_line_number non-sequential'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "language": "sql", "refs": [["normalized_input__medical_claim"], ["data_quality__test_catalog"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_medical_claim_line_numbers.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select\n claim_id\n , claim_line_number\n , data_source\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\n, add_row_num as (\n\n select\n claim_id\n , data_source\n , claim_line_number\n , row_number() over (\n partition by claim_id, data_source\n order by claim_line_number\n ) as expected_line_number\n from medical_claim\n\n)\n\n, line_num_check as (\n\n select\n add_row_num.claim_id\n , add_row_num.data_source\n , add_row_num.claim_line_number\n , add_row_num.expected_line_number\n from add_row_num\n left join medical_claim\n on add_row_num.claim_id = medical_claim.claim_id\n and add_row_num.data_source = medical_claim.data_source\n and add_row_num.expected_line_number = medical_claim.claim_line_number\n where medical_claim.claim_line_number is null\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom line_num_check\n left join test_catalog\n on test_catalog.test_name = 'claim_line_number non-sequential'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "alias": "_int_claims_preprocessing_test_detail_stage_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "15aa4ab74653536059fe3a74860ddba1dda096a19e3b91c99cc5dfd8dfa9a52a"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_detail_stage_pharmacy_claim", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_detail_stage_pharmacy_claim", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.403475, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_test_detail_stage_pharmacy_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_pharmacy_claim_duplicates') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_pharmacy_claim_missing_values') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_pharmacy_header_fail_details') }}\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom {{ ref('data_quality__claims_preprocessing_pharmacy_claim_line_numbers') }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_pharmacy_claim_duplicates"], ["data_quality__claims_preprocessing_pharmacy_claim_missing_values"], ["data_quality__claims_preprocessing_pharmacy_header_fail_details"], ["data_quality__claims_preprocessing_pharmacy_claim_line_numbers"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_pharmacy_claim_duplicates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_pharmacy_claim_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_pharmacy_header_fail_details\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom dev_sarah.data_quality._int_claims_preprocessing_pharmacy_claim_line_numbers", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_test_result_stage_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_medical_claim.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_medical_claim.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_test_result_stage_medical_claim"], "alias": "_int_claims_preprocessing_test_result_stage_medical_claim", "checksum": {"name": "sha256", "checksum": "b82452396dfd23506edfaf91e86b508fc39c9816457fa20ca576fd56e9fd2694"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_test_result_stage_medical_claim", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_test_result_stage_medical_claim", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.366775, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_test_result_stage_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n/*\n Tests with the category 'invalid_values' are joined to the denominator model\n on test_name since that denominator logic is dependent on whether that\n specific field is populated or not.\n\n All other tests are joined to the denominator model on claim_type.\n*/\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__claims_preprocessing_test_detail') }} det\ninner join {{ ref('data_quality__claims_preprocessing_medical_claim_denominators') }} denom\n on det.claim_type = denom.test_denominator_name\nwhere source_table = 'normalized_input__medical_claim'\nand test_category <> 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator\n\nunion all\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__claims_preprocessing_test_detail') }} det\ninner join {{ ref('data_quality__claims_preprocessing_medical_claim_denominators') }} denom\n on det.test_name = denom.test_denominator_name\nwhere source_table = 'normalized_input__medical_claim'\nand test_category = 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_detail"], ["data_quality__claims_preprocessing_medical_claim_denominators"], ["data_quality__claims_preprocessing_test_detail"], ["data_quality__claims_preprocessing_medical_claim_denominators"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_test_result_stage_medical_claim.sql", "compiled": true, "compiled_code": "\n/*\n Tests with the category 'invalid_values' are joined to the denominator model\n on test_name since that denominator logic is dependent on whether that\n specific field is populated or not.\n\n All other tests are joined to the denominator model on claim_type.\n*/\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.data_quality.claims_preprocessing_test_detail det\ninner join dev_sarah.data_quality._int_claims_preprocessing_medical_claim_denominators denom\n on det.claim_type = denom.test_denominator_name\nwhere source_table = 'normalized_input__medical_claim'\nand test_category <> 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator\n\nunion all\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.data_quality.claims_preprocessing_test_detail det\ninner join dev_sarah.data_quality._int_claims_preprocessing_medical_claim_denominators denom\n on det.test_name = denom.test_denominator_name\nwhere source_table = 'normalized_input__medical_claim'\nand test_category = 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claims_preprocessing_eligibility_invalid_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_invalid_values.sql", "original_file_path": "models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_invalid_values.sql", "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing", "intermediate", "data_quality__claims_preprocessing_eligibility_invalid_values"], "alias": "_int_claims_preprocessing_eligibility_invalid_values", "checksum": {"name": "sha256", "checksum": "9439c228ea9e3e4d6899e36323d5ffd13bc9245eb6aedf2dafa9a6880ccdaa86"}, "config": {"enabled": true, "alias": "_int_claims_preprocessing_eligibility_invalid_values", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_int_claims_preprocessing_eligibility_invalid_values", "tags": ["data_quality", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#141161"}}, "created_at": 1708545506.288662, "relation_name": "dev_sarah.data_quality._int_claims_preprocessing_eligibility_invalid_values", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith eligiblity as (\n\n select *\n from {{ ref('normalized_input__eligibility') }}\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from {{ ref('data_quality__test_catalog') }}\n\n)\n\n, valid_gender as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.gender\n , count(eligiblity.gender) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__gender') }} gender\n on eligiblity.gender = gender.gender\n left join test_catalog\n on test_catalog.test_name = 'gender invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where gender.gender is null\n and eligiblity.gender is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.gender\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_race as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.race\n , count(eligiblity.race) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__race') }} race\n on eligiblity.race = race.description\n left join test_catalog\n on test_catalog.test_name = 'race invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where race.description is null\n and eligiblity.race is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.race\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_payer_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.payer_type\n , count(eligiblity.payer_type) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__payer_type') }} payer\n on eligiblity.payer_type = payer.payer_type\n left join test_catalog\n on test_catalog.test_name = 'payer_type invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where payer.payer_type is null\n and eligiblity.payer_type is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.payer_type\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_orec as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.original_reason_entitlement_code\n , count(eligiblity.original_reason_entitlement_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__medicare_orec') }} orec\n on eligiblity.original_reason_entitlement_code = orec.original_reason_entitlement_code\n left join test_catalog\n on test_catalog.test_name = 'original_reason_entitlement_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where orec.original_reason_entitlement_code is null\n and eligiblity.original_reason_entitlement_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.original_reason_entitlement_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_dual_status_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.dual_status_code\n , count(eligiblity.dual_status_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__medicare_dual_eligibility') }} dual\n on eligiblity.dual_status_code = dual.dual_status_code\n left join test_catalog\n on test_catalog.test_name = 'dual_status_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where dual.dual_status_code is null\n and eligiblity.dual_status_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.dual_status_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_medicare_status_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.medicare_status_code\n , count(eligiblity.medicare_status_code) as filled_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from eligiblity\n left join {{ ref('terminology__medicare_status') }} status\n on eligiblity.medicare_status_code = status.medicare_status_code\n left join test_catalog\n on test_catalog.test_name = 'medicare_status_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where status.medicare_status_code is null\n and eligiblity.medicare_status_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.medicare_status_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_gender\nunion all\nselect * from valid_race\nunion all\nselect * from valid_payer_type\nunion all\nselect * from valid_orec\nunion all\nselect * from valid_dual_status_code\nunion all\nselect * from valid_medicare_status_code", "language": "sql", "refs": [["normalized_input__eligibility"], ["data_quality__test_catalog"], ["terminology__gender"], ["terminology__race"], ["terminology__payer_type"], ["terminology__medicare_orec"], ["terminology__medicare_dual_eligibility"], ["terminology__medicare_status"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__gender", "seed.the_tuva_project.terminology__race", "seed.the_tuva_project.terminology__payer_type", "seed.the_tuva_project.terminology__medicare_orec", "seed.the_tuva_project.terminology__medicare_dual_eligibility", "seed.the_tuva_project.terminology__medicare_status"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/claims_preprocessing/intermediate/data_quality__claims_preprocessing_eligibility_invalid_values.sql", "compiled": true, "compiled_code": "\n\nwith eligiblity as (\n\n select *\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from dev_sarah.data_quality._value_set_test_catalog\n\n)\n\n, valid_gender as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.gender\n , count(eligiblity.gender) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join dev_sarah.terminology.gender gender\n on eligiblity.gender = gender.gender\n left join test_catalog\n on test_catalog.test_name = 'gender invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where gender.gender is null\n and eligiblity.gender is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.gender\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_race as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.race\n , count(eligiblity.race) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join dev_sarah.terminology.race race\n on eligiblity.race = race.description\n left join test_catalog\n on test_catalog.test_name = 'race invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where race.description is null\n and eligiblity.race is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.race\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_payer_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.payer_type\n , count(eligiblity.payer_type) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join dev_sarah.terminology.payer_type payer\n on eligiblity.payer_type = payer.payer_type\n left join test_catalog\n on test_catalog.test_name = 'payer_type invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where payer.payer_type is null\n and eligiblity.payer_type is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.payer_type\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_orec as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.original_reason_entitlement_code\n , count(eligiblity.original_reason_entitlement_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join dev_sarah.terminology.medicare_orec orec\n on eligiblity.original_reason_entitlement_code = orec.original_reason_entitlement_code\n left join test_catalog\n on test_catalog.test_name = 'original_reason_entitlement_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where orec.original_reason_entitlement_code is null\n and eligiblity.original_reason_entitlement_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.original_reason_entitlement_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_dual_status_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.dual_status_code\n , count(eligiblity.dual_status_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join dev_sarah.terminology.medicare_dual_eligibility dual\n on eligiblity.dual_status_code = dual.dual_status_code\n left join test_catalog\n on test_catalog.test_name = 'dual_status_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where dual.dual_status_code is null\n and eligiblity.dual_status_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.dual_status_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_medicare_status_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.medicare_status_code\n , count(eligiblity.medicare_status_code) as filled_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from eligiblity\n left join dev_sarah.terminology.medicare_status status\n on eligiblity.medicare_status_code = status.medicare_status_code\n left join test_catalog\n on test_catalog.test_name = 'medicare_status_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where status.medicare_status_code is null\n and eligiblity.medicare_status_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.medicare_status_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_gender\nunion all\nselect * from valid_race\nunion all\nselect * from valid_payer_type\nunion all\nselect * from valid_orec\nunion all\nselect * from valid_dual_status_code\nunion all\nselect * from valid_medicare_status_code", "extra_ctes_injected": true, "extra_ctes": []}, "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": "30b001c3fe63f86b5238b8a4e5fce8c14208440e4b7c1946ac88cab63d6ecf34"}, "config": {"enabled": true, "alias": null, "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["ed_classification"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.4406028, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\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": [["core__patient"]], "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": []}, "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": "1fe06aa48203595e38fc761b7637348e5538505e33cf0d53cd02badfbaffed19"}, "config": {"enabled": true, "alias": null, "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["ed_classification"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.4385622, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect\r\n encounter_id\r\n , encounter_type\r\n , patient_id\r\n , encounter_end_date\r\n , facility_npi\r\n , primary_diagnosis_code_type\r\n , primary_diagnosis_code\r\n , primary_diagnosis_description\r\n , paid_amount\r\n , allowed_amount\r\n , charge_amount\r\nfrom {{ ref('core__encounter') }}", "language": "sql", "refs": [["core__encounter"]], "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_npi\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": []}, "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": "e95bb468c0709061684f593b4b665f67ebfdcb177b59bb9f14acad482579df1c"}, "config": {"enabled": true, "alias": "summary", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the patient was discharged.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Year and month of the encounter end date.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total paid amount across all claims for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total allowed amount across all claims for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total charge amount across all claims for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "The NPI 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, "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "The name of the facility.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "facility_state": {"name": "facility_state", "description": "The state of the facility.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "facility_city": {"name": "facility_city", "description": "The city of the facility.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "facility_zip_code": {"name": "facility_zip_code", "description": "The zip code of the facility.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "patient_age": {"name": "patient_age", "description": "The age of the patient at the time of the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_zip_code": {"name": "patient_zip_code", "description": "The zip code for the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_latitude": {"name": "patient_latitude", "description": "The latitude for the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_longitude": {"name": "patient_longitude", "description": "The longitude for the patient.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.4313338, "relation_name": "dev_sarah.ed_classification.summary", "raw_code": "{{ config(\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 , cast({{ date_part(\"year\", \"class.encounter_end_date\") }} as {{ dbt.type_string() }}) \n || right('0'||cast({{ date_part(\"month\", \"class.encounter_end_date\") }} as {{ dbt.type_string() }}),2) \n 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_npi\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-- , null as facility_latitude\n-- , null as facility_longitude\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 using(classification)\nleft join {{ ref('terminology__provider') }} fac_prov \n on class.facility_npi = fac_prov.npi\nleft join {{ ref('ed_classification__stg_patient') }} pat\n on class.patient_id = pat.patient_id", "language": "sql", "refs": [["ed_classification__int_filter_encounter_with_classification"], ["ed_classification__categories"], ["terminology__provider"], ["ed_classification__stg_patient"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string", "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 , cast(date_part('year', class.encounter_end_date) as TEXT) \n || right('0'||cast(date_part('month', class.encounter_end_date) as TEXT),2) \n 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_npi\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-- , null as facility_latitude\n-- , null as facility_longitude\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 using(classification)\nleft join dev_sarah.terminology.provider fac_prov \n on class.facility_npi = 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)"}]}, "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": "1f56ff3781ed8070414cf5e3e680062bb889a8dcfb8b294e00fdafe0f62220a3"}, "config": {"enabled": true, "alias": "_int_filter_encounter_with_classification", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["ed_classification"], "description": "Filter out ED visits that were not classified", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.4336, "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)))\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": [["ed_classification__int_map_primary_dx"]], "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": []}, "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": "6aca59febddcf7299b4974d50a98a6620aa5c52aa24609f073b1d339696899ff"}, "config": {"enabled": true, "alias": "_int_by_provider_parent_organization", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["ed_classification"], "description": "Map ED encounter primary dx to classification", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.435797, "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)))\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": [["ed_classification__stg_encounter"], ["ed_classification__johnston_icd9"], ["ed_classification__johnston_icd10"]], "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_npi\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_npi\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)"}]}, "model.the_tuva_project.readmissions__stg_core__condition": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "readmissions__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/staging/readmissions__stg_core__condition.sql", "original_file_path": "models/readmissions/staging/readmissions__stg_core__condition.sql", "unique_id": "model.the_tuva_project.readmissions__stg_core__condition", "fqn": ["the_tuva_project", "readmissions", "staging", "readmissions__stg_core__condition"], "alias": "readmissions__stg_core__condition", "checksum": {"name": "sha256", "checksum": "dc8d23902790bd2440149cb31765d8f806ceda1502f8c5f8433985c5c4c1e5bf"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.504101, "relation_name": null, "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n encounter_id\n, normalized_code\n, condition_rank\n, normalized_code_type\n, claim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}", "language": "sql", "refs": [["core__condition"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/staging/readmissions__stg_core__condition.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n, normalized_code\n, condition_rank\n, normalized_code_type\n, claim_id\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": []}, "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": "f6df3623ae483cb6083ff743791efa2a4b3f302d8c1774e4a613d5b81e8b688c"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.50552, "relation_name": null, "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_npi,\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": [["core__encounter"]], "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_npi,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\nwhere encounter_type = 'acute inpatient'", "extra_ctes_injected": true, "extra_ctes": []}, "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": "96bc95ad35acfa3e28c3e1fa0435372a4bb5c3311d6265f57ece16ce159d57a0"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.50684, "relation_name": null, "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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": [["core__procedure"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure", "extra_ctes_injected": true, "extra_ctes": []}, "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": "a79098a486ec2b1e802acd006bc42e77bff73b455fa9f4f8fb50c74c179a70ba"}, "config": {"enabled": true, "alias": "encounter_augmented", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The date of discharge for the inpatient visit", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "A name or ID for the facility where the 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, "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, "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The number of dollars paid on the encounter", "meta": {}, "data_type": null, "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", "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", "quote": null, "tags": []}, "planned_flag": {"name": "planned_flag", "description": "Flag to indicate if the encounter was planned", "meta": {}, "data_type": "boolean", "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, "quote": null, "tags": []}, "died_flag": {"name": "died_flag", "description": "Flag to indicate of the patient died in this encounter", "meta": {}, "data_type": "boolean", "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, "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.4538062, "relation_name": "dev_sarah.readmissions.encounter_augmented", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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_npi,\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": [["readmissions__encounter"], ["readmissions__index_admission"], ["readmissions__planned_encounter"], ["readmissions__encounter_specialty_cohort"], ["readmissions__encounter_data_quality"]], "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_npi,\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-02-21 19:58:21.989699+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": []}, "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": "fb5c1b8f35e0d2d2dc4dd0ddc8a5e9b54e34e48aa906b2f2c6910266023ade09"}, "config": {"enabled": true, "alias": "readmission_summary", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The date of discharge for the inpatient visit", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "A name or ID for the facility where the 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, "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, "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The amount paid for the visit", "meta": {}, "data_type": null, "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", "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", "quote": null, "tags": []}, "planned_flag": {"name": "planned_flag", "description": "Flag to indicate if the encounter was planned", "meta": {}, "data_type": "boolean", "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, "quote": null, "tags": []}, "died_flag": {"name": "died_flag", "description": "Flag to indicate of the patient died in this encounter", "meta": {}, "data_type": "boolean", "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, "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", "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", "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", "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", "quote": null, "tags": []}, "readmission_encounter_id": {"name": "readmission_encounter_id", "description": "The unique identifier for the readmission encounter", "meta": {}, "data_type": null, "quote": null, "tags": []}, "readmission_patient_id": {"name": "readmission_patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "quote": null, "tags": []}, "readmission_admit_date": {"name": "readmission_admit_date", "description": "The date of admission for the readmission inpatient visit", "meta": {}, "data_type": null, "quote": null, "tags": []}, "readmission_discharge_date": {"name": "readmission_discharge_date", "description": "The date of discharge for the readmission inpatient visit", "meta": {}, "data_type": null, "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, "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, "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, "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", "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", "quote": null, "tags": []}, "readmission_planned_flag": {"name": "readmission_planned_flag", "description": "Flag to indicate if the readmission encounter was planned", "meta": {}, "data_type": "boolean", "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, "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", "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.4679182, "relation_name": "dev_sarah.readmissions.readmission_summary", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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_npi,\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_npi 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": [["readmissions__encounter_augmented"]], "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_npi,\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_npi 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-02-21 19:58:21.989699+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": []}, "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": "651ea44e78a1f22fca5b77920a33ebc79ef209a91593b1e88c79c233e936ece2"}, "config": {"enabled": true, "alias": "_int_encounter_overlap", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "encounter_id_A": {"name": "encounter_id_A", "description": "Unique identifier for one of the overlapping encounters", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_id_B": {"name": "encounter_id_B", "description": "Unique identifier for the other overlapping encounter", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.4754739, "relation_name": "dev_sarah.readmissions._int_encounter_overlap", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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": [["readmissions__encounter"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom overlapping_pairs", "extra_ctes_injected": true, "extra_ctes": []}, "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": "c638d9f96f2d0b79c636fa988ed0dfca946f86a49cf48685685356c8825a30fb"}, "config": {"enabled": true, "alias": "_int_encounter_specialty_cohort", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "The specialty cohort associated with the encounter", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.478176, "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)))\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 proc.encounter_id, 1 as c_rank\n from {{ ref('readmissions__procedure_ccs') }} proc\n left join {{ ref('readmissions__surgery_gynecology_cohort') }} sgc\n on proc.procedure_code = sgc.icd_10_pcs\n left join {{ ref('readmissions__specialty_cohort') }} sgsc\n on proc.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": [["readmissions__procedure_ccs"], ["readmissions__surgery_gynecology_cohort"], ["readmissions__specialty_cohort"], ["readmissions__encounter_with_ccs"], ["readmissions__specialty_cohort"], ["readmissions__encounter"]], "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", "seed.the_tuva_project.readmissions__specialty_cohort", "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 proc.encounter_id, 1 as c_rank\n from dev_sarah.readmissions._int_procedure_ccs proc\n left join dev_sarah.readmissions._value_set_surgery_gynecology_cohort sgc\n on proc.procedure_code = sgc.icd_10_pcs\n left join dev_sarah.readmissions._value_set_specialty_cohort sgsc\n on proc.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-02-21 19:58:21.989699+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": []}, "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": "a23df29e685234350283fc7841bb21a20d1c91b566bccfda2262d9c07d7aed68"}, "config": {"enabled": true, "alias": "_int_encounter_data_quality", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.4727051, "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)))\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": [["readmissions__encounter_overlap"], ["readmissions__encounter_overlap"], ["readmissions__encounter_with_ccs"], ["terminology__discharge_disposition"], ["terminology__ms_drg"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter_overlap", "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom all_data_quality_flags", "extra_ctes_injected": true, "extra_ctes": []}, "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": "d27ff53532444bdce91b3108d6dd1b4737903870366797dd5cd5ae831d2c50b8"}, "config": {"enabled": true, "alias": "_int_exclusion", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.48278, "relation_name": "dev_sarah.readmissions._int_exclusion", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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": [["readmissions__encounter_with_ccs"], ["readmissions__exclusion_ccs_diagnosis_category"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom exclusions", "extra_ctes_injected": true, "extra_ctes": []}, "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": "bbb59c9f797afc1ee141cd849b1a437d52f059e8c6e188026cb0d8189e0c5a68"}, "config": {"enabled": true, "alias": "_int_index_admission", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.485406, "relation_name": "dev_sarah.readmissions._int_index_admission", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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": [["readmissions__encounter"], ["readmissions__index_time_requirement"], ["readmissions__index_discharge_requirement"], ["readmissions__exclusion"]], "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-02-21 19:58:21.989699+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": []}, "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": "305870bec4cc273c38adcc4b930ddfd9923739b2f1e1f2c3ba87094888f28c49"}, "config": {"enabled": true, "alias": "_int_index_time_requirement", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.4904919, "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)))\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\n\nselect encounter_id, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__encounter') }}\nwhere discharge_date <= (select max(discharge_date)\n from {{ ref('readmissions__encounter') }} ) - 30", "language": "sql", "refs": [["readmissions__encounter"], ["readmissions__encounter"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter", "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\n\nselect encounter_id, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.readmissions._int_encounter\nwhere discharge_date <= (select max(discharge_date)\n from dev_sarah.readmissions._int_encounter ) - 30", "extra_ctes_injected": true, "extra_ctes": []}, "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": "563061c7bf2a55274cb8c5758986646143842fdd44b4e870112faef594985129"}, "config": {"enabled": true, "alias": "_int_planned_encounter", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.493181, "relation_name": "dev_sarah.readmissions._int_planned_encounter", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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\nunion distinct\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from always_planned_dx\nunion distinct\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from potentially_planned_that_are_actually_planned", "language": "sql", "refs": [["readmissions__procedure_ccs"], ["readmissions__always_planned_ccs_procedure_category"], ["readmissions__encounter_with_ccs"], ["readmissions__always_planned_ccs_diagnosis_category"], ["readmissions__procedure_ccs"], ["readmissions__potentially_planned_ccs_procedure_category"], ["readmissions__procedure_ccs"], ["readmissions__potentially_planned_icd_10_pcs"], ["readmissions__encounter_with_ccs"], ["readmissions__acute_diagnosis_icd_10_cm"], ["readmissions__acute_diagnosis_ccs"]], "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", "model.the_tuva_project.readmissions__procedure_ccs", "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category", "model.the_tuva_project.readmissions__procedure_ccs", "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs", "model.the_tuva_project.readmissions__encounter_with_ccs", "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-02-21 19:58:21.989699+00:00' as tuva_last_run from always_planned_px\nunion distinct\nselect *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run from always_planned_dx\nunion distinct\nselect *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run from potentially_planned_that_are_actually_planned", "extra_ctes_injected": true, "extra_ctes": []}, "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": "69b1397fd8f7cdb5ed0c9ce7e6b7e6123463718f2e7df6a159a37aab2676de1c"}, "config": {"enabled": true, "alias": "_int_encounter", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The date of discharge for the inpatient visit", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "facility": {"name": "facility", "description": "A name or ID for the facility where the inpatient visit occured", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ms_drg": {"name": "ms_drg", "description": "The MS-DRG associted with the inpatient visit", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.5025952, "relation_name": "dev_sarah.readmissions._int_encounter", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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_npi as {{ dbt.type_string() }}) as facility_npi,\n cast(ms_drg_code as {{ dbt.type_string() }}) as ms_drg_code,\n cast(paid_amount as 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": [["readmissions__stg_core__encounter"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "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_npi,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-02-21 19:58:21.989699+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_npi as TEXT) as facility_npi,\n cast(ms_drg_code as TEXT) as ms_drg_code,\n cast(paid_amount as numeric) as paid_amount,\n cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code,\n '2024-02-21 19:58:21.989699+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_npi,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\nwhere encounter_type = 'acute inpatient'\n)"}]}, "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": "5af78fb194df2ee56d8e4a8aa186bc36aec5310976948597a1f1a1938919bb3c"}, "config": {"enabled": true, "alias": "_int_readmission_crude", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.4993489, "relation_name": "dev_sarah.readmissions._int_readmission_crude", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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 bb.admit_date - aa.discharge_date 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": [["readmissions__encounter"], ["readmissions__encounter_overlap"], ["readmissions__encounter_overlap"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__encounter_overlap", "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 bb.admit_date - aa.discharge_date 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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom readmission_calc", "extra_ctes_injected": true, "extra_ctes": []}, "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": "27a1a42aad97c8878be854759a446bbfb68f7fb9d69f2e3c7a22ab7e0afd4c60"}, "config": {"enabled": true, "alias": "_int_procedure_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "procedure_code": {"name": "procedure_code", "description": "An ICD-10-PCS code associated with this encounter_id", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.49606, "relation_name": "dev_sarah.readmissions._int_procedure_ccs", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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": [["readmissions__stg_core__procedure"], ["terminology__icd_10_pcs"], ["readmissions__icd_10_pcs_to_ccs"]], "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "24551ca63236a478d8d3cb00b185c08893611b094cc353fb6014a5e37d1dff0b"}, "config": {"enabled": true, "alias": "_int_encounter_with_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.4802449, "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)))\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_npi,\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": [["readmissions__encounter"], ["terminology__icd_10_cm"], ["readmissions__icd_10_cm_to_ccs"]], "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_npi,\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-02-21 19:58:21.989699+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": []}, "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": "a6d50fccefae6d851d6e9f2e0d1b7484a749c1154e123aa571149d178e5c493b"}, "config": {"enabled": true, "alias": "_int_index_discharge_requirement", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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": "#161a7d"}}, "created_at": 1708545506.48768, "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)))\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": [["readmissions__encounter"], ["readmissions__encounter"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter", "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-02-21 19:58:21.989699+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": []}, "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": "70d2e322d0454e7e6b4495d993e09ca0ae8ce6a187352f317e71736fea8886e8"}, "config": {"enabled": true, "alias": "_stg_condition", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the condition was recorded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "The type of condition code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "code": {"name": "code", "description": "The condition code.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.559883, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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": [["core__condition"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": []}, "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": "e7856238a902887befd29ec7e3bac11a7b4f47acd1c1fdfddfd2c399f96b08a0"}, "config": {"enabled": true, "alias": "_stg_patient", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "sex": {"name": "sex", "description": "Biological sex of the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "Date the patient was born.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "The death date of the patient if there is one.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.5713, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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": [["core__patient"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": []}, "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": "ac9505314ff81401a8769ba8ca69e5b557247ffdf67064119e1761431e14ccec"}, "config": {"enabled": true, "alias": "_stg_medical_claim", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "Start date for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Bill type code for the claim (institutional claims only).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "HCPCS level 1 or level 2 code for the claim line.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.5674949, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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": [["core__medical_claim"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim", "extra_ctes_injected": true, "extra_ctes": []}, "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": "b9477f45b603026a03efcbf99a649bc6c6efed51def11e7394ced446affafc0a"}, "config": {"enabled": true, "alias": "_stg_eligibility", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "medicare_status_code": {"name": "medicare_status_code", "description": "Indicates how the patient became eligible for Medicare.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.563241, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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": [["core__eligibility"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility", "extra_ctes_injected": true, "extra_ctes": []}, "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": "2c279af2ee66d13d66fc3b476f1f05d50464c68cf1392a9cdf0372382d5f861d"}, "config": {"enabled": true, "alias": "patient_risk_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "risk_factor_description": {"name": "risk_factor_description", "description": "Description of the risk factor.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.511355, "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)))\n )\n}}\nwith demographic_factors as (\n\n select\n patient_id\n /* concatenate demographic risk factors */\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 as description\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 , 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 , 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 , 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": [["cms_hcc__int_demographic_factors"], ["cms_hcc__int_demographic_factors"], ["cms_hcc__int_disease_factors"], ["cms_hcc__int_enrollment_interaction_factors"], ["cms_hcc__int_disabled_interaction_factors"], ["cms_hcc__int_disease_interaction_factors"], ["cms_hcc__int_hcc_count_factors"]], "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_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 , 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 as description\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 , 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 , 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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "81f21b6b35a6a4252de5e54fa3ccba93cf7ddcdcf43ed091a1863d747987a5b1"}, "config": {"enabled": true, "alias": "patient_risk_scores", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.5150578, "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)))\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, 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, 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 , cast(payment_year as integer) as payment_year\n from payment\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_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [["cms_hcc__adjustment_rates"], ["cms_hcc__patient_risk_factors"]], "sources": [], "metrics": [], "depends_on": {"macros": ["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"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/final/cms_hcc__patient_risk_scores.sql", "compiled": true, "compiled_code": "\nwith 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, 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, 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 , cast(payment_year as integer) as payment_year\n from payment\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_year\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "fb967f6ddbb04b1dc9328cbf7b5d3a6329e6125c093c82b9d4bd7523e63ae23d"}, "config": {"enabled": true, "alias": "_int_disease_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.5274, "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)))\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": [["cms_hcc__int_demographic_factors"], ["cms_hcc__int_hcc_hierarchy"], ["cms_hcc__disease_factors"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "155bf30580bbc0a59066b57ba1438839023f6c4a9e0e9816ff93ae0ad9c158fd"}, "config": {"enabled": true, "alias": "_int_eligible_conditions", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "condition_code": {"name": "condition_code", "description": "The condition code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.5348082, "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)))\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 extract(year from claim_end_date) = {{ collection_year }}\n and cpt_hcpcs_list.payment_year = {{ payment_year }}\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 and extract(year from claim_end_date) = {{ collection_year }}\n and left(bill_type_code,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 and extract(year from claim_end_date) = {{ collection_year }}\n and cpt_hcpcs_list.payment_year = {{ payment_year }}\n and left(bill_type_code,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": [["cms_hcc__stg_core__medical_claim"], ["cms_hcc__stg_core__condition"], ["cms_hcc__cpt_hcpcs"]], "sources": [], "metrics": [], "depends_on": {"macros": ["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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 extract(year from claim_end_date) = 2023\n and cpt_hcpcs_list.payment_year = 2024\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 and extract(year from claim_end_date) = 2023\n and left(bill_type_code,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 and extract(year from claim_end_date) = 2023\n and cpt_hcpcs_list.payment_year = 2024\n and left(bill_type_code,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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}]}, "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": "66e2be3239422654a01581544fc558481a152eb75bacf4ca278747aa129045e8"}, "config": {"enabled": true, "alias": "_int_disease_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "hcc_code_1": {"name": "hcc_code_1", "description": "HCC code 1 of the interaction.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "hcc_code_2": {"name": "hcc_code_2", "description": "HCC code 2 of the interaction.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the disease interaction.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.531586, "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)))\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": [["cms_hcc__int_demographic_factors"], ["cms_hcc__int_hcc_hierarchy"], ["cms_hcc__disease_interaction_factors"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "1a6c4c3a3a63cf23ca01edbe354f5dba6c649074ed36296c1600812a1dfd21a6"}, "config": {"enabled": true, "alias": "_int_hcc_hierarchy", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.546585, "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)))\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": [["cms_hcc__int_hcc_mapping"], ["cms_hcc__disease_hierarchy"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "926a1b30a51cf5c1ad0366abe8d327667ef3ac3d8077e33c3c63614cbd037e30"}, "config": {"enabled": true, "alias": "_int_hcc_mapping", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "condition_code": {"name": "condition_code", "description": "Condition code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.550726, "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)))\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": [["cms_hcc__int_eligible_conditions"], ["cms_hcc__icd_10_cm_mappings"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "e25402973b98514d42132379e6d45084c4cdff563cd246bc0815d9cf5966b61d"}, "config": {"enabled": true, "alias": "_int_disabled_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the disabled and disease interaction.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.52339, "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)))\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": [["cms_hcc__int_demographic_factors"], ["cms_hcc__int_hcc_hierarchy"], ["cms_hcc__disabled_interaction_factors"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "e5e5caeb296422ea69a372c2d25c1e1c9e4cf51f42bfea64e2ad816dd9f170de"}, "config": {"enabled": true, "alias": "_int_hcc_count_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "description": {"name": "description", "description": "HCC counts.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.5426428, "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)))\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": [["cms_hcc__int_demographic_factors"], ["cms_hcc__payment_hcc_count_factors"], ["cms_hcc__int_hcc_hierarchy"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "560c71885b9179637391c384eeb8dd9caaf86b88aa2d24f1e682af0dfc1636a5"}, "config": {"enabled": true, "alias": "_int_demographic_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Indicates whether the patient is a \"Continuing\" or \"New\" enrollee.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Indicates whether the patient is \"Female\" or \"Male\".", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Indicates whether the patient is enrolled in Medicaid.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Indicates the Original Reason for Entitlement Code (OREC) \"Aged\", \"Disabled\", or \"ESRD\".\n", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.520124, "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)))\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 , 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 , 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": [["cms_hcc__int_members"], ["cms_hcc__demographic_factors"]], "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 , 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 , 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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "7d9c481c57764727db112430c3ff3e81feb9803185fb23d48d72c49229fe9131"}, "config": {"enabled": true, "alias": "_int_members", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Indicates whether the patient is a \"Continuing\" or \"New\" enrollee.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Indicates whether the patient is \"Female\" or \"Male\".", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Indicates whether the patient is enrolled in Medicaid.", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.556712, "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)))\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 = collection_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 /* filter to members with eligibility in collection or payment year */\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 )\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 < '{{ collection_year_start }}'\n then '{{ collection_year_start }}'\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > '{{ collection_year_end }}'\n then '{{ collection_year_end }}'\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 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 )\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 , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\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 when dual_status_code is null then TRUE\n else FALSE\n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\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 end as orec_default\n /* Setting default true until institutional logic is added */\n , TRUE as institutional_status_default\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 , 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 , 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": [["cms_hcc__stg_core__eligibility"], ["cms_hcc__stg_core__patient"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "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\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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 /* filter to members with eligibility in collection or payment year */\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, 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 < '2023-01-01'\n then '2023-01-01'\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > '2023-12-31'\n then '2023-12-31'\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 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, 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 , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\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 when dual_status_code is null then TRUE\n else FALSE\n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\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 end as orec_default\n /* Setting default true until institutional logic is added */\n , TRUE as institutional_status_default\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 , 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 , 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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}]}, "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": "16e0fe646674ecb9ba8c68c730d5940dcd46f019fe123a75424a9d18069c38c4"}, "config": {"enabled": true, "alias": "_int_enrollment_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the enrollment interaction.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.5385861, "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)))\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": [["cms_hcc__int_demographic_factors"], ["cms_hcc__enrollment_interaction_factors"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.emergency_department__stg_eligibility": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "emergency_department__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/staging/emergency_department__stg_eligibility.sql", "original_file_path": "models/claims_preprocessing/emergency_department/staging/emergency_department__stg_eligibility.sql", "unique_id": "model.the_tuva_project.emergency_department__stg_eligibility", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "staging", "emergency_department__stg_eligibility"], "alias": "emergency_department__stg_eligibility", "checksum": {"name": "sha256", "checksum": "1bd9ca7bf8cd5223c8899ea469f329321267b6eade053479c71ec8f908ac1cd8"}, "config": {"enabled": true, "alias": "emergency_department__stg_eligibility", "schema": null, "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "emergency_department__stg_eligibility", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false}, "created_at": 1708545506.652106, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect\r\n patient_id\r\n , birth_date\r\n , gender\r\n , race\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__eligibility') }}", "language": "sql", "refs": [["normalized_input__eligibility"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/staging/emergency_department__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , birth_date\n , gender\n , race\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.emergency_department__stg_medical_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "emergency_department__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/staging/emergency_department__stg_medical_claim.sql", "original_file_path": "models/claims_preprocessing/emergency_department/staging/emergency_department__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.emergency_department__stg_medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "staging", "emergency_department__stg_medical_claim"], "alias": "emergency_department__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "4365a2093999ddc140f0034a80966ba040b8f647c4a61577381650fbfce367c5"}, "config": {"enabled": true, "alias": "emergency_department__stg_medical_claim", "schema": null, "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "emergency_department__stg_medical_claim", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false}, "created_at": 1708545506.653733, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect \r\n claim_id\r\n , claim_line_number\r\n , patient_id\r\n , claim_type\r\n , claim_start_date\r\n , claim_end_date\r\n , admission_date\r\n , discharge_date\r\n , facility_npi\r\n , ms_drg_code\r\n , apr_drg_code\r\n , admit_source_code\r\n , admit_type_code\r\n , discharge_disposition_code\r\n , paid_amount\r\n , allowed_amount\r\n , charge_amount\r\n , diagnosis_code_type\r\n , diagnosis_code_1\r\n , data_source\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__medical_claim') }}", "language": "sql", "refs": [["normalized_input__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/staging/emergency_department__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.emergency_department__stg_service_category": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "emergency_department__stg_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/staging/emergency_department__stg_service_category.sql", "original_file_path": "models/claims_preprocessing/emergency_department/staging/emergency_department__stg_service_category.sql", "unique_id": "model.the_tuva_project.emergency_department__stg_service_category", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "staging", "emergency_department__stg_service_category"], "alias": "emergency_department__stg_service_category", "checksum": {"name": "sha256", "checksum": "35c03761a4196a871dc44fc5a9b7a8e2cec88fde6a979d87d127cdcdb81ad7f8"}, "config": {"enabled": true, "alias": "emergency_department__stg_service_category", "schema": null, "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "emergency_department__stg_service_category", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false}, "created_at": 1708545506.655373, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , claim_type\r\n , claim_line_number\r\n , service_category_2\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('service_category__service_category_grouper')}}", "language": "sql", "refs": [["service_category__service_category_grouper"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__service_category_grouper"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/staging/emergency_department__stg_service_category.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.service_category_grouper", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.emergency_department__summary": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/final/emergency_department__summary.sql", "original_file_path": "models/claims_preprocessing/emergency_department/final/emergency_department__summary.sql", "unique_id": "model.the_tuva_project.emergency_department__summary", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "final", "emergency_department__summary"], "alias": "emergency_department_summary", "checksum": {"name": "sha256", "checksum": "8ebd499a3126efc3cee2bf74ba9ef7d569bb29e63d71db01f89a18215705e715"}, "config": {"enabled": true, "alias": "emergency_department_summary", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "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 the emergency_department encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the patient was admitted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the patient was discharged.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient as of their admission date.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "/terminology/demographics/gender"}, "data_type": null, "quote": null, "tags": []}, "race": {"name": "race", "description": "The race of the patient.", "meta": {"terminology": "/terminology/demographics/race"}, "data_type": null, "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "The NPI for the facility where the encounter occurred.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "The MS-DRG code associted with the inpatient visit", "meta": {"terminology": "/terminology/conditions-and-procedures/ms-drg"}, "data_type": null, "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "The MS-DRG description associted with the inpatient visit", "meta": {"terminology": "/terminology/conditions-and-procedures/ms-drg"}, "data_type": null, "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "Indicates whether the MS-DRG is medical or surgical in nature.", "meta": {"terminology": "/terminology/conditions-and-procedures/ms-drg"}, "data_type": null, "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "The APR-DRG code associted with the inpatient visit", "meta": {"terminology": "/terminology/conditions-and-procedures/apr-drg"}, "data_type": null, "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "The APR-DRG description associted with the inpatient visit", "meta": {"terminology": "/terminology/conditions-and-procedures/apr-drg"}, "data_type": null, "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Admission source code for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/admit-source"}, "data_type": null, "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Admission source description for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/admit-source"}, "data_type": null, "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Admission type code for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/admit-type"}, "data_type": null, "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Admission type description for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/admit-type"}, "data_type": null, "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Discharge disposition code for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/discharge-disposition"}, "data_type": null, "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Discharge disposition description for the encounter.", "meta": {"terminology": "/terminology/administrative-codes/discharge-disposition"}, "data_type": null, "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total paid amount across all claims for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total allowed amount across all claims for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total charge amount across all claims for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "The length of stay for the encoujnter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "1 if a patient died during the encounter, 0 otherwise.", "meta": {}, "data_type": null, "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\").", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "emergency_department_summary", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.633259, "relation_name": "dev_sarah.claims_preprocessing.emergency_department_summary", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith distinct_encounters as (\r\nselect distinct\r\n a.encounter_id\r\n, a.patient_id\r\n, b.encounter_start_date\r\n, b.encounter_end_date\r\nfrom {{ ref('emergency_department__int_encounter_id') }} a\r\ninner join {{ ref('emergency_department__int_encounter_start_and_end_dates') }} b\r\n on a.encounter_id = b.encounter_id\r\n)\r\n\r\n, institutional_claim_details as (\r\n select\r\n b.encounter_id\r\n , first.diagnosis_code_1\r\n , first.diagnosis_code_type\r\n , first.facility_npi as facility_npi\r\n , first.ms_drg_code as ms_drg_code\r\n , first.apr_drg_code as apr_drg_code\r\n , first.admit_source_code as admit_source_code\r\n , first.admit_type_code as admit_type_code\r\n , last.discharge_disposition_code as discharge_disposition_code\r\n , sum(paid_amount) as inst_paid_amount\r\n , sum(allowed_amount) as inst_allowed_amount\r\n , sum(charge_amount) as inst_charge_amount\r\n , max(data_source) as data_source\r\n from {{ ref('medical_claim') }} a\r\n inner join {{ ref('emergency_department__int_encounter_id') }} b\r\n on a.claim_id = b.claim_id\r\n and a.claim_line_number = b.claim_line_number\r\n and a.claim_type = 'institutional'\r\n inner join {{ ref('emergency_department__int_first_claim_values') }} first\r\n on b.encounter_id = first.encounter_id\r\n and first.claim_row = 1\r\n inner join {{ ref('emergency_department__int_last_claim_values') }} last\r\n on b.encounter_id = last.encounter_id\r\n and last.claim_row = 1\r\n group by\r\n b.encounter_id\r\n , first.diagnosis_code_1\r\n , first.diagnosis_code_type\r\n , first.facility_npi\r\n , first.ms_drg_code\r\n , first.apr_drg_code\r\n , first.admit_source_code\r\n , first.admit_type_code\r\n , last.discharge_disposition_code\r\n)\r\n\r\n, professional_claim_details as (\r\nselect\r\n b.encounter_id\r\n, sum(paid_amount) as prof_paid_amount\r\n, sum(allowed_amount) as prof_allowed_amount\r\n, sum(charge_amount) as prof_charge_amount\r\nfrom {{ ref('medical_claim') }} a\r\ninner join {{ ref('emergency_department__int_encounter_id') }} b\r\n on a.claim_id = b.claim_id\r\n and a.claim_line_number = b.claim_line_number\r\n and a.claim_type = 'professional'\r\ngroup by 1\r\n)\r\n\r\n, patient as (\r\nselect distinct\r\n patient_id\r\n, birth_date\r\n, gender\r\n, race\r\nfrom {{ ref('eligibility') }}\r\n)\r\n\r\n, provider as (\r\nselect\r\n a.encounter_id\r\n, max(a.facility_npi) as facility_npi\r\n, b.provider_first_name\r\n, b.provider_last_name\r\n, count(distinct facility_npi) as npi_count\r\nfrom {{ ref('emergency_department__int_institutional_encounter_id') }} a\r\nleft join {{ ref('terminology__provider') }} b\r\n on a.facility_npi = b.npi\r\ngroup by 1,3,4\r\n)\r\n\r\nselect\r\n a.encounter_id\r\n , a.encounter_start_date\r\n , a.encounter_end_date\r\n , a.patient_id\r\n , {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\r\n , e.gender\r\n , e.race\r\n , c.diagnosis_code_type as primary_diagnosis_code_type\r\n , c.diagnosis_code_1 as primary_diagnosis_code\r\n , coalesce(icd10cm.description, icd9cm.long_description) as primary_diagnosis_description\r\n , f.facility_npi\r\n , f.provider_first_name\r\n , f.provider_last_name\r\n , c.ms_drg_code\r\n , j.ms_drg_description\r\n , j.medical_surgical\r\n , c.apr_drg_code\r\n , k.apr_drg_description\r\n , c.admit_source_code\r\n , h.admit_source_description\r\n , c.admit_type_code\r\n , i.admit_type_description\r\n , c.discharge_disposition_code\r\n , g.discharge_disposition_description\r\n , c.inst_paid_amount + coalesce(d.prof_paid_amount,0) as total_paid_amount\r\n , c.inst_allowed_amount + coalesce(d.prof_allowed_amount,0) as total_allowed_amount\r\n , c.inst_charge_amount + coalesce(d.prof_charge_amount,0) as total_charge_amount\r\n , {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\r\n , case\r\n when c.discharge_disposition_code = '20' then 1\r\n else 0\r\n end mortality_flag\r\n , data_source\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom distinct_encounters a\r\nleft join institutional_claim_details c\r\n on a.encounter_id = c.encounter_id\r\nleft join professional_claim_details d\r\n on a.encounter_id = d.encounter_id\r\nleft join patient e\r\n on a.patient_id = e.patient_id\r\nleft join provider f\r\n on a.encounter_id = f.encounter_id\r\nleft join {{ ref('terminology__discharge_disposition') }} g\r\n on c.discharge_disposition_code = g.discharge_disposition_code\r\nleft join {{ ref('terminology__admit_source') }} h\r\n on c.admit_source_code = h.admit_source_code\r\nleft join {{ ref('terminology__admit_type') }} i\r\n on c.admit_type_code = i.admit_type_code\r\nleft join {{ ref('terminology__ms_drg') }} j\r\n on c.ms_drg_code = j.ms_drg_code\r\nleft join {{ ref('terminology__apr_drg') }} k\r\n on c.apr_drg_code = k.apr_drg_code\r\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\r\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\r\n and c.diagnosis_code_type = 'icd-10-cm'\r\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\r\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\r\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [["emergency_department__int_encounter_id"], ["emergency_department__int_encounter_start_and_end_dates"], ["medical_claim"], ["emergency_department__int_encounter_id"], ["emergency_department__int_first_claim_values"], ["emergency_department__int_last_claim_values"], ["medical_claim"], ["emergency_department__int_encounter_id"], ["eligibility"], ["emergency_department__int_institutional_encounter_id"], ["terminology__provider"], ["terminology__discharge_disposition"], ["terminology__admit_source"], ["terminology__admit_type"], ["terminology__ms_drg"], ["terminology__apr_drg"], ["terminology__icd_10_cm"], ["terminology__icd_9_cm"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "model.input_layer.medical_claim", "model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_first_claim_values", "model.the_tuva_project.emergency_department__int_last_claim_values", "model.input_layer.medical_claim", "model.the_tuva_project.emergency_department__int_encounter_id", "model.input_layer.eligibility", "model.the_tuva_project.emergency_department__int_institutional_encounter_id", "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/emergency_department/final/emergency_department__summary.sql", "compiled": true, "compiled_code": "\n\nwith distinct_encounters as (\nselect distinct\n a.encounter_id\n, a.patient_id\n, b.encounter_start_date\n, b.encounter_end_date\nfrom dev_sarah.claims_preprocessing._int_emergency_department_encounter_id a\ninner join dev_sarah.claims_preprocessing._int_emergency_department_encounter_start_and_end_dates b\n on a.encounter_id = b.encounter_id\n)\n\n, institutional_claim_details as (\n select\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi as facility_npi\n , first.ms_drg_code as ms_drg_code\n , first.apr_drg_code as apr_drg_code\n , first.admit_source_code as admit_source_code\n , first.admit_type_code as admit_type_code\n , last.discharge_disposition_code as discharge_disposition_code\n , sum(paid_amount) as inst_paid_amount\n , sum(allowed_amount) as inst_allowed_amount\n , sum(charge_amount) as inst_charge_amount\n , max(data_source) as data_source\n from tuva.input_layer.medical_claim a\n inner join dev_sarah.claims_preprocessing._int_emergency_department_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'institutional'\n inner join dev_sarah.claims_preprocessing._int_emergency_department_first_claim_values first\n on b.encounter_id = first.encounter_id\n and first.claim_row = 1\n inner join dev_sarah.claims_preprocessing._int_emergency_department_last_claim_values last\n on b.encounter_id = last.encounter_id\n and last.claim_row = 1\n group by\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi\n , first.ms_drg_code\n , first.apr_drg_code\n , first.admit_source_code\n , first.admit_type_code\n , last.discharge_disposition_code\n)\n\n, professional_claim_details as (\nselect\n b.encounter_id\n, sum(paid_amount) as prof_paid_amount\n, sum(allowed_amount) as prof_allowed_amount\n, sum(charge_amount) as prof_charge_amount\nfrom tuva.input_layer.medical_claim a\ninner join dev_sarah.claims_preprocessing._int_emergency_department_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'professional'\ngroup by 1\n)\n\n, patient as (\nselect distinct\n patient_id\n, birth_date\n, gender\n, race\nfrom tuva.input_layer.eligibility\n)\n\n, provider as (\nselect\n a.encounter_id\n, max(a.facility_npi) as facility_npi\n, b.provider_first_name\n, b.provider_last_name\n, count(distinct facility_npi) as npi_count\nfrom dev_sarah.claims_preprocessing._int_emergency_department_institutional_encounter_id a\nleft join dev_sarah.terminology.provider b\n on a.facility_npi = b.npi\ngroup by 1,3,4\n)\n\nselect\n a.encounter_id\n , a.encounter_start_date\n , a.encounter_end_date\n , a.patient_id\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.description, icd9cm.long_description) as primary_diagnosis_description\n , f.facility_npi\n , f.provider_first_name\n , f.provider_last_name\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 , c.inst_paid_amount + coalesce(d.prof_paid_amount,0) as total_paid_amount\n , c.inst_allowed_amount + coalesce(d.prof_allowed_amount,0) as total_allowed_amount\n , c.inst_charge_amount + coalesce(d.prof_charge_amount,0) as total_charge_amount\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 , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom distinct_encounters a\nleft join institutional_claim_details c\n on a.encounter_id = c.encounter_id\nleft join professional_claim_details d\n on a.encounter_id = d.encounter_id\nleft join patient e\n on a.patient_id = e.patient_id\nleft join provider f\n on a.encounter_id = f.encounter_id\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": []}, "model.the_tuva_project.emergency_department__int_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__int_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_id.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_id.sql", "unique_id": "model.the_tuva_project.emergency_department__int_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_encounter_id"], "alias": "_int_emergency_department_encounter_id", "checksum": {"name": "sha256", "checksum": "89897906bbed767423639e5e04be33a00defb543f40981cb9ad83a6fd2fe1dd8"}, "config": {"enabled": true, "alias": "_int_emergency_department_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Fix encounter_id so each professional claim can only belong to one encounter", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_encounter_id", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "view", "enabled": true, "bind": false}, "created_at": 1708545506.635937, "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_encounter_id", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n inst.patient_id,\r\n inst.claim_id,\r\n med.claim_line_number,\r\n inst.encounter_id,\r\n '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('emergency_department__int_institutional_encounter_id') }} inst\r\nleft join {{ ref('emergency_department__stg_medical_claim') }} med\r\n on inst.claim_id = med.claim_id\r\n\r\nunion distinct\r\n\r\nselect\r\n patient_id,\r\n claim_id,\r\n claim_line_number,\r\n encounter_id,\r\n '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('emergency_department__int_professional_encounter_id') }}\r\nwhere (orphan_claim_flag = 0) and (encounter_count = 1)", "language": "sql", "refs": [["emergency_department__int_institutional_encounter_id"], ["emergency_department__stg_medical_claim"], ["emergency_department__int_professional_encounter_id"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__int_institutional_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.emergency_department__int_professional_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select\n inst.patient_id,\n inst.claim_id,\n med.claim_line_number,\n inst.encounter_id,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_emergency_department_institutional_encounter_id inst\nleft join __dbt__cte__emergency_department__stg_medical_claim med\n on inst.claim_id = med.claim_id\n\nunion distinct\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n encounter_id,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_emergency_department_professional_encounter_id\nwhere (orphan_claim_flag = 0) and (encounter_count = 1)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.emergency_department__stg_medical_claim", "sql": " __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.emergency_department__int_first_claim_values": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__int_first_claim_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_first_claim_values.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_first_claim_values.sql", "unique_id": "model.the_tuva_project.emergency_department__int_first_claim_values", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_first_claim_values"], "alias": "_int_emergency_department_first_claim_values", "checksum": {"name": "sha256", "checksum": "38449669603127fd56e9a1a73a700e54d6471396da6d5be11429d276dbcbe6bc"}, "config": {"enabled": true, "alias": "_int_emergency_department_first_claim_values", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Orders claims to pull out encounter details (admit type, drg, etc)", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_first_claim_values", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.640754, "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_first_claim_values", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith first_claim_values as(\r\n select distinct\r\n e.encounter_id\r\n , coalesce(claim_start_date, admission_date) as claim_start\r\n , diagnosis_code_1\r\n , diagnosis_code_type\r\n , admit_source_code\r\n , admit_type_code\r\n , facility_npi\r\n , ms_drg_code\r\n , apr_drg_code\r\n from {{ ref('emergency_department__int_encounter_id')}} e\r\n inner join {{ ref('emergency_department__stg_medical_claim') }} m\r\n on e.claim_id = m.claim_id\r\n where claim_type = 'institutional'\r\n)\r\n\r\nselect\r\n encounter_id\r\n , claim_start\r\n , diagnosis_code_1\r\n , diagnosis_code_type\r\n , admit_source_code\r\n , admit_type_code\r\n , facility_npi\r\n , ms_drg_code\r\n , apr_drg_code\r\n , row_number() over (partition by encounter_id order by claim_start) as claim_row\r\nfrom first_claim_values", "language": "sql", "refs": [["emergency_department__int_encounter_id"], ["emergency_department__stg_medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_first_claim_values.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n),first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n from dev_sarah.claims_preprocessing._int_emergency_department_encounter_id e\n inner join __dbt__cte__emergency_department__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , row_number() over (partition by encounter_id order by claim_start) as claim_row\nfrom first_claim_values", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.emergency_department__stg_medical_claim", "sql": " __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.emergency_department__int_institutional_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__int_institutional_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_claims.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_claims.sql", "unique_id": "model.the_tuva_project.emergency_department__int_institutional_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_institutional_claims"], "alias": "_int_emergency_department_institutional_claims", "checksum": {"name": "sha256", "checksum": "d7a8dab04353842b385f21fddfdf9f559a42df81bdac6682afd7454d3747e5ea"}, "config": {"enabled": true, "alias": "_int_emergency_department_institutional_claims", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "description": "All emergency_department institutional claim_ids with header values and data quality flags", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_institutional_claims", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.6429281, "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_institutional_claims", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith emergency_department_claim_lines as (\r\nselect\r\n mc.patient_id,\r\n mc.claim_id,\r\n mc.claim_line_number,\r\n mc.claim_start_date,\r\n mc.claim_end_date,\r\n mc.admission_date,\r\n mc.discharge_date,\r\n mc.admit_source_code,\r\n mc.admit_type_code,\r\n mc.discharge_disposition_code,\r\n mc.facility_npi,\r\n mc.claim_type,\r\n mc.data_source\r\nfrom {{ ref('emergency_department__stg_medical_claim') }} mc\r\ninner join {{ ref('emergency_department__stg_service_category')}} sc\r\n on mc.claim_id = sc.claim_id\r\nwhere mc.claim_type = 'institutional'\r\n and sc.service_category_2 = 'Emergency Department'\r\n),\r\n\r\ndata_quality_flags as (\r\nselect\r\n claim_id,\r\n-- patient_id_not_unique:\r\n case\r\n when count(distinct patient_id) > 1 then 1\r\n else 0\r\n end as patient_id_not_unique,\r\n-- patient_id_missing: \r\n case\r\n when max(patient_id) is null then 1\r\n else 0\r\n end as patient_id_missing, \r\n-- claim_start_date_not_unique:\r\n case\r\n when count(distinct claim_start_date) > 1 then 1\r\n else 0\r\n end as claim_start_date_not_unique,\r\n-- claim_start_date_missing: \r\n case\r\n when max(claim_start_date) is null then 1\r\n else 0\r\n end as claim_start_date_missing,\r\n-- claim_end_date_not_unique:\r\n case\r\n when count(distinct claim_end_date) > 1 then 1\r\n else 0\r\n end as claim_end_date_not_unique,\r\n-- claim_end_date_missing: \r\n case\r\n when max(claim_end_date) is null then 1\r\n else 0\r\n end as claim_end_date_missing,\r\n-- claim_start_date_after_claim_end_date:\r\n case\r\n when min(claim_start_date) > max(claim_end_date) then 1\r\n else 0\r\n end as claim_start_date_after_claim_end_date,\r\n-- admission_date_not_unique:\r\n case\r\n when count(distinct admission_date) > 1 then 1\r\n else 0\r\n end as admission_date_not_unique,\r\n-- admission_date_missing: \r\n case\r\n when max(admission_date) is null then 1\r\n else 0\r\n end as admission_date_missing,\r\n-- discharge_date_not_unique:\r\n case\r\n when count(distinct discharge_date) > 1 then 1\r\n else 0\r\n end as discharge_date_not_unique,\r\n-- discharge_date_missing: \r\n case\r\n when max(discharge_date) is null then 1\r\n else 0\r\n end as discharge_date_missing,\r\n-- admission_date_after_discharge_date:\r\n case\r\n when min(admission_date) > max(discharge_date) then 1\r\n else 0\r\n end as admission_date_after_discharge_date,\r\n-- admit_type_code_not_unique:\r\n case\r\n when count(distinct admit_type_code) > 1 then 1\r\n else 0\r\n end as admit_type_code_not_unique,\r\n-- admit_type_code_missing: \r\n case\r\n when max(admit_type_code) is null then 1\r\n else 0\r\n end as admit_type_code_missing, \r\n-- admit_source_code_not_unique:\r\n case\r\n when count(distinct admit_source_code) > 1 then 1\r\n else 0\r\n end as admit_source_code_not_unique,\r\n-- admit_source_code_missing: \r\n case\r\n when max(admit_source_code) is null then 1\r\n else 0\r\n end as admit_source_code_missing, \r\n-- discharge_disposition_code_not_unique:\r\n case\r\n when count(distinct discharge_disposition_code) > 1 then 1\r\n else 0\r\n end as discharge_disposition_code_not_unique,\r\n-- discharge_disposition_code_missing: \r\n case\r\n when max(discharge_disposition_code) is null then 1\r\n else 0\r\n end as discharge_disposition_code_missing,\r\n-- facility_npi_not_unique:\r\n case\r\n when count(distinct facility_npi) > 1 then 1\r\n else 0\r\n end as facility_npi_not_unique,\r\n-- facility_npi_missing: \r\n case\r\n when max(facility_npi) is null then 1\r\n else 0\r\n end as facility_npi_missing,\r\n-- claim_type_not_unique:\r\n case\r\n when count(distinct claim_type) > 1 then 1\r\n else 0\r\n end as claim_type_not_unique,\r\n-- claim_type_missing: \r\n case\r\n when max(claim_type) is null then 1\r\n else 0\r\n end as claim_type_missing,\r\n-- claim_type_not_institutional:\r\n case\r\n when max(claim_type) <> 'institutional'\r\n and min(claim_type) <> 'institutional' then 1\r\n else 0\r\n end as claim_type_not_institutional\r\nfrom emergency_department_claim_lines\r\ngroup by claim_id\r\n),\r\n\r\n\r\nheader_level_values as (\r\nselect\r\n claim_id,\r\n max(patient_id) as patient_id,\r\n min(claim_start_date) as claim_start_date,\r\n max(claim_end_date) as claim_end_date,\r\n min(admission_date) as admission_date,\r\n max(discharge_date) as discharge_date,\r\n max(admit_source_code) as admit_source_code,\r\n max(admit_type_code) as admit_type_code,\r\n max(discharge_disposition_code) as discharge_disposition_code,\r\n max(facility_npi) as facility_npi,\r\n max(claim_type) as claim_type,\r\n coalesce(min(admission_date),\r\n min(claim_start_date)) as start_date,\r\n coalesce(max(discharge_date),\r\n max(claim_end_date)) as end_date,\r\n case\r\n when min(admission_date) is not null then 'admission_date'\r\n when min(claim_start_date) is not null then 'claim_start_date'\r\n else null\r\n end as date_used_as_start_date,\r\n case\r\n when max(discharge_date) is not null then 'discharge_date'\r\n when max(claim_end_date) is not null then 'claim_end_date'\r\n else null\r\n end as date_used_as_end_date,\r\n data_source\r\nfrom emergency_department_claim_lines\r\ngroup by claim_id, data_source\r\n)\r\n\r\nselect\r\n h.patient_id as patient_id,\r\n h.claim_id as claim_id, \r\n h.claim_start_date as claim_start_date,\r\n h.claim_end_date as claim_end_date,\r\n h.admission_date as admission_date,\r\n h.discharge_date as discharge_date,\r\n h.admit_source_code as admit_source_code,\r\n h.admit_type_code as admit_type_code,\r\n h.discharge_disposition_code as discharge_disposition_code,\r\n h.facility_npi as facility_npi,\r\n h.claim_type as claim_type,\r\n h.start_date as start_date,\r\n h.end_date as end_date,\r\n h.date_used_as_start_date,\r\n h.date_used_as_end_date, \r\n\r\n case\r\n when\r\n ( (dq.patient_id_not_unique = 1) or\r\n (dq.patient_id_missing = 1) or\r\n (dq.discharge_disposition_code_not_unique = 1) or\r\n (dq.discharge_disposition_code_missing = 1) or\r\n (dq.facility_npi_not_unique = 1) or\r\n (dq.facility_npi_missing = 1) or\r\n (h.date_used_as_start_date is null) or\r\n\t(h.date_used_as_end_date is null) or\r\n\t(h.start_date > h.end_date) ) then 1\r\n else 0\r\n end as dq_problem,\r\n\r\n case\r\n when\r\n ( (dq.claim_start_date_not_unique = 1) or\r\n\t(dq.claim_start_date_missing = 1) or\r\n (dq.claim_end_date_not_unique = 1) or\r\n (dq.claim_end_date_missing = 1) or\r\n (dq.claim_start_date_after_claim_end_date = 1) or\r\n (dq.admission_date_not_unique = 1) or\r\n (dq.admission_date_missing = 1) or\r\n (dq.discharge_date_not_unique = 1) or\r\n (dq.discharge_date_missing = 1) or\r\n (dq.admission_date_after_discharge_date = 1) or\r\n (dq.admit_type_code_not_unique = 1) or\r\n (dq.admit_type_code_missing = 1) or\r\n (dq.admit_source_code_not_unique = 1) or\r\n (dq.admit_source_code_missing = 1) or\t\r\n (dq.claim_type_not_unique = 1) or\r\n (dq.claim_type_missing = 1) or\r\n (dq.claim_type_not_institutional = 1) ) then 1\r\n else 0\r\n end as dq_insight,\r\n\r\n case\r\n when (h.date_used_as_start_date is null) then 1\r\n else 0\r\n end as start_date_not_determined,\r\n \r\n case\r\n when (h.date_used_as_end_date is null) then 1\r\n else 0\r\n end as end_date_not_determined,\r\n\r\n case\r\n when (h.start_date > h.end_date) then 1\r\n else 0\r\n end as start_date_after_end_date,\r\n \r\n dq.patient_id_not_unique as patient_id_not_unique,\r\n dq.patient_id_missing as patient_id_missing,\r\n dq.claim_start_date_not_unique as claim_start_date_not_unique,\r\n dq.claim_start_date_missing as claim_start_date_missing,\r\n dq.claim_end_date_not_unique as claim_end_date_not_unique,\r\n dq.claim_end_date_missing as claim_end_date_missing,\r\n dq.claim_start_date_after_claim_end_date\r\n as claim_start_date_after_claim_end_date,\r\n dq.admission_date_not_unique as admission_date_not_unique,\r\n dq.admission_date_missing as admission_date_missing,\r\n dq.discharge_date_not_unique as discharge_date_not_unique,\r\n dq.discharge_date_missing as discharge_date_missing,\r\n dq.admission_date_after_discharge_date\r\n as admission_date_after_discharge_date,\r\n dq.admit_type_code_not_unique\r\n as admit_type_code_not_unique,\r\n dq.admit_type_code_missing\r\n as admit_type_code_missing,\r\n dq.admit_source_code_not_unique\r\n as admit_source_code_not_unique,\r\n dq.admit_source_code_missing\r\n as admit_source_code_missing,\r\n dq.discharge_disposition_code_not_unique\r\n as discharge_disposition_code_not_unique,\r\n dq.discharge_disposition_code_missing\r\n as discharge_disposition_code_missing,\r\n dq.facility_npi_not_unique as facility_npi_not_unique,\r\n dq.facility_npi_missing as facility_npi_missing,\r\n dq.claim_type_not_unique as claim_type_not_unique,\r\n dq.claim_type_missing as claim_type_missing,\r\n dq.claim_type_not_institutional as claim_type_not_institutional,\r\n h.data_source,\r\n '{{ var('tuva_last_run')}}' as tuva_last_run\r\n\r\nfrom header_level_values h\r\nleft join data_quality_flags dq\r\n on h.claim_id = dq.claim_id", "language": "sql", "refs": [["emergency_department__stg_medical_claim"], ["emergency_department__stg_service_category"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.emergency_department__stg_service_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_claims.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n), __dbt__cte__emergency_department__stg_service_category as (\n\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.service_category_grouper\n),emergency_department_claim_lines as (\nselect\n mc.patient_id,\n mc.claim_id,\n mc.claim_line_number,\n mc.claim_start_date,\n mc.claim_end_date,\n mc.admission_date,\n mc.discharge_date,\n mc.admit_source_code,\n mc.admit_type_code,\n mc.discharge_disposition_code,\n mc.facility_npi,\n mc.claim_type,\n mc.data_source\nfrom __dbt__cte__emergency_department__stg_medical_claim mc\ninner join __dbt__cte__emergency_department__stg_service_category sc\n on mc.claim_id = sc.claim_id\nwhere mc.claim_type = 'institutional'\n and sc.service_category_2 = 'Emergency Department'\n),\n\ndata_quality_flags as (\nselect\n claim_id,\n-- patient_id_not_unique:\n case\n when count(distinct patient_id) > 1 then 1\n else 0\n end as patient_id_not_unique,\n-- patient_id_missing: \n case\n when max(patient_id) is null then 1\n else 0\n end as patient_id_missing, \n-- claim_start_date_not_unique:\n case\n when count(distinct claim_start_date) > 1 then 1\n else 0\n end as claim_start_date_not_unique,\n-- claim_start_date_missing: \n case\n when max(claim_start_date) is null then 1\n else 0\n end as claim_start_date_missing,\n-- claim_end_date_not_unique:\n case\n when count(distinct claim_end_date) > 1 then 1\n else 0\n end as claim_end_date_not_unique,\n-- claim_end_date_missing: \n case\n when max(claim_end_date) is null then 1\n else 0\n end as claim_end_date_missing,\n-- claim_start_date_after_claim_end_date:\n case\n when min(claim_start_date) > max(claim_end_date) then 1\n else 0\n end as claim_start_date_after_claim_end_date,\n-- admission_date_not_unique:\n case\n when count(distinct admission_date) > 1 then 1\n else 0\n end as admission_date_not_unique,\n-- admission_date_missing: \n case\n when max(admission_date) is null then 1\n else 0\n end as admission_date_missing,\n-- discharge_date_not_unique:\n case\n when count(distinct discharge_date) > 1 then 1\n else 0\n end as discharge_date_not_unique,\n-- discharge_date_missing: \n case\n when max(discharge_date) is null then 1\n else 0\n end as discharge_date_missing,\n-- admission_date_after_discharge_date:\n case\n when min(admission_date) > max(discharge_date) then 1\n else 0\n end as admission_date_after_discharge_date,\n-- admit_type_code_not_unique:\n case\n when count(distinct admit_type_code) > 1 then 1\n else 0\n end as admit_type_code_not_unique,\n-- admit_type_code_missing: \n case\n when max(admit_type_code) is null then 1\n else 0\n end as admit_type_code_missing, \n-- admit_source_code_not_unique:\n case\n when count(distinct admit_source_code) > 1 then 1\n else 0\n end as admit_source_code_not_unique,\n-- admit_source_code_missing: \n case\n when max(admit_source_code) is null then 1\n else 0\n end as admit_source_code_missing, \n-- discharge_disposition_code_not_unique:\n case\n when count(distinct discharge_disposition_code) > 1 then 1\n else 0\n end as discharge_disposition_code_not_unique,\n-- discharge_disposition_code_missing: \n case\n when max(discharge_disposition_code) is null then 1\n else 0\n end as discharge_disposition_code_missing,\n-- facility_npi_not_unique:\n case\n when count(distinct facility_npi) > 1 then 1\n else 0\n end as facility_npi_not_unique,\n-- facility_npi_missing: \n case\n when max(facility_npi) is null then 1\n else 0\n end as facility_npi_missing,\n-- claim_type_not_unique:\n case\n when count(distinct claim_type) > 1 then 1\n else 0\n end as claim_type_not_unique,\n-- claim_type_missing: \n case\n when max(claim_type) is null then 1\n else 0\n end as claim_type_missing,\n-- claim_type_not_institutional:\n case\n when max(claim_type) <> 'institutional'\n and min(claim_type) <> 'institutional' then 1\n else 0\n end as claim_type_not_institutional\nfrom emergency_department_claim_lines\ngroup by claim_id\n),\n\n\nheader_level_values as (\nselect\n claim_id,\n max(patient_id) as patient_id,\n min(claim_start_date) as claim_start_date,\n max(claim_end_date) as claim_end_date,\n min(admission_date) as admission_date,\n max(discharge_date) as discharge_date,\n max(admit_source_code) as admit_source_code,\n max(admit_type_code) as admit_type_code,\n max(discharge_disposition_code) as discharge_disposition_code,\n max(facility_npi) as facility_npi,\n max(claim_type) as claim_type,\n coalesce(min(admission_date),\n min(claim_start_date)) as start_date,\n coalesce(max(discharge_date),\n max(claim_end_date)) as end_date,\n case\n when min(admission_date) is not null then 'admission_date'\n when min(claim_start_date) is not null then 'claim_start_date'\n else null\n end as date_used_as_start_date,\n case\n when max(discharge_date) is not null then 'discharge_date'\n when max(claim_end_date) is not null then 'claim_end_date'\n else null\n end as date_used_as_end_date,\n data_source\nfrom emergency_department_claim_lines\ngroup by claim_id, data_source\n)\n\nselect\n h.patient_id as patient_id,\n h.claim_id as claim_id, \n h.claim_start_date as claim_start_date,\n h.claim_end_date as claim_end_date,\n h.admission_date as admission_date,\n h.discharge_date as discharge_date,\n h.admit_source_code as admit_source_code,\n h.admit_type_code as admit_type_code,\n h.discharge_disposition_code as discharge_disposition_code,\n h.facility_npi as facility_npi,\n h.claim_type as claim_type,\n h.start_date as start_date,\n h.end_date as end_date,\n h.date_used_as_start_date,\n h.date_used_as_end_date, \n\n case\n when\n ( (dq.patient_id_not_unique = 1) or\n (dq.patient_id_missing = 1) or\n (dq.discharge_disposition_code_not_unique = 1) or\n (dq.discharge_disposition_code_missing = 1) or\n (dq.facility_npi_not_unique = 1) or\n (dq.facility_npi_missing = 1) or\n (h.date_used_as_start_date is null) or\n\t(h.date_used_as_end_date is null) or\n\t(h.start_date > h.end_date) ) then 1\n else 0\n end as dq_problem,\n\n case\n when\n ( (dq.claim_start_date_not_unique = 1) or\n\t(dq.claim_start_date_missing = 1) or\n (dq.claim_end_date_not_unique = 1) or\n (dq.claim_end_date_missing = 1) or\n (dq.claim_start_date_after_claim_end_date = 1) or\n (dq.admission_date_not_unique = 1) or\n (dq.admission_date_missing = 1) or\n (dq.discharge_date_not_unique = 1) or\n (dq.discharge_date_missing = 1) or\n (dq.admission_date_after_discharge_date = 1) or\n (dq.admit_type_code_not_unique = 1) or\n (dq.admit_type_code_missing = 1) or\n (dq.admit_source_code_not_unique = 1) or\n (dq.admit_source_code_missing = 1) or\t\n (dq.claim_type_not_unique = 1) or\n (dq.claim_type_missing = 1) or\n (dq.claim_type_not_institutional = 1) ) then 1\n else 0\n end as dq_insight,\n\n case\n when (h.date_used_as_start_date is null) then 1\n else 0\n end as start_date_not_determined,\n \n case\n when (h.date_used_as_end_date is null) then 1\n else 0\n end as end_date_not_determined,\n\n case\n when (h.start_date > h.end_date) then 1\n else 0\n end as start_date_after_end_date,\n \n dq.patient_id_not_unique as patient_id_not_unique,\n dq.patient_id_missing as patient_id_missing,\n dq.claim_start_date_not_unique as claim_start_date_not_unique,\n dq.claim_start_date_missing as claim_start_date_missing,\n dq.claim_end_date_not_unique as claim_end_date_not_unique,\n dq.claim_end_date_missing as claim_end_date_missing,\n dq.claim_start_date_after_claim_end_date\n as claim_start_date_after_claim_end_date,\n dq.admission_date_not_unique as admission_date_not_unique,\n dq.admission_date_missing as admission_date_missing,\n dq.discharge_date_not_unique as discharge_date_not_unique,\n dq.discharge_date_missing as discharge_date_missing,\n dq.admission_date_after_discharge_date\n as admission_date_after_discharge_date,\n dq.admit_type_code_not_unique\n as admit_type_code_not_unique,\n dq.admit_type_code_missing\n as admit_type_code_missing,\n dq.admit_source_code_not_unique\n as admit_source_code_not_unique,\n dq.admit_source_code_missing\n as admit_source_code_missing,\n dq.discharge_disposition_code_not_unique\n as discharge_disposition_code_not_unique,\n dq.discharge_disposition_code_missing\n as discharge_disposition_code_missing,\n dq.facility_npi_not_unique as facility_npi_not_unique,\n dq.facility_npi_missing as facility_npi_missing,\n dq.claim_type_not_unique as claim_type_not_unique,\n dq.claim_type_missing as claim_type_missing,\n dq.claim_type_not_institutional as claim_type_not_institutional,\n h.data_source,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n\nfrom header_level_values h\nleft join data_quality_flags dq\n on h.claim_id = dq.claim_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.emergency_department__stg_medical_claim", "sql": " __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}, {"id": "model.the_tuva_project.emergency_department__stg_service_category", "sql": " __dbt__cte__emergency_department__stg_service_category as (\n\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.service_category_grouper\n)"}]}, "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__int_encounter_start_and_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_start_and_end_dates.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_start_and_end_dates.sql", "unique_id": "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_encounter_start_and_end_dates"], "alias": "_int_emergency_department_encounter_start_and_end_dates", "checksum": {"name": "sha256", "checksum": "ad00019be1b1cb0144f2ae596cea2ee9b8ad12b82791296e85d6f830d61b9ba1"}, "config": {"enabled": true, "alias": "_int_emergency_department_encounter_start_and_end_dates", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Defines encounter start and end dates for emergency_department encounters", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_encounter_start_and_end_dates", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.63826, "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_encounter_start_and_end_dates", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith add_encounter_id_to_emergency_department_encounters as (\r\nselect\r\n aip.claim_id as claim_id,\r\n aip.patient_id as patient_id,\r\n aip.start_date as start_date,\r\n aip.end_date as end_date,\r\n eid.encounter_id as encounter_id\r\nfrom {{ ref('emergency_department__int_institutional_claims') }} aip\r\nleft join {{ ref('emergency_department__int_institutional_encounter_id') }} eid\r\n on aip.patient_id = eid.patient_id\r\n and aip.claim_id = eid.claim_id\r\n),\r\n\r\nencounter_start_and_end_dates as (\r\nselect\r\n patient_id,\r\n encounter_id,\r\n min(start_date) as encounter_start_date,\r\n max(end_date) as encounter_end_date\r\nfrom add_encounter_id_to_emergency_department_encounters\r\ngroup by patient_id, encounter_id\r\n)\r\n\r\nselect \r\n patient_id\r\n , encounter_id\r\n , encounter_start_date\r\n , encounter_end_date\r\n , coalesce(encounter_start_date, encounter_end_date) as determined_encounter_start_date\r\n , coalesce(encounter_end_date, encounter_start_date) as determined_encounter_end_date\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom encounter_start_and_end_dates", "language": "sql", "refs": [["emergency_department__int_institutional_claims"], ["emergency_department__int_institutional_encounter_id"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__int_institutional_claims", "model.the_tuva_project.emergency_department__int_institutional_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_encounter_start_and_end_dates.sql", "compiled": true, "compiled_code": "\n\n\nwith add_encounter_id_to_emergency_department_encounters as (\nselect\n aip.claim_id as claim_id,\n aip.patient_id as patient_id,\n aip.start_date as start_date,\n aip.end_date as end_date,\n eid.encounter_id as encounter_id\nfrom dev_sarah.claims_preprocessing._int_emergency_department_institutional_claims aip\nleft join dev_sarah.claims_preprocessing._int_emergency_department_institutional_encounter_id eid\n on aip.patient_id = eid.patient_id\n and aip.claim_id = eid.claim_id\n),\n\nencounter_start_and_end_dates as (\nselect\n patient_id,\n encounter_id,\n min(start_date) as encounter_start_date,\n max(end_date) as encounter_end_date\nfrom add_encounter_id_to_emergency_department_encounters\ngroup by patient_id, encounter_id\n)\n\nselect \n patient_id\n , encounter_id\n , encounter_start_date\n , encounter_end_date\n , coalesce(encounter_start_date, encounter_end_date) as determined_encounter_start_date\n , coalesce(encounter_end_date, encounter_start_date) as determined_encounter_end_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom encounter_start_and_end_dates", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.emergency_department__int_last_claim_values": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__int_last_claim_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_last_claim_values.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_last_claim_values.sql", "unique_id": "model.the_tuva_project.emergency_department__int_last_claim_values", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_last_claim_values"], "alias": "_int_emergency_department_last_claim_values", "checksum": {"name": "sha256", "checksum": "97a7b2d07769eaf7a5b9fc418a1d3af9ab9b3aad7af437b0649e0316608baa2e"}, "config": {"enabled": true, "alias": "_int_emergency_department_last_claim_values", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Orders claims to pull out encounter details (discharge disposition, etc)", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_last_claim_values", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.649416, "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_last_claim_values", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith first_claim_values as(\r\n select distinct\r\n e.encounter_id\r\n , coalesce(claim_start_date, admission_date) as claim_start\r\n , discharge_disposition_code\r\n from {{ ref('emergency_department__int_encounter_id')}} e\r\n inner join {{ ref('emergency_department__stg_medical_claim') }} m\r\n on e.claim_id = m.claim_id\r\n where claim_type = 'institutional'\r\n)\r\n\r\nselect\r\n encounter_id\r\n , claim_start\r\n , discharge_disposition_code\r\n , row_number() over (partition by encounter_id order by claim_start desc) as claim_row\r\nfrom first_claim_values", "language": "sql", "refs": [["emergency_department__int_encounter_id"], ["emergency_department__stg_medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_last_claim_values.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n),first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , discharge_disposition_code\n from dev_sarah.claims_preprocessing._int_emergency_department_encounter_id e\n inner join __dbt__cte__emergency_department__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , discharge_disposition_code\n , row_number() over (partition by encounter_id order by claim_start desc) as claim_row\nfrom first_claim_values", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.emergency_department__stg_medical_claim", "sql": " __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.emergency_department__int_professional_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__int_professional_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_professional_encounter_id.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_professional_encounter_id.sql", "unique_id": "model.the_tuva_project.emergency_department__int_professional_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_professional_encounter_id"], "alias": "_int_emergency_department_professional_encounter_id", "checksum": {"name": "sha256", "checksum": "98f638f6f6f17f62a011ac58d24fe0d8b72c4b62ef6f71b363fab8b613bc64bb"}, "config": {"enabled": true, "alias": "_int_emergency_department_professional_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Assigns encounter_id to every emergency_department professional claim", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_professional_encounter_id", "tags": ["emergency_department", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.647255, "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_professional_encounter_id", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith emergency_department_professional_claim_ids as (\r\nselect \r\n claim_id\r\n , claim_line_number\r\nfrom {{ ref('emergency_department__stg_service_category') }} \r\nwhere claim_type = 'professional'\r\n and service_category_2 = 'Emergency Department'\r\n),\r\n\r\nemergency_department_professional_claim_lines as (\r\nselect\r\n mc.claim_id\r\n , mc.claim_line_number\r\n , mc.patient_id\r\n , mc.claim_start_date as start_date\r\n , mc.claim_end_date as end_date\t \r\nfrom {{ ref('emergency_department__stg_medical_claim') }} mc\r\ninner join emergency_department_professional_claim_ids prof\r\n on mc.claim_id = prof.claim_id\r\n and mc.claim_line_number = prof.claim_line_number\r\n),\r\n\r\n\r\nemergency_department_professional_claim_dates as (\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , patient_id\r\n , min(start_date) as start_date\r\n , max(end_date) as end_date\r\nfrom emergency_department_professional_claim_lines\r\ngroup by \r\n claim_id\r\n , claim_line_number\r\n , patient_id\r\n),\r\n\r\n\r\nroll_up_professional_claims_to_institutional_claims as (\r\n select\r\n aa.patient_id\r\n , aa.claim_id\r\n , aa.claim_line_number\r\n , aa.start_date\r\n , aa.end_date\r\n , bb.encounter_id\r\n , case\r\n when bb.encounter_id is null then 1\r\n else 0\r\n end as orphan_claim_flag\r\n from emergency_department_professional_claim_dates aa\r\n left join {{ ref('emergency_department__int_encounter_start_and_end_dates') }} bb\r\n on aa.patient_id = bb.patient_id\r\n and (coalesce(aa.start_date, aa.end_date) between coalesce(bb.encounter_start_date, bb.determined_encounter_start_date) and coalesce(bb.encounter_end_date, bb.determined_encounter_end_date))\r\n and (coalesce(aa.end_date, aa.start_date) between coalesce(bb.encounter_start_date, bb.determined_encounter_start_date) and coalesce(bb.encounter_end_date, bb.determined_encounter_end_date))\r\n),\r\n\r\nprofessional_claims_in_more_than_one_encounter as (\r\nselect\r\n patient_id\r\n , claim_id\r\n , claim_line_number\r\n , min(start_date) as start_date\r\n , max(end_date) as end_date\r\n , count(distinct encounter_id) as encounter_count\r\nfrom roll_up_professional_claims_to_institutional_claims\r\ngroup by patient_id, claim_id, claim_line_number\r\nhaving count(distinct encounter_id) > 1\r\n),\r\n\r\n\r\nprofessional_claims_not_in_more_than_one_encounter as (\r\nselect\r\n aa.patient_id,\r\n aa.claim_id,\r\n aa.claim_line_number,\r\n aa.start_date,\r\n aa.end_date,\r\n aa.encounter_id,\r\n aa.orphan_claim_flag,\r\n case\r\n when (aa.orphan_claim_flag = 1) then 0\r\n else 1\r\n end as encounter_count\r\nfrom roll_up_professional_claims_to_institutional_claims aa\r\nleft join professional_claims_in_more_than_one_encounter bb\r\non aa.claim_id = bb.claim_id\r\nand aa.claim_line_number = bb.claim_line_number\r\nand aa.patient_id = bb.patient_id\r\nwhere (bb.patient_id is null) and (bb.claim_id is null)\r\n),\r\n\r\n\r\nall_emergency_department_professional_claims as (\r\nselect\r\n patient_id,\r\n claim_id,\r\n claim_line_number,\r\n start_date,\r\n end_date,\r\n encounter_id,\r\n orphan_claim_flag,\r\n encounter_count\r\nfrom professional_claims_not_in_more_than_one_encounter\r\n\r\nunion all\r\n\r\nselect\r\n patient_id,\r\n claim_id,\r\n claim_line_number,\r\n start_date,\r\n end_date,\r\n null as encounter_id,\r\n 0 as orphan_claim_count,\r\n encounter_count\r\nfrom professional_claims_in_more_than_one_encounter\r\n)\r\n\r\n\r\n\r\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom all_emergency_department_professional_claims", "language": "sql", "refs": [["emergency_department__stg_service_category"], ["emergency_department__stg_medical_claim"], ["emergency_department__int_encounter_start_and_end_dates"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__stg_service_category", "model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_professional_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__emergency_department__stg_service_category as (\n\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.service_category_grouper\n), __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n),emergency_department_professional_claim_ids as (\nselect \n claim_id\n , claim_line_number\nfrom __dbt__cte__emergency_department__stg_service_category \nwhere claim_type = 'professional'\n and service_category_2 = 'Emergency Department'\n),\n\nemergency_department_professional_claim_lines as (\nselect\n mc.claim_id\n , mc.claim_line_number\n , mc.patient_id\n , mc.claim_start_date as start_date\n , mc.claim_end_date as end_date\t \nfrom __dbt__cte__emergency_department__stg_medical_claim mc\ninner join emergency_department_professional_claim_ids prof\n on mc.claim_id = prof.claim_id\n and mc.claim_line_number = prof.claim_line_number\n),\n\n\nemergency_department_professional_claim_dates as (\nselect\n claim_id\n , claim_line_number\n , patient_id\n , min(start_date) as start_date\n , max(end_date) as end_date\nfrom emergency_department_professional_claim_lines\ngroup by \n claim_id\n , claim_line_number\n , patient_id\n),\n\n\nroll_up_professional_claims_to_institutional_claims as (\n select\n aa.patient_id\n , aa.claim_id\n , aa.claim_line_number\n , aa.start_date\n , aa.end_date\n , bb.encounter_id\n , case\n when bb.encounter_id is null then 1\n else 0\n end as orphan_claim_flag\n from emergency_department_professional_claim_dates aa\n left join dev_sarah.claims_preprocessing._int_emergency_department_encounter_start_and_end_dates bb\n on aa.patient_id = bb.patient_id\n and (coalesce(aa.start_date, aa.end_date) between coalesce(bb.encounter_start_date, bb.determined_encounter_start_date) and coalesce(bb.encounter_end_date, bb.determined_encounter_end_date))\n and (coalesce(aa.end_date, aa.start_date) between coalesce(bb.encounter_start_date, bb.determined_encounter_start_date) and coalesce(bb.encounter_end_date, bb.determined_encounter_end_date))\n),\n\nprofessional_claims_in_more_than_one_encounter as (\nselect\n patient_id\n , claim_id\n , claim_line_number\n , min(start_date) as start_date\n , max(end_date) as end_date\n , count(distinct encounter_id) as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims\ngroup by patient_id, claim_id, claim_line_number\nhaving count(distinct encounter_id) > 1\n),\n\n\nprofessional_claims_not_in_more_than_one_encounter as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.orphan_claim_flag,\n case\n when (aa.orphan_claim_flag = 1) then 0\n else 1\n end as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims aa\nleft join professional_claims_in_more_than_one_encounter bb\non aa.claim_id = bb.claim_id\nand aa.claim_line_number = bb.claim_line_number\nand aa.patient_id = bb.patient_id\nwhere (bb.patient_id is null) and (bb.claim_id is null)\n),\n\n\nall_emergency_department_professional_claims as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n encounter_id,\n orphan_claim_flag,\n encounter_count\nfrom professional_claims_not_in_more_than_one_encounter\n\nunion all\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n null as encounter_id,\n 0 as orphan_claim_count,\n encounter_count\nfrom professional_claims_in_more_than_one_encounter\n)\n\n\n\nselect *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom all_emergency_department_professional_claims", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.emergency_department__stg_service_category", "sql": " __dbt__cte__emergency_department__stg_service_category as (\n\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.service_category_grouper\n)"}, {"id": "model.the_tuva_project.emergency_department__stg_medical_claim", "sql": " __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.emergency_department__int_institutional_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__int_institutional_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_encounter_id.sql", "original_file_path": "models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_encounter_id.sql", "unique_id": "model.the_tuva_project.emergency_department__int_institutional_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "emergency_department", "intermediate", "emergency_department__int_institutional_encounter_id"], "alias": "_int_emergency_department_institutional_encounter_id", "checksum": {"name": "sha256", "checksum": "47389ee5e825ebe802761f9ee313c78f1464b0b094d2b6043c037947c1a8eafd"}, "config": {"enabled": true, "alias": "_int_emergency_department_institutional_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "claims_preprocessing"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["emergency_department", "claims_preprocessing"], "description": "Assigns encounter_id to every emergency_department institutional claim", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_institutional_encounter_id", "tags": ["emergency_department", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.645091, "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_institutional_encounter_id", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith add_row_num as (\r\nselect\r\n patient_id,\r\n claim_id,\r\n start_date,\r\n end_date,\r\n discharge_disposition_code,\r\n facility_npi,\r\n row_number() over (partition by patient_id order by end_date, start_date, claim_id) as row_num\r\nfrom {{ ref('emergency_department__int_institutional_claims') }}\r\n),\r\n\r\ncheck_for_merges_with_larger_row_num as (\r\nselect\r\n aa.patient_id,\r\n aa.claim_id as claim_id_a,\r\n bb.claim_id as claim_id_b,\r\n aa.row_num as row_num_a,\r\n bb.row_num as row_num_b,\r\n case\r\n -- Claims with same end_date and same facility_npi should be merged:\r\n when (aa.end_date = bb.end_date\r\n and aa.facility_npi = bb.facility_npi) then 1\r\n -- Claims with different end_date \r\n -- should be merged if they overlap:\r\n when ( (aa.end_date <> bb.end_date) and \r\n (aa.end_date >= bb.start_date) and --overlap requirement\r\n (aa.facility_npi = bb.facility_npi)\r\n\t )then 1\r\n else 0\r\n end as merge_flag\r\nfrom add_row_num aa\r\n inner join add_row_num bb\r\n on aa.patient_id = bb.patient_id\r\n and aa.row_num < bb.row_num\r\n),\r\n\r\nmerges_with_larger_row_num as (\r\nselect\r\n patient_id,\r\n claim_id_a,\r\n claim_id_b,\r\n row_num_a,\r\n row_num_b,\r\n merge_flag\r\nfrom check_for_merges_with_larger_row_num\r\nwhere merge_flag = 1\r\n),\r\n\r\n\r\nclaim_ids_that_merge_with_larger_row_num as (\r\nselect distinct claim_id_a as claim_id\r\nfrom merges_with_larger_row_num\r\n),\r\n\r\n\r\nclaim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\r\nselect distinct aa.claim_id as claim_id\r\nfrom add_row_num aa\r\n inner join\r\n merges_with_larger_row_num bb\r\n on aa.patient_id = bb.patient_id\r\n and bb.row_num_a < aa.row_num\r\n and bb.row_num_b > aa.row_num\r\n),\r\n\r\n\r\nclose_flags as (\r\nselect\r\n aa.patient_id,\r\n aa.claim_id,\r\n aa.start_date,\r\n aa.end_date,\r\n aa.discharge_disposition_code,\r\n aa.facility_npi,\r\n aa.row_num,\r\n case when (bb.claim_id is null and cc.claim_id is null) then 1\r\n else 0\r\n end as close_flag\r\n\r\nfrom add_row_num aa\r\n\r\nleft join claim_ids_that_merge_with_larger_row_num bb\r\non aa.claim_id = bb.claim_id\r\n\r\nleft join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num cc\r\non aa.claim_id = cc.claim_id\r\n),\r\n\r\n\r\njoin_every_row_to_later_closes as (\r\nselect\r\n aa.patient_id as patient_id,\r\n aa.claim_id as claim_id,\r\n aa.row_num as row_num,\r\n bb.row_num as row_num_b\r\nfrom close_flags aa inner join close_flags bb\r\n on aa.patient_id = bb.patient_id\r\n and aa.row_num <= bb.row_num\r\nwhere bb.close_flag = 1\r\n),\r\n\r\n\r\nfind_min_closing_row_num_for_every_claim as (\r\nselect\r\n patient_id,\r\n claim_id,\r\n min(row_num_b) as min_closing_row\r\nfrom join_every_row_to_later_closes\r\ngroup by patient_id, claim_id\r\n),\r\n\r\n\r\nadd_min_closing_row_to_every_claim as (\r\nselect\r\n aa.patient_id as patient_id,\r\n aa.claim_id as claim_id,\r\n aa.start_date as start_date,\r\n aa.end_date as end_date,\r\n aa.discharge_disposition_code as discharge_disposition_code,\r\n aa.facility_npi as facility_npi,\r\n aa.row_num as row_num,\r\n aa.close_flag as close_flag,\r\n bb.min_closing_row as min_closing_row\r\nfrom close_flags aa\r\n left join find_min_closing_row_num_for_every_claim bb\r\n on aa.patient_id = bb.patient_id\r\n and aa.claim_id = bb.claim_id\r\n),\r\n\r\n\r\nadd_encounter_id as (\r\nselect\r\n aa.patient_id as patient_id,\r\n aa.claim_id as claim_id,\r\n aa.start_date as start_date,\r\n aa.end_date as end_date,\r\n aa.discharge_disposition_code as discharge_disposition_code,\r\n aa.facility_npi as facility_npi,\r\n aa.row_num as row_num,\r\n aa.close_flag as close_flag,\r\n aa.min_closing_row as min_closing_row,\r\n bb.claim_id as encounter_id\r\nfrom add_min_closing_row_to_every_claim aa\r\n left join add_min_closing_row_to_every_claim bb\r\n on aa.patient_id = bb.patient_id\r\n and aa.min_closing_row = bb.row_num\r\n)\r\n\r\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom add_encounter_id", "language": "sql", "refs": [["emergency_department__int_institutional_claims"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__int_institutional_claims"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/emergency_department/intermediate/emergency_department__int_institutional_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nwith add_row_num as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_npi,\n row_number() over (partition by patient_id order by end_date, start_date, claim_id) as row_num\nfrom dev_sarah.claims_preprocessing._int_emergency_department_institutional_claims\n),\n\ncheck_for_merges_with_larger_row_num as (\nselect\n aa.patient_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_npi should be merged:\n when (aa.end_date = bb.end_date\n and aa.facility_npi = bb.facility_npi) then 1\n -- Claims with different end_date \n -- should be merged if they overlap:\n when ( (aa.end_date <> bb.end_date) and \n (aa.end_date >= bb.start_date) and --overlap requirement\n (aa.facility_npi = bb.facility_npi)\n\t )then 1\n else 0\n end as merge_flag\nfrom add_row_num aa\n inner join add_row_num bb\n on aa.patient_id = bb.patient_id\n and aa.row_num < bb.row_num\n),\n\nmerges_with_larger_row_num as (\nselect\n patient_id,\n claim_id_a,\n claim_id_b,\n row_num_a,\n row_num_b,\n merge_flag\nfrom check_for_merges_with_larger_row_num\nwhere merge_flag = 1\n),\n\n\nclaim_ids_that_merge_with_larger_row_num as (\nselect distinct claim_id_a as claim_id\nfrom merges_with_larger_row_num\n),\n\n\nclaim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\nselect distinct aa.claim_id as claim_id\nfrom add_row_num aa\n inner join\n merges_with_larger_row_num bb\n on aa.patient_id = bb.patient_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n),\n\n\nclose_flags as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.discharge_disposition_code,\n aa.facility_npi,\n aa.row_num,\n case when (bb.claim_id is null and cc.claim_id is null) then 1\n else 0\n end as close_flag\n\nfrom add_row_num aa\n\nleft join claim_ids_that_merge_with_larger_row_num bb\non aa.claim_id = bb.claim_id\n\nleft join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num cc\non aa.claim_id = cc.claim_id\n),\n\n\njoin_every_row_to_later_closes as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.row_num as row_num,\n bb.row_num as row_num_b\nfrom close_flags aa inner join close_flags bb\n on aa.patient_id = bb.patient_id\n and aa.row_num <= bb.row_num\nwhere bb.close_flag = 1\n),\n\n\nfind_min_closing_row_num_for_every_claim as (\nselect\n patient_id,\n claim_id,\n min(row_num_b) as min_closing_row\nfrom join_every_row_to_later_closes\ngroup by patient_id, claim_id\n),\n\n\nadd_min_closing_row_to_every_claim as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n bb.min_closing_row as min_closing_row\nfrom close_flags aa\n left join find_min_closing_row_num_for_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.claim_id = bb.claim_id\n),\n\n\nadd_encounter_id as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n aa.min_closing_row as min_closing_row,\n bb.claim_id as encounter_id\nfrom add_min_closing_row_to_every_claim aa\n left join add_min_closing_row_to_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": []}, "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": "eaf70f97b4939050012ee673ec5483aa0bd65bbec55daedd76e52722d1c10f79"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.8521652, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , claim_type\r\n , patient_id\r\n , member_id\r\n , payer\r\n , plan\r\n , claim_start_date\r\n , claim_end_date\r\n , claim_line_start_date\r\n , claim_line_end_date\r\n , admission_date\r\n , discharge_date\r\n , admit_source_code\r\n , admit_type_code\r\n , discharge_disposition_code\r\n , place_of_service_code\r\n , bill_type_code\r\n , ms_drg_code\r\n , apr_drg_code\r\n , revenue_center_code\r\n , service_unit_quantity\r\n , hcpcs_code\r\n , hcpcs_modifier_1\r\n , hcpcs_modifier_2\r\n , hcpcs_modifier_3\r\n , hcpcs_modifier_4\r\n , hcpcs_modifier_5\r\n , rendering_npi\r\n , billing_npi\r\n , facility_npi\r\n , paid_date\r\n , paid_amount\r\n , allowed_amount\r\n , charge_amount\r\n , coinsurance_amount\r\n , copayment_amount\r\n , deductible_amount\r\n , total_cost_amount\r\n , diagnosis_code_type\r\n , diagnosis_code_1\r\n , diagnosis_code_2\r\n , diagnosis_code_3\r\n , diagnosis_code_4\r\n , diagnosis_code_5\r\n , diagnosis_code_6\r\n , diagnosis_code_7\r\n , diagnosis_code_8\r\n , diagnosis_code_9\r\n , diagnosis_code_10\r\n , diagnosis_code_11\r\n , diagnosis_code_12\r\n , diagnosis_code_13\r\n , diagnosis_code_14\r\n , diagnosis_code_15\r\n , diagnosis_code_16\r\n , diagnosis_code_17\r\n , diagnosis_code_18\r\n , diagnosis_code_19\r\n , diagnosis_code_20\r\n , diagnosis_code_21\r\n , diagnosis_code_22\r\n , diagnosis_code_23\r\n , diagnosis_code_24\r\n , diagnosis_code_25\r\n , diagnosis_poa_1\r\n , diagnosis_poa_2\r\n , diagnosis_poa_3\r\n , diagnosis_poa_4\r\n , diagnosis_poa_5\r\n , diagnosis_poa_6\r\n , diagnosis_poa_7\r\n , diagnosis_poa_8\r\n , diagnosis_poa_9\r\n , diagnosis_poa_10\r\n , diagnosis_poa_11\r\n , diagnosis_poa_12\r\n , diagnosis_poa_13\r\n , diagnosis_poa_14\r\n , diagnosis_poa_15\r\n , diagnosis_poa_16\r\n , diagnosis_poa_17\r\n , diagnosis_poa_18\r\n , diagnosis_poa_19\r\n , diagnosis_poa_20\r\n , diagnosis_poa_21\r\n , diagnosis_poa_22\r\n , diagnosis_poa_23\r\n , diagnosis_poa_24\r\n , diagnosis_poa_25\r\n , procedure_code_type\r\n , procedure_code_1\r\n , procedure_code_2\r\n , procedure_code_3\r\n , procedure_code_4\r\n , procedure_code_5\r\n , procedure_code_6\r\n , procedure_code_7\r\n , procedure_code_8\r\n , procedure_code_9\r\n , procedure_code_10\r\n , procedure_code_11\r\n , procedure_code_12\r\n , procedure_code_13\r\n , procedure_code_14\r\n , procedure_code_15\r\n , procedure_code_16\r\n , procedure_code_17\r\n , procedure_code_18\r\n , procedure_code_19\r\n , procedure_code_20\r\n , procedure_code_21\r\n , procedure_code_22\r\n , procedure_code_23\r\n , procedure_code_24\r\n , procedure_code_25\r\n , procedure_date_1\r\n , procedure_date_2\r\n , procedure_date_3\r\n , procedure_date_4\r\n , procedure_date_5\r\n , procedure_date_6\r\n , procedure_date_7\r\n , procedure_date_8\r\n , procedure_date_9\r\n , procedure_date_10\r\n , procedure_date_11\r\n , procedure_date_12\r\n , procedure_date_13\r\n , procedure_date_14\r\n , procedure_date_15\r\n , procedure_date_16\r\n , procedure_date_17\r\n , procedure_date_18\r\n , procedure_date_19\r\n , procedure_date_20\r\n , procedure_date_21\r\n , procedure_date_22\r\n , procedure_date_23\r\n , procedure_date_24\r\n , procedure_date_25\r\n , data_source\r\nfrom {{ ref('medical_claim') }}", "language": "sql", "refs": [["medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim", "extra_ctes_injected": true, "extra_ctes": []}, "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": "1ee6891e10952c2c81f3f999533b13b161c75aad32abd5040dbb32668298f510"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.8537228, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , patient_id\r\n , member_id\r\n , payer\r\n , plan\r\n , prescribing_provider_npi\r\n , dispensing_provider_npi\r\n , dispensing_date\r\n , ndc_code\r\n , quantity\r\n , days_supply\r\n , refills\r\n , paid_date\r\n , paid_amount\r\n , allowed_amount\r\n , coinsurance_amount\r\n , copayment_amount\r\n , deductible_amount\r\n , data_source\r\nfrom {{ ref('pharmacy_claim') }}", "language": "sql", "refs": [["pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\nfrom tuva.input_layer.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": []}, "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": "5eafa446e34549f9a1f2152ff1a82cb433d39fe6697ca4b8e91f867f05ca982d"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.850212, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n patient_id\r\n , patient_id||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\r\n , member_id\r\n , gender\r\n , race\r\n , birth_date\r\n , death_date\r\n , death_flag\r\n , enrollment_start_date\r\n , enrollment_end_date\r\n , payer\r\n , payer_type\r\n , plan\r\n , original_reason_entitlement_code\r\n , dual_status_code\r\n , medicare_status_code\r\n , first_name\r\n , last_name\r\n , address\r\n , city\r\n , state\r\n , zip_code\r\n , phone\r\n , data_source\r\nfrom {{ ref('eligibility') }}", "language": "sql", "refs": [["eligibility"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\nfrom tuva.input_layer.eligibility", "extra_ctes_injected": true, "extra_ctes": []}, "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": "d630521dee0714777fd7f0a832464b06f20100c5f49b37c0a8621685bcbd54e3"}, "config": {"enabled": true, "alias": "normalized_input_eligibility", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "Date the patient was born.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "Date the patient died.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.749242, "relation_name": "dev_sarah.claims_preprocessing.normalized_input_eligibility", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n cast(elig.patient_id as {{ dbt.type_string() }} ) as patient_id\r\n , cast(elig.member_id as {{ dbt.type_string() }} ) as member_id\r\n , cast(elig.gender as {{ dbt.type_string() }} ) as gender\r\n , cast(elig.race as {{ dbt.type_string() }} ) as race\r\n , cast(date_norm.normalized_birth_date as date ) as birth_date\r\n , cast(date_norm.normalized_death_date as date ) as death_date\r\n , cast(elig.death_flag as int ) as death_flag\r\n , cast(date_norm.normalized_enrollment_start_date as date ) as enrollment_start_date\r\n , cast(date_norm.normalized_enrollment_end_date as date ) as enrollment_end_date\r\n , cast(elig.payer as {{ dbt.type_string() }} ) as payer\r\n , cast(elig.payer_type as {{ dbt.type_string() }} ) as payer_type\r\n , cast(elig.plan as {{ dbt.type_string() }} ) as plan\r\n , cast(elig.original_reason_entitlement_code as {{ dbt.type_string() }} ) as original_reason_entitlement_code\r\n , cast(elig.dual_status_code as {{ dbt.type_string() }} ) as dual_status_code\r\n , cast(elig.medicare_status_code as {{ dbt.type_string() }} ) as medicare_status_code\r\n , cast(elig.first_name as {{ dbt.type_string() }} ) as first_name\r\n , cast(elig.last_name as {{ dbt.type_string() }} ) as last_name\r\n , cast(elig.address as {{ dbt.type_string() }} ) as address\r\n , cast(elig.city as {{ dbt.type_string() }} ) as city\r\n , cast(elig.state as {{ dbt.type_string() }} ) as state\r\n , cast(elig.zip_code as {{ dbt.type_string() }} ) as zip_code\r\n , cast(elig.phone as {{ dbt.type_string() }} ) as phone\r\n , cast(elig.data_source as {{ dbt.type_string() }} ) as data_source\r\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_eligibility') }} elig\r\nleft join {{ ref('normalized_input__int_eligibility_dates_normalize') }} date_norm\r\n on elig.patient_id_key = date_norm.patient_id_key", "language": "sql", "refs": [["normalized_input__stg_eligibility"], ["normalized_input__int_eligibility_dates_normalize"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\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.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.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-02-21 19:58:21.989699+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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\nfrom tuva.input_layer.eligibility\n)"}]}, "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": "5af915af398c991d649a9b70bd7c951c8db80c16d046e144037e2b9faf12aad0"}, "config": {"enabled": true, "alias": "normalized_input_pharmacy_claim", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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", "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer", "meta": {}, "data_type": null, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Number of doses.", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the prescription.", "meta": {}, "data_type": "integer", "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date the claim was paid.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid by the health insurer for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "Contractual amount allowed to be paid by the payer + patient.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.7721002, "relation_name": "dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n cast(claim_id as {{ dbt.type_string() }} ) as claim_id\r\n , cast(claim_line_number as int ) as claim_line_number\r\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\r\n , cast(member_id as {{ dbt.type_string() }} ) as member_id\r\n , cast(payer as {{ dbt.type_string() }} ) as payer\r\n , cast(plan as {{ dbt.type_string() }} ) as plan\r\n , cast(prescribing_provider_npi as {{ dbt.type_string() }} ) as prescribing_provider_npi\r\n , cast(dispensing_provider_npi as {{ dbt.type_string() }} ) as dispensing_provider_npi\r\n , cast(dispensing_date as date ) as dispensing_date\r\n , cast(ndc_code as {{ dbt.type_string() }} ) as ndc_code\r\n , cast(quantity as int ) as quantity\r\n , cast(days_supply as int ) as days_supply\r\n , cast(refills as int ) as refills\r\n , cast(paid_date as date ) as paid_date\r\n , cast(paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\r\n , cast(allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\r\n , cast(coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\r\n , cast(copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\r\n , cast(deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\r\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\r\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_pharmacy_claim') }}", "language": "sql", "refs": [["normalized_input__stg_pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.normalized_input__stg_pharmacy_claim"]}, "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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\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_npi\n , cast(dispensing_provider_npi as TEXT ) as dispensing_provider_npi\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\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(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(data_source as TEXT ) as data_source\n , cast('2024-02-21 19:58:21.989699+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_pharmacy_claim", "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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\nfrom tuva.input_layer.pharmacy_claim\n)"}]}, "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": "160c9a880ff71b8b9456d364e0cf42cc6a103d83eed2befa6d6548cc79d2e6c9"}, "config": {"enabled": true, "alias": "normalized_input_medical_claim", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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", "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, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer", "meta": {}, "data_type": null, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "Start date for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_line_start_date": {"name": "claim_line_start_date", "description": "Start date for the claim line.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_line_end_date": {"name": "claim_line_end_date", "description": "End date for the claim line.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "Admission date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Discharge date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "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, "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, "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", "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, "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, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "The date the claim was paid.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid on the claim by the insurer.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "The type of encounter this claim belongs to.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "The encounter_id for the encounter that this claims belongs to.\n", "meta": {}, "data_type": null, "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.763786, "relation_name": "dev_sarah.claims_preprocessing.normalized_input_medical_claim", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n\tcast(med.claim_id as {{ dbt.type_string() }} ) as claim_id\r\n\t, cast(med.claim_line_number as int ) as claim_line_number\r\n\t, cast(med.claim_type as {{ dbt.type_string() }} ) as claim_type\r\n\t, cast(med.patient_id as {{ dbt.type_string() }} ) as patient_id\r\n\t, cast(med.member_id as {{ dbt.type_string() }} ) as member_id\r\n\t, cast(med.payer as {{ dbt.type_string() }} ) as payer\r\n\t, cast(med.plan as {{ dbt.type_string() }} ) as plan\r\n\t, cast(coalesce(dates.minimum_claim_start_date, undetermined.claim_start_date) as date ) as claim_start_date\r\n\t, cast(coalesce(dates.maximum_claim_end_date, undetermined.claim_start_date) as date ) as claim_end_date\r\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_start_date, undetermined.claim_line_start_date) as date ) as claim_line_start_date\r\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_end_date, undetermined.claim_line_end_date) as date ) as claim_line_end_date\r\n\t, cast(coalesce(dates.minimum_admission_date, undetermined.admission_date) as date ) as admission_date\r\n\t, cast(coalesce(dates.maximum_discharge_date, undetermined.discharge_date) as date ) as discharge_date\r\n\t, cast(coalesce(ad_source.normalized_code, undetermined.admit_source_code) as {{ dbt.type_string() }} ) as admit_source_code\r\n\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as {{ dbt.type_string() }} ) as admit_type_code\r\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as {{ dbt.type_string() }} ) as discharge_disposition_code\r\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as {{ dbt.type_string() }} ) as place_of_service_code\r\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as {{ dbt.type_string() }} ) as bill_type_code\r\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as {{ dbt.type_string() }} ) as ms_drg_code\r\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as {{ dbt.type_string() }} ) as apr_drg_code\r\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as {{ dbt.type_string() }} ) as revenue_center_code\r\n\t, cast(med.service_unit_quantity as {{ dbt.type_string() }} ) as service_unit_quantity\r\n\t, cast(med.hcpcs_code as {{ dbt.type_string() }} ) as hcpcs_code\r\n\t, cast(med.hcpcs_modifier_1 as {{ dbt.type_string() }} ) as hcpcs_modifier_1\r\n\t, cast(med.hcpcs_modifier_2 as {{ dbt.type_string() }} ) as hcpcs_modifier_2\r\n\t, cast(med.hcpcs_modifier_3 as {{ dbt.type_string() }} ) as hcpcs_modifier_3\r\n\t, cast(med.hcpcs_modifier_4 as {{ dbt.type_string() }} ) as hcpcs_modifier_4\r\n\t, cast(med.hcpcs_modifier_5 as {{ dbt.type_string() }} ) as hcpcs_modifier_5\r\n\t, cast(coalesce(med_npi.normalized_rendering_npi, undetermined.rendering_npi) as {{ dbt.type_string() }} ) as rendering_npi\r\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as {{ dbt.type_string() }} ) as billing_npi\r\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as {{ dbt.type_string() }} ) as facility_npi\r\n\t, cast(med.paid_date as date ) as paid_date\r\n\t, cast(med.paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\r\n\t, cast(med.allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\r\n\t, cast(med.charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\r\n\t, cast(med.coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\r\n\t, cast(med.copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\r\n\t, cast(med.deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\r\n\t, cast(med.total_cost_amount as {{ dbt.type_numeric() }} ) as total_cost_amount\r\n\t, cast(med.diagnosis_code_type as {{ dbt.type_string() }} ) as diagnosis_code_type\r\n\t, cast(coalesce(dx_code.diagnosis_code_1, undetermined.diagnosis_code_1) as {{ dbt.type_string() }} ) as diagnosis_code_1\r\n\t, cast(coalesce(dx_code.diagnosis_code_2, undetermined.diagnosis_code_2) as {{ dbt.type_string() }} ) as diagnosis_code_2\r\n\t, cast(coalesce(dx_code.diagnosis_code_3, undetermined.diagnosis_code_3) as {{ dbt.type_string() }} ) as diagnosis_code_3\r\n\t, cast(coalesce(dx_code.diagnosis_code_4, undetermined.diagnosis_code_4) as {{ dbt.type_string() }} ) as diagnosis_code_4\r\n\t, cast(coalesce(dx_code.diagnosis_code_5, undetermined.diagnosis_code_5) as {{ dbt.type_string() }} ) as diagnosis_code_5\r\n\t, cast(coalesce(dx_code.diagnosis_code_6, undetermined.diagnosis_code_6) as {{ dbt.type_string() }} ) as diagnosis_code_6\r\n\t, cast(coalesce(dx_code.diagnosis_code_7, undetermined.diagnosis_code_7) as {{ dbt.type_string() }} ) as diagnosis_code_7\r\n\t, cast(coalesce(dx_code.diagnosis_code_8, undetermined.diagnosis_code_8) as {{ dbt.type_string() }} ) as diagnosis_code_8\r\n\t, cast(coalesce(dx_code.diagnosis_code_9, undetermined.diagnosis_code_9) as {{ dbt.type_string() }} ) as diagnosis_code_9\r\n\t, cast(coalesce(dx_code.diagnosis_code_10, undetermined.diagnosis_code_10) as {{ dbt.type_string() }} ) as diagnosis_code_10\r\n\t, cast(coalesce(dx_code.diagnosis_code_11, undetermined.diagnosis_code_11) as {{ dbt.type_string() }} ) as diagnosis_code_11\r\n\t, cast(coalesce(dx_code.diagnosis_code_12, undetermined.diagnosis_code_12) as {{ dbt.type_string() }} ) as diagnosis_code_12\r\n\t, cast(coalesce(dx_code.diagnosis_code_13, undetermined.diagnosis_code_13) as {{ dbt.type_string() }} ) as diagnosis_code_13\r\n\t, cast(coalesce(dx_code.diagnosis_code_14, undetermined.diagnosis_code_14) as {{ dbt.type_string() }} ) as diagnosis_code_14\r\n\t, cast(coalesce(dx_code.diagnosis_code_15, undetermined.diagnosis_code_15) as {{ dbt.type_string() }} ) as diagnosis_code_15\r\n\t, cast(coalesce(dx_code.diagnosis_code_16, undetermined.diagnosis_code_16) as {{ dbt.type_string() }} ) as diagnosis_code_16\r\n\t, cast(coalesce(dx_code.diagnosis_code_17, undetermined.diagnosis_code_17) as {{ dbt.type_string() }} ) as diagnosis_code_17\r\n\t, cast(coalesce(dx_code.diagnosis_code_18, undetermined.diagnosis_code_18) as {{ dbt.type_string() }} ) as diagnosis_code_18\r\n\t, cast(coalesce(dx_code.diagnosis_code_19, undetermined.diagnosis_code_19) as {{ dbt.type_string() }} ) as diagnosis_code_19\r\n\t, cast(coalesce(dx_code.diagnosis_code_20, undetermined.diagnosis_code_20) as {{ dbt.type_string() }} ) as diagnosis_code_20\r\n\t, cast(coalesce(dx_code.diagnosis_code_21, undetermined.diagnosis_code_21) as {{ dbt.type_string() }} ) as diagnosis_code_21\r\n\t, cast(coalesce(dx_code.diagnosis_code_22, undetermined.diagnosis_code_22) as {{ dbt.type_string() }} ) as diagnosis_code_22\r\n\t, cast(coalesce(dx_code.diagnosis_code_23, undetermined.diagnosis_code_23) as {{ dbt.type_string() }} ) as diagnosis_code_23\r\n\t, cast(coalesce(dx_code.diagnosis_code_24, undetermined.diagnosis_code_24) as {{ dbt.type_string() }} ) as diagnosis_code_24\r\n\t, cast(coalesce(dx_code.diagnosis_code_25, undetermined.diagnosis_code_25) as {{ dbt.type_string() }} ) as diagnosis_code_25\r\n\t, cast(coalesce(poa.diagnosis_poa_1, undetermined.diagnosis_poa_1) as {{ dbt.type_string() }} ) as diagnosis_poa_1\r\n\t, cast(coalesce(poa.diagnosis_poa_2, undetermined.diagnosis_poa_2) as {{ dbt.type_string() }} ) as diagnosis_poa_2\r\n\t, cast(coalesce(poa.diagnosis_poa_3, undetermined.diagnosis_poa_3) as {{ dbt.type_string() }} ) as diagnosis_poa_3\r\n\t, cast(coalesce(poa.diagnosis_poa_4, undetermined.diagnosis_poa_4) as {{ dbt.type_string() }} ) as diagnosis_poa_4\r\n\t, cast(coalesce(poa.diagnosis_poa_5, undetermined.diagnosis_poa_5) as {{ dbt.type_string() }} ) as diagnosis_poa_5\r\n\t, cast(coalesce(poa.diagnosis_poa_6, undetermined.diagnosis_poa_6) as {{ dbt.type_string() }} ) as diagnosis_poa_6\r\n\t, cast(coalesce(poa.diagnosis_poa_7, undetermined.diagnosis_poa_7) as {{ dbt.type_string() }} ) as diagnosis_poa_7\r\n\t, cast(coalesce(poa.diagnosis_poa_8, undetermined.diagnosis_poa_8) as {{ dbt.type_string() }} ) as diagnosis_poa_8\r\n\t, cast(coalesce(poa.diagnosis_poa_9, undetermined.diagnosis_poa_9) as {{ dbt.type_string() }} ) as diagnosis_poa_9\r\n\t, cast(coalesce(poa.diagnosis_poa_10, undetermined.diagnosis_poa_10) as {{ dbt.type_string() }} ) as diagnosis_poa_10\r\n\t, cast(coalesce(poa.diagnosis_poa_11, undetermined.diagnosis_poa_11) as {{ dbt.type_string() }} ) as diagnosis_poa_11\r\n\t, cast(coalesce(poa.diagnosis_poa_12, undetermined.diagnosis_poa_12) as {{ dbt.type_string() }} ) as diagnosis_poa_12\r\n\t, cast(coalesce(poa.diagnosis_poa_13, undetermined.diagnosis_poa_13) as {{ dbt.type_string() }} ) as diagnosis_poa_13\r\n\t, cast(coalesce(poa.diagnosis_poa_14, undetermined.diagnosis_poa_14) as {{ dbt.type_string() }} ) as diagnosis_poa_14\r\n\t, cast(coalesce(poa.diagnosis_poa_15, undetermined.diagnosis_poa_15) as {{ dbt.type_string() }} ) as diagnosis_poa_15\r\n\t, cast(coalesce(poa.diagnosis_poa_16, undetermined.diagnosis_poa_16) as {{ dbt.type_string() }} ) as diagnosis_poa_16\r\n\t, cast(coalesce(poa.diagnosis_poa_17, undetermined.diagnosis_poa_17) as {{ dbt.type_string() }} ) as diagnosis_poa_17\r\n\t, cast(coalesce(poa.diagnosis_poa_18, undetermined.diagnosis_poa_18) as {{ dbt.type_string() }} ) as diagnosis_poa_18\r\n\t, cast(coalesce(poa.diagnosis_poa_19, undetermined.diagnosis_poa_19) as {{ dbt.type_string() }} ) as diagnosis_poa_19\r\n\t, cast(coalesce(poa.diagnosis_poa_20, undetermined.diagnosis_poa_20) as {{ dbt.type_string() }} ) as diagnosis_poa_20\r\n\t, cast(coalesce(poa.diagnosis_poa_21, undetermined.diagnosis_poa_21) as {{ dbt.type_string() }} ) as diagnosis_poa_21\r\n\t, cast(coalesce(poa.diagnosis_poa_22, undetermined.diagnosis_poa_22) as {{ dbt.type_string() }} ) as diagnosis_poa_22\r\n\t, cast(coalesce(poa.diagnosis_poa_23, undetermined.diagnosis_poa_23) as {{ dbt.type_string() }} ) as diagnosis_poa_23\r\n\t, cast(coalesce(poa.diagnosis_poa_24, undetermined.diagnosis_poa_24) as {{ dbt.type_string() }} ) as diagnosis_poa_24\r\n\t, cast(coalesce(poa.diagnosis_poa_25, undetermined.diagnosis_poa_25) as {{ dbt.type_string() }} ) as diagnosis_poa_25\r\n\t, cast(med.procedure_code_type as {{ dbt.type_string() }} ) as procedure_code_type\r\n\t, cast(coalesce(px_code.procedure_code_1, undetermined.procedure_code_1) as {{ dbt.type_string() }} ) as procedure_code_1\r\n\t, cast(coalesce(px_code.procedure_code_2, undetermined.procedure_code_2) as {{ dbt.type_string() }} ) as procedure_code_2\r\n\t, cast(coalesce(px_code.procedure_code_3, undetermined.procedure_code_3) as {{ dbt.type_string() }} ) as procedure_code_3\r\n\t, cast(coalesce(px_code.procedure_code_4, undetermined.procedure_code_4) as {{ dbt.type_string() }} ) as procedure_code_4\r\n\t, cast(coalesce(px_code.procedure_code_5, undetermined.procedure_code_5) as {{ dbt.type_string() }} ) as procedure_code_5\r\n\t, cast(coalesce(px_code.procedure_code_6, undetermined.procedure_code_6) as {{ dbt.type_string() }} ) as procedure_code_6\r\n\t, cast(coalesce(px_code.procedure_code_7, undetermined.procedure_code_7) as {{ dbt.type_string() }} ) as procedure_code_7\r\n\t, cast(coalesce(px_code.procedure_code_8, undetermined.procedure_code_8) as {{ dbt.type_string() }} ) as procedure_code_8\r\n\t, cast(coalesce(px_code.procedure_code_9, undetermined.procedure_code_9) as {{ dbt.type_string() }} ) as procedure_code_9\r\n\t, cast(coalesce(px_code.procedure_code_10, undetermined.procedure_code_10) as {{ dbt.type_string() }} ) as procedure_code_10\r\n\t, cast(coalesce(px_code.procedure_code_11, undetermined.procedure_code_11) as {{ dbt.type_string() }} ) as procedure_code_11\r\n\t, cast(coalesce(px_code.procedure_code_12, undetermined.procedure_code_12) as {{ dbt.type_string() }} ) as procedure_code_12\r\n\t, cast(coalesce(px_code.procedure_code_13, undetermined.procedure_code_13) as {{ dbt.type_string() }} ) as procedure_code_13\r\n\t, cast(coalesce(px_code.procedure_code_14, undetermined.procedure_code_14) as {{ dbt.type_string() }} ) as procedure_code_14\r\n\t, cast(coalesce(px_code.procedure_code_15, undetermined.procedure_code_15) as {{ dbt.type_string() }} ) as procedure_code_15\r\n\t, cast(coalesce(px_code.procedure_code_16, undetermined.procedure_code_16) as {{ dbt.type_string() }} ) as procedure_code_16\r\n\t, cast(coalesce(px_code.procedure_code_17, undetermined.procedure_code_17) as {{ dbt.type_string() }} ) as procedure_code_17\r\n\t, cast(coalesce(px_code.procedure_code_18, undetermined.procedure_code_18) as {{ dbt.type_string() }} ) as procedure_code_18\r\n\t, cast(coalesce(px_code.procedure_code_19, undetermined.procedure_code_19) as {{ dbt.type_string() }} ) as procedure_code_19\r\n\t, cast(coalesce(px_code.procedure_code_20, undetermined.procedure_code_20) as {{ dbt.type_string() }} ) as procedure_code_20\r\n\t, cast(coalesce(px_code.procedure_code_21, undetermined.procedure_code_21) as {{ dbt.type_string() }} ) as procedure_code_21\r\n\t, cast(coalesce(px_code.procedure_code_22, undetermined.procedure_code_22) as {{ dbt.type_string() }} ) as procedure_code_22\r\n\t, cast(coalesce(px_code.procedure_code_23, undetermined.procedure_code_23) as {{ dbt.type_string() }} ) as procedure_code_23\r\n\t, cast(coalesce(px_code.procedure_code_24, undetermined.procedure_code_24) as {{ dbt.type_string() }} ) as procedure_code_24\r\n\t, cast(coalesce(px_code.procedure_code_25, undetermined.procedure_code_25) as {{ dbt.type_string() }} ) as procedure_code_25\r\n\t, cast(coalesce(px_date.procedure_date_1, undetermined.procedure_date_1) as date ) as procedure_date_1\r\n\t, cast(coalesce(px_date.procedure_date_2, undetermined.procedure_date_2) as date ) as procedure_date_2\r\n\t, cast(coalesce(px_date.procedure_date_3, undetermined.procedure_date_3) as date ) as procedure_date_3\r\n\t, cast(coalesce(px_date.procedure_date_4, undetermined.procedure_date_4) as date ) as procedure_date_4\r\n\t, cast(coalesce(px_date.procedure_date_5, undetermined.procedure_date_5) as date ) as procedure_date_5\r\n\t, cast(coalesce(px_date.procedure_date_6, undetermined.procedure_date_6) as date ) as procedure_date_6\r\n\t, cast(coalesce(px_date.procedure_date_7, undetermined.procedure_date_7) as date ) as procedure_date_7\r\n\t, cast(coalesce(px_date.procedure_date_8, undetermined.procedure_date_8) as date ) as procedure_date_8\r\n\t, cast(coalesce(px_date.procedure_date_9, undetermined.procedure_date_9) as date ) as procedure_date_9\r\n\t, cast(coalesce(px_date.procedure_date_10, undetermined.procedure_date_10) as date ) as procedure_date_10\r\n\t, cast(coalesce(px_date.procedure_date_11, undetermined.procedure_date_11) as date ) as procedure_date_11\r\n\t, cast(coalesce(px_date.procedure_date_12, undetermined.procedure_date_12) as date ) as procedure_date_12\r\n\t, cast(coalesce(px_date.procedure_date_13, undetermined.procedure_date_13) as date ) as procedure_date_13\r\n\t, cast(coalesce(px_date.procedure_date_14, undetermined.procedure_date_14) as date ) as procedure_date_14\r\n\t, cast(coalesce(px_date.procedure_date_15, undetermined.procedure_date_15) as date ) as procedure_date_15\r\n\t, cast(coalesce(px_date.procedure_date_16, undetermined.procedure_date_16) as date ) as procedure_date_16\r\n\t, cast(coalesce(px_date.procedure_date_17, undetermined.procedure_date_17) as date ) as procedure_date_17\r\n\t, cast(coalesce(px_date.procedure_date_18, undetermined.procedure_date_18) as date ) as procedure_date_18\r\n\t, cast(coalesce(px_date.procedure_date_19, undetermined.procedure_date_19) as date ) as procedure_date_19\r\n\t, cast(coalesce(px_date.procedure_date_20, undetermined.procedure_date_20) as date ) as procedure_date_20\r\n\t, cast(coalesce(px_date.procedure_date_21, undetermined.procedure_date_21) as date ) as procedure_date_21\r\n\t, cast(coalesce(px_date.procedure_date_22, undetermined.procedure_date_22) as date ) as procedure_date_22\r\n\t, cast(coalesce(px_date.procedure_date_23, undetermined.procedure_date_23) as date ) as procedure_date_23\r\n\t, cast(coalesce(px_date.procedure_date_24, undetermined.procedure_date_24) as date ) as procedure_date_24\r\n\t, cast(coalesce(px_date.procedure_date_25, undetermined.procedure_date_25) as date ) as procedure_date_25\r\n\t, cast(med.data_source as {{ dbt.type_string() }} ) as data_source\r\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\r\nleft join {{ref('normalized_input__int_admit_source_final') }} ad_source\r\n on med.claim_id = ad_source.claim_id\r\n and med.data_source = ad_source.data_source\r\nleft join {{ref('normalized_input__int_admit_type_final') }} ad_type\r\n on med.claim_id = ad_type.claim_id\r\n and med.data_source = ad_type.data_source\r\nleft join {{ref('normalized_input__int_apr_drg_final') }} apr\r\n on med.claim_id = apr.claim_id\r\n and med.data_source = apr.data_source\r\nleft join {{ref('normalized_input__int_bill_type_final') }} bill\r\n on med.claim_id = bill.claim_id\r\n and med.data_source = bill.data_source\r\nleft join {{ref('normalized_input__int_medical_claim_date_normalize') }} claim_line_dates\r\n on med.claim_id = claim_line_dates.claim_id\r\n and med.claim_line_number = claim_line_dates.claim_line_number\r\n and med.data_source = claim_line_dates.data_source\r\nleft join {{ref('normalized_input__int_medical_date_aggregation') }} dates\r\n on med.claim_id = dates.claim_id\r\n and med.data_source = dates.data_source\r\nleft join {{ref('normalized_input__int_medical_npi_normalize') }} med_npi\r\n on med.claim_id = med_npi.claim_id\r\n and med.claim_line_number = med_npi.claim_line_number\r\n and med.data_source = med_npi.data_source\r\nleft join {{ref('normalized_input__int_discharge_disposition_final') }} disch_disp\r\n on med.claim_id = disch_disp.claim_id\r\n and med.data_source = disch_disp.data_source\r\nleft join {{ref('normalized_input__int_ms_drg_final') }} ms\r\n on med.claim_id = ms.claim_id\r\n and med.data_source = ms.data_source\r\nleft join {{ref('normalized_input__int_place_of_service_normalize') }} pos\r\n on med.claim_id = pos.claim_id\r\n and med.claim_line_number = pos.claim_line_number\r\n and med.data_source = pos.data_source\r\nleft join {{ref('normalized_input__int_diagnosis_code_final') }} dx_code\r\n on med.claim_id = dx_code.claim_id\r\n and med.data_source = dx_code.data_source\r\nleft join {{ref('normalized_input__int_present_on_admit_final') }} poa\r\n on med.claim_id = poa.claim_id\r\n and med.data_source = poa.data_source\r\nleft join {{ref('normalized_input__int_procedure_code_final') }} px_code\r\n on med.claim_id = px_code.claim_id\r\n and med.data_source = px_code.data_source\r\nleft join {{ref('normalized_input__int_procedure_date_final') }} px_date\r\n on med.claim_id = px_date.claim_id\r\n and med.data_source = px_date.data_source\r\nleft join {{ref('normalized_input__int_revenue_center_normalize') }} rev\r\n on med.claim_id = rev.claim_id\r\n and med.claim_line_number = rev.claim_line_number\r\n and med.data_source = rev.data_source\r\nleft join {{ref('normalized_input__int_undetermined_claim_type') }} undetermined\r\n on med.claim_id = undetermined.claim_id\r\n and med.claim_line_number = undetermined.claim_line_number\r\n and med.data_source = undetermined.data_source", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["normalized_input__int_admit_source_final"], ["normalized_input__int_admit_type_final"], ["normalized_input__int_apr_drg_final"], ["normalized_input__int_bill_type_final"], ["normalized_input__int_medical_claim_date_normalize"], ["normalized_input__int_medical_date_aggregation"], ["normalized_input__int_medical_npi_normalize"], ["normalized_input__int_discharge_disposition_final"], ["normalized_input__int_ms_drg_final"], ["normalized_input__int_place_of_service_normalize"], ["normalized_input__int_diagnosis_code_final"], ["normalized_input__int_present_on_admit_final"], ["normalized_input__int_procedure_code_final"], ["normalized_input__int_procedure_date_final"], ["normalized_input__int_revenue_center_normalize"], ["normalized_input__int_undetermined_claim_type"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "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 , billing_npi\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 , 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\t, 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\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as TEXT ) as admit_type_code\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as TEXT ) as discharge_disposition_code\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as TEXT ) as place_of_service_code\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as TEXT ) as bill_type_code\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as TEXT ) as ms_drg_code\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as TEXT ) as apr_drg_code\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as TEXT ) as revenue_center_code\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_npi\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as TEXT ) as billing_npi\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as TEXT ) as facility_npi\n\t, 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('2024-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "9d3a39508a7585596a1395c9f828313fdf5fe61a1312b59f4468ba652527e7eb"}, "config": {"enabled": true, "alias": "_int_normalized_input_revenue_center_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.846248, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_revenue_center_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , data_source\r\n , rev.revenue_center_code as normalized_code\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\r\nleft join {{ ref('terminology__revenue_center') }} rev\r\n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\r\nwhere claim_type = 'institutional'", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["terminology__revenue_center"]], "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 , billing_npi\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 , 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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.terminology.revenue_center rev\n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "bb990966fcab9d25b773e007e51fda09542de5ca27e3cffe4ff99007cc271aba"}, "config": {"enabled": true, "alias": "_int_normalized_input_medical_claim_date_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.809304, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_medical_claim_date_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect distinct\r\n med.claim_id\r\n , med.claim_line_number\r\n , med.claim_type\r\n , med.data_source\r\n , cal_claim_start.full_date as normalized_claim_start_date\r\n , cal_claim_end.full_date as normalized_claim_end_date\r\n , cal_claim_line_start.full_date as normalized_claim_line_start_date\r\n , cal_claim_line_end.full_date as normalized_claim_line_end_date\r\n , cal_admission.full_date as normalized_admission_date\r\n , cal_discharge.full_date as normalized_discharge_date\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\r\nleft join {{ ref('terminology__calendar') }} cal_claim_start\r\n on med.claim_start_date = cal_claim_start.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_claim_end\r\n on med.claim_end_Date = cal_claim_end.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_claim_line_start\r\n on med.claim_line_start_date = cal_claim_line_start.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_claim_line_end\r\n on med.claim_line_end_date = cal_claim_line_end.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_admission\r\n on med.admission_date = cal_admission.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_discharge\r\n on med.discharge_date = cal_discharge.full_date", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__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 , billing_npi\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 , 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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.terminology.calendar cal_claim_start\n on med.claim_start_date = cal_claim_start.full_date\nleft join dev_sarah.terminology.calendar cal_claim_end\n on med.claim_end_Date = cal_claim_end.full_date\nleft join dev_sarah.terminology.calendar cal_claim_line_start\n on med.claim_line_start_date = cal_claim_line_start.full_date\nleft join dev_sarah.terminology.calendar cal_claim_line_end\n on med.claim_line_end_date = cal_claim_line_end.full_date\nleft join dev_sarah.terminology.calendar cal_admission\n on med.admission_date = cal_admission.full_date\nleft join dev_sarah.terminology.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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "9cbf9b7508ec14d11e2f92daac9395852e98fdbb2436fe689f03d7f889406eb8"}, "config": {"enabled": true, "alias": "_int_normalized_input_medical_date_aggregation", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.811581, "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\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": [["normalized_input__int_medical_claim_date_normalize"], ["normalized_input__int_medical_claim_date_normalize"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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": []}, "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": "ece8cb4072bca423ebc87363527df2e9c755c80760825f9d706823ceb95bb822"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_date_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.844049, "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 )\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.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": [["normalized_input__int_procedure_code_normalize"], ["normalized_input__int_procedure_date_normalize"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_procedure_code_normalize", "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-02-21 19:58:21.989699+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.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-02-21 19:58:21.989699+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": []}, "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": "da0d8076e8606f179c29a56b7a5c2795ce6d217c8f000534fedeecb9bb13da38"}, "config": {"enabled": true, "alias": "_int_normalized_input_present_on_admit_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.823096, "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\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": [["normalized_input__int_present_on_admit_voting"]], "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-02-21 19:58:21.989699+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": []}, "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": "2c28690e3137992d723a90f2f4618c5811d3546aec4cc983083bec63e090f7d4"}, "config": {"enabled": true, "alias": "_int_normalized_input_apr_drg_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.783473, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_apr_drg_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_apr_drg_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [["normalized_input__int_apr_drg_voting"]], "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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": []}, "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": "12164226bf781f5b7aa766243c8a8b957f7558a3bf10c13cb6a3078439fe199b"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_type_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.778854, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_type_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_admit_type_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [["normalized_input__int_admit_type_voting"]], "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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": []}, "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": "17a7cb7168578fdf2f0d7c73c62f60761f888e93eca226f77cb72a8147fe3b45"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_source_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.774287, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_source_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_admit_source_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [["normalized_input__int_admit_source_voting"]], "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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": []}, "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": "e082eaaec5304c6865b82934e1bd9b2bad81c4750e90af21c189a082c34d5c5e"}, "config": {"enabled": true, "alias": "_int_normalized_input_eligibility_dates_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.806384, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_eligibility_dates_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect distinct\r\n elig.patient_id\r\n , elig.patient_id||elig.data_source||elig.payer||elig.plan||elig.enrollment_start_date||elig.enrollment_end_date as patient_id_key\r\n , cal_dob.full_date as normalized_birth_date\r\n , cal_death.full_date as normalized_death_date\r\n , cal_enroll_start.full_date as normalized_enrollment_start_date\r\n , cal_enroll_end.full_date as normalized_enrollment_end_date\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_eligibility') }} elig\r\nleft join {{ ref('terminology__calendar') }} cal_dob\r\n on elig.birth_date = cal_dob.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_death\r\n on elig.death_date = cal_death.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_enroll_start\r\n on elig.enrollment_start_date = cal_enroll_start.full_date\r\nleft join {{ ref('terminology__calendar') }} cal_enroll_end\r\n on elig.enrollment_end_date = cal_enroll_end.full_date", "language": "sql", "refs": [["normalized_input__stg_eligibility"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"], ["terminology__calendar"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_eligibility", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\nfrom tuva.input_layer.eligibility\n)select distinct\n elig.patient_id\n , elig.patient_id||elig.data_source||elig.payer||elig.plan||elig.enrollment_start_date||elig.enrollment_end_date 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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join dev_sarah.terminology.calendar cal_dob\n on elig.birth_date = cal_dob.full_date\nleft join dev_sarah.terminology.calendar cal_death\n on elig.death_date = cal_death.full_date\nleft join dev_sarah.terminology.calendar cal_enroll_start\n on elig.enrollment_start_date = cal_enroll_start.full_date\nleft join dev_sarah.terminology.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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\nfrom tuva.input_layer.eligibility\n)"}]}, "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": "a1f2eae1015adfe92d301100ad10a8713c8cc7a442f1621efec7bc4c20ec7ad6"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_source_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.776464, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_source_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , admit.admit_source_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__admit_source') }} admit\r\n on med.admit_source_code = admit.admit_source_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , admit_source_code\r\n , count(*) as admit_source_occurrence_count\r\n from normalize\r\n where admit_source_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , admit_source_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'admit_source_code' as column_name\r\n , admit_source_code as normalized_code\r\n , admit_source_occurrence_count as occurrence_count\r\n , coalesce(lead(admit_source_occurrence_count) \r\n over (partition by claim_id, data_source order by admit_source_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by admit_source_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom occurence_comparison", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["terminology__admit_source"]], "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\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n),normalize as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_source_code\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 , count(*) as admit_source_occurrence_count\n from normalize\n where admit_source_code is not null\n group by \n claim_id\n , data_source\n , admit_source_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "1bcdb7228b7bfac224bef8427ecc809184d4e2ed35ed81f81144869e4f725620"}, "config": {"enabled": true, "alias": "_int_normalized_input_ms_drg_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.8185642, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_ms_drg_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , ms.ms_drg_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__ms_drg') }} ms\r\n on med.ms_drg_code = ms.ms_drg_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , ms_drg_code\r\n , count(*) as ms_drg_occurrence_count\r\n from normalize\r\n where ms_drg_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , ms_drg_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'ms_drg_code' as column_name\r\n , ms_drg_code as normalized_code\r\n , ms_drg_occurrence_count as occurrence_count\r\n , coalesce(lead(ms_drg_occurrence_count) \r\n over (partition by claim_id, data_source order by ms_drg_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by ms_drg_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom occurence_comparison", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["terminology__ms_drg"]], "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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n),normalize as(\n select \n med.claim_id\n , med.data_source\n , ms.ms_drg_code\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 , count(*) as ms_drg_occurrence_count\n from normalize\n where ms_drg_code is not null\n group by \n claim_id\n , data_source\n , ms_drg_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "f1f036311d264a9a00cbbe7ed2d70ef542e783f27d51efe497bfbca0bcbccb84"}, "config": {"enabled": true, "alias": "_int_normalized_input_discharge_disposition_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.804063, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_discharge_disposition_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , disch.discharge_disposition_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__discharge_disposition') }} disch\r\n on med.discharge_disposition_code = disch.discharge_disposition_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , discharge_disposition_code\r\n , count(*) as discharge_disposition_occurrence_count\r\n from normalize\r\n where discharge_disposition_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , discharge_disposition_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'discharge_disposition_code' as column_name\r\n , discharge_disposition_code as normalized_code\r\n , discharge_disposition_occurrence_count as occurrence_count\r\n , coalesce(lead(discharge_disposition_occurrence_count) \r\n over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom occurence_comparison", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["terminology__discharge_disposition"]], "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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n),normalize as(\n select \n med.claim_id\n , med.data_source\n , disch.discharge_disposition_code\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 , count(*) as discharge_disposition_occurrence_count\n from normalize\n where discharge_disposition_code is not null\n group by \n claim_id\n , data_source\n , discharge_disposition_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "2400b286d1d3482ce59f7f943bc5a61578e41d6a85c83d93a9592e7ac4eef438"}, "config": {"enabled": true, "alias": "_int_normalized_input_discharge_disposition_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.8018482, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_discharge_disposition_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_discharge_disposition_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [["normalized_input__int_discharge_disposition_voting"]], "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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": []}, "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": "f6d9cfd085d520dedf1765215172f424a78fb9940e7fcf80df4e0743d1da3cd5"}, "config": {"enabled": true, "alias": "_int_normalized_input_diagnosis_code_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.799248, "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\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": [["normalized_input__int_diagnosis_code_normalize"], ["normalized_input__int_diagnosis_code_normalize"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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": []}, "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": "4e2fc490025b435a5e30b1dd40103cdc12728965c8e59b89faaaad3d646bcb97"}, "config": {"enabled": true, "alias": "_int_normalized_input_diagnosis_code_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.7965, "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\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": [["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["terminology__icd_10_cm"], ["terminology__icd_9_cm"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "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 , billing_npi\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 , 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-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "a5277f6a929fc4773879cef62c4215915c0f91de7c728828657c4dcc72dbedc1"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_date_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.841782, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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_date_1' as procedure_column\r\n , procedure_date_1 as procedure_date\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_date_2' as procedure_column\r\n , procedure_date_2 as procedure_date\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_date_3' as procedure_column\r\n , procedure_date_3 as procedure_date\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_date_4' as procedure_column\r\n , procedure_date_4 as procedure_date\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_date_5' as procedure_column\r\n , procedure_date_5 as procedure_date\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_date_6' as procedure_column\r\n , procedure_date_6 as procedure_date\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_date_7' as procedure_column\r\n , procedure_date_7 as procedure_date\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_date_8' as procedure_column\r\n , procedure_date_8 as procedure_date\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_date_9' as procedure_column\r\n , procedure_date_9 as procedure_date\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_date_10' as procedure_column\r\n , procedure_date_10 as procedure_date\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_date_11' as procedure_column\r\n , procedure_date_11 as procedure_date\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_date_12' as procedure_column\r\n , procedure_date_12 as procedure_date\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_date_13' as procedure_column\r\n , procedure_date_13 as procedure_date\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_date_14' as procedure_column\r\n , procedure_date_14 as procedure_date\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_date_15' as procedure_column\r\n , procedure_date_15 as procedure_date\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_date_16' as procedure_column\r\n , procedure_date_16 as procedure_date\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_date_17' as procedure_column\r\n , procedure_date_17 as procedure_date\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_date_18' as procedure_column\r\n , procedure_date_18 as procedure_date\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_date_19' as procedure_column\r\n , procedure_date_19 as procedure_date\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_date_20' as procedure_column\r\n , procedure_date_20 as procedure_date\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_date_21' as procedure_column\r\n , procedure_date_21 as procedure_date\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_date_22' as procedure_column\r\n , procedure_date_22 as procedure_date\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_date_23' as procedure_column\r\n , procedure_date_24 as procedure_date\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_date_24' as procedure_column\r\n , procedure_date_24 as procedure_date\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_date_25' as procedure_column\r\n , procedure_date_25 as procedure_date\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_column\r\n , cal.full_date as procedure_date\r\n , count(*) as procedure_date_occurrence_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom pivot_procedure piv\r\nleft join {{ ref('terminology__calendar') }} cal\r\n on piv.procedure_date = cal.full_date\r\nwhere claim_type = 'institutional'\r\ngroup by \r\n claim_id\r\n , data_source\r\n , procedure_column\r\n , cal.full_date", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["terminology__calendar"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__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 , billing_npi\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 , 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_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_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join dev_sarah.terminology.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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "be489da84de08bff4fbb60b4dc8c1fc6de225b2a1d74c5214a63f37ab79d035f"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_date_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.83812, "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 )\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_14' 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": [["normalized_input__int_procedure_date_voting"]], "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_14' then normalized_code else null end) as procedure_date_25\n , '2024-02-21 19:58:21.989699+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": []}, "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": "0c92eb7d6c2a1f41ce01492444d104a6979f15b75bacfacece09d06bf2235cad"}, "config": {"enabled": true, "alias": "_int_normalized_input_undetermined_claim_type", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.848733, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_undetermined_claim_type", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , claim_type\r\n , patient_id\r\n , member_id\r\n , payer\r\n , plan\r\n , claim_start_date\r\n , claim_end_date\r\n , claim_line_start_date\r\n , claim_line_end_date\r\n , admission_date\r\n , discharge_date\r\n , admit_source_code\r\n , admit_type_code\r\n , discharge_disposition_code\r\n , place_of_service_code\r\n , bill_type_code\r\n , ms_drg_code\r\n , apr_drg_code\r\n , revenue_center_code\r\n , service_unit_quantity\r\n , hcpcs_code\r\n , hcpcs_modifier_1\r\n , hcpcs_modifier_2\r\n , hcpcs_modifier_3\r\n , hcpcs_modifier_4\r\n , hcpcs_modifier_5\r\n , rendering_npi\r\n , billing_npi\r\n , facility_npi\r\n , paid_date\r\n , paid_amount\r\n , allowed_amount\r\n , charge_amount\r\n , coinsurance_amount\r\n , copayment_amount\r\n , deductible_amount\r\n , total_cost_amount\r\n , diagnosis_code_type\r\n , diagnosis_code_1\r\n , diagnosis_code_2\r\n , diagnosis_code_3\r\n , diagnosis_code_4\r\n , diagnosis_code_5\r\n , diagnosis_code_6\r\n , diagnosis_code_7\r\n , diagnosis_code_8\r\n , diagnosis_code_9\r\n , diagnosis_code_10\r\n , diagnosis_code_11\r\n , diagnosis_code_12\r\n , diagnosis_code_13\r\n , diagnosis_code_14\r\n , diagnosis_code_15\r\n , diagnosis_code_16\r\n , diagnosis_code_17\r\n , diagnosis_code_18\r\n , diagnosis_code_19\r\n , diagnosis_code_20\r\n , diagnosis_code_21\r\n , diagnosis_code_22\r\n , diagnosis_code_23\r\n , diagnosis_code_24\r\n , diagnosis_code_25\r\n , diagnosis_poa_1\r\n , diagnosis_poa_2\r\n , diagnosis_poa_3\r\n , diagnosis_poa_4\r\n , diagnosis_poa_5\r\n , diagnosis_poa_6\r\n , diagnosis_poa_7\r\n , diagnosis_poa_8\r\n , diagnosis_poa_9\r\n , diagnosis_poa_10\r\n , diagnosis_poa_11\r\n , diagnosis_poa_12\r\n , diagnosis_poa_13\r\n , diagnosis_poa_14\r\n , diagnosis_poa_15\r\n , diagnosis_poa_16\r\n , diagnosis_poa_17\r\n , diagnosis_poa_18\r\n , diagnosis_poa_19\r\n , diagnosis_poa_20\r\n , diagnosis_poa_21\r\n , diagnosis_poa_22\r\n , diagnosis_poa_23\r\n , diagnosis_poa_24\r\n , diagnosis_poa_25\r\n , procedure_code_type\r\n , procedure_code_1\r\n , procedure_code_2\r\n , procedure_code_3\r\n , procedure_code_4\r\n , procedure_code_5\r\n , procedure_code_6\r\n , procedure_code_7\r\n , procedure_code_8\r\n , procedure_code_9\r\n , procedure_code_10\r\n , procedure_code_11\r\n , procedure_code_12\r\n , procedure_code_13\r\n , procedure_code_14\r\n , procedure_code_15\r\n , procedure_code_16\r\n , procedure_code_17\r\n , procedure_code_18\r\n , procedure_code_19\r\n , procedure_code_20\r\n , procedure_code_21\r\n , procedure_code_22\r\n , procedure_code_23\r\n , procedure_code_24\r\n , procedure_code_25\r\n , procedure_date_1\r\n , procedure_date_2\r\n , procedure_date_3\r\n , procedure_date_4\r\n , procedure_date_5\r\n , procedure_date_6\r\n , procedure_date_7\r\n , procedure_date_8\r\n , procedure_date_9\r\n , procedure_date_10\r\n , procedure_date_11\r\n , procedure_date_12\r\n , procedure_date_13\r\n , procedure_date_14\r\n , procedure_date_15\r\n , procedure_date_16\r\n , procedure_date_17\r\n , procedure_date_18\r\n , procedure_date_19\r\n , procedure_date_20\r\n , procedure_date_21\r\n , procedure_date_22\r\n , procedure_date_23\r\n , procedure_date_24\r\n , procedure_date_25\r\n , data_source\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }}\r\nwhere claim_type in ('undetermined')", "language": "sql", "refs": [["normalized_input__stg_medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim"]}, "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 , billing_npi\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 , 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 , 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 , billing_npi\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 , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "bbbd17b35826623387b40bd5b0ef50d143af2b0e0dbb8aa3b308c5efdd9b0b2b"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_code_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.830218, "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 )\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_14' 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": [["normalized_input__int_procedure_code_voting"]], "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_14' then normalized_code else null end) as procedure_code_25\n , '2024-02-21 19:58:21.989699+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": []}, "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": "f47faa6898197ed6e2a99c45bdc093a966b59f45d6363998a5bd69f1a16706c3"}, "config": {"enabled": true, "alias": "_int_normalized_input_apr_drg_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.787272, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_apr_drg_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , apr.apr_drg_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__apr_drg') }} apr\r\n on med.apr_drg_code = apr.apr_drg_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , apr_drg_code\r\n , count(*) as apr_drg_occurrence_count\r\n from normalize\r\n where apr_drg_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , apr_drg_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'apr_drg_code' as column_name\r\n , apr_drg_code as normalized_code\r\n , apr_drg_occurrence_count as occurrence_count\r\n , coalesce(lead(apr_drg_occurrence_count) \r\n over (partition by claim_id, data_source order by apr_drg_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by apr_drg_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom occurence_comparison", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["terminology__apr_drg"]], "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\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n),normalize as(\n select \n med.claim_id\n , med.data_source\n , apr.apr_drg_code\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 , count(*) as apr_drg_occurrence_count\n from normalize\n where apr_drg_code is not null\n group by \n claim_id\n , data_source\n , apr_drg_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "245252ab22177d0c9bc003c951fdf23bb24d817aae9757151e54201677c22d7d"}, "config": {"enabled": true, "alias": "_int_normalized_input_ms_drg_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.816, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_ms_drg_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_ms_drg_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [["normalized_input__int_ms_drg_voting"]], "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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": []}, "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": "d55c04d37d684dd1c952f6da453c35831320836f62252c504846397de1e281b1"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_type_normalize_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.781013, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_type_normalize_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , admit.admit_type_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__admit_type') }} admit\r\n on med.admit_type_code = admit.admit_type_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , admit_type_code\r\n , count(*) as admit_type_occurrence_count\r\n from normalize\r\n where admit_type_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , admit_type_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'admit_type_code' as column_name\r\n , admit_type_code as normalized_code\r\n , admit_type_occurrence_count as occurrence_count\r\n , coalesce(lead(admit_type_occurrence_count) \r\n over (partition by claim_id, data_source order by admit_type_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by admit_type_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom occurence_comparison", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["terminology__admit_type"]], "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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n),normalize as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_type_code\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 , count(*) as admit_type_occurrence_count\n from normalize\n where admit_type_code is not null\n group by \n claim_id\n , data_source\n , admit_type_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "fe527ca1a2a45b6305f5863a50d8f04c6782d119a4fad3d437b14649e2486e84"}, "config": {"enabled": true, "alias": "_int_normalized_input_present_on_admit_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.827897, "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\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": [["normalized_input__int_present_on_admit_normalize"], ["normalized_input__int_present_on_admit_normalize"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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": []}, "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": "dcdffb2c8c3b11d97e191de119277714560c0e78a4afd0ac823e1f3b5b0b81cc"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_code_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.832534, "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 )\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_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_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": [["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["terminology__icd_10_pcs"], ["terminology__icd_9_pcs"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "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 , billing_npi\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 , 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_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_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-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "b16902fc33d80b498f1d912e164c90f832a958b73d0aa18f160ffe5eba45305d"}, "config": {"enabled": true, "alias": "_int_normalized_input_bill_type_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.7896168, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_bill_type_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_bill_type_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [["normalized_input__int_bill_type_voting"]], "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_bill_type_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": []}, "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": "0fb3cbc86e13e71594a93066803d30c6bb7c121ab17545323b3da25b869e6fd1"}, "config": {"enabled": true, "alias": "_int_normalized_input_bill_type_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.7917829, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_bill_type_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nwith normalize as(\r\n select \r\n med.claim_id\r\n , med.data_source\r\n , bill.bill_type_code\r\n from {{ ref('normalized_input__stg_medical_claim') }} med\r\n inner join {{ ref('terminology__bill_type') }} bill\r\n on med.bill_type_code = bill.bill_type_code\r\n where claim_type = 'institutional'\r\n)\r\n, distinct_counts as(\r\n select \r\n claim_id\r\n , data_source\r\n , bill_type_code\r\n , count(*) as bill_type_occurrence_count\r\n from normalize\r\n where bill_type_code is not null\r\n group by \r\n claim_id\r\n , data_source\r\n , bill_type_code\r\n)\r\n\r\n, occurence_comparison as(\r\n select\r\n claim_id\r\n , data_source\r\n , 'bill_type_code' as column_name\r\n , bill_type_code as normalized_code\r\n , bill_type_occurrence_count as occurrence_count\r\n , coalesce(lead(bill_type_occurrence_count) \r\n over (partition by claim_id, data_source order by bill_type_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by claim_id, data_source order by bill_type_occurrence_count desc) as occurrence_row_count\r\n from distinct_counts dist\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , column_name\r\n , normalized_code\r\n , occurrence_count\r\n , next_occurrence_count\r\n , occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom occurence_comparison", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["terminology__bill_type"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n),normalize as(\n select \n med.claim_id\n , med.data_source\n , bill.bill_type_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.bill_type bill\n on med.bill_type_code = 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 , count(*) as bill_type_occurrence_count\n from normalize\n where bill_type_code is not null\n group by \n claim_id\n , data_source\n , bill_type_code\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_occurrence_count as occurrence_count\n , coalesce(lead(bill_type_occurrence_count) \n over (partition by claim_id, data_source order by bill_type_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by bill_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "ce2f31cae79f3036ad117c97b6a58e4bc984c201c104e744595a7d2ba88fe095"}, "config": {"enabled": true, "alias": "_int_normalized_input_present_on_admit_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.825737, "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\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": [["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["normalized_input__stg_medical_claim"], ["terminology__present_on_admission"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "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 , billing_npi\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 , 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-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "481b460bd1fe4add4fea5adeb375783c07f6f52df54da992b508bcc9b10e9230"}, "config": {"enabled": true, "alias": "_int_normalized_input_place_of_service_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.820826, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_place_of_service_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , claim_line_number\r\n , data_source\r\n , pos.place_of_service_code as normalized_code\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\r\nleft join {{ ref('terminology__place_of_service') }} pos\r\n on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\r\nwhere claim_type = 'professional'", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["terminology__place_of_service"]], "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 , billing_npi\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 , 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 , '2024-02-21 19:58:21.989699+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 on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "e398ec28bf7f358013b41c209730f4ea3c9921d9c11977e42364c027f4ca33f2"}, "config": {"enabled": true, "alias": "_int_normalized_input_medical_npi_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.8138828, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_medical_npi_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\n\r\nselect distinct\r\n med.claim_id\r\n , med.claim_line_number\r\n , med.claim_type\r\n , med.data_source\r\n , rend_prov.npi as normalized_rendering_npi\r\n , bill_prov.npi as normalized_billing_npi\r\n , fac_prov.npi as normalized_facility_npi\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\r\nleft join {{ ref('terminology__provider') }} rend_prov\r\n on med.rendering_npi = rend_prov.npi\r\n and rend_prov.entity_type_description = 'Individual'\r\nleft join {{ ref('terminology__provider') }} bill_prov\r\n on med.billing_npi = bill_prov.npi\r\nleft join {{ ref('terminology__provider') }} fac_prov\r\n on med.facility_npi = fac_prov.npi\r\n and fac_prov.entity_type_description = 'Organization'\r\n and med.claim_type = 'institutional'", "language": "sql", "refs": [["normalized_input__stg_medical_claim"], ["terminology__provider"], ["terminology__provider"], ["terminology__provider"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__provider", "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 , billing_npi\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 , 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 , bill_prov.npi as normalized_billing_npi\n , fac_prov.npi as normalized_facility_npi\n , '2024-02-21 19:58:21.989699+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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "954b0a5270efe93a16dbd9ef1ad1c8f23741dc0bd308413d91132c5f4e1f23ad"}, "config": {"enabled": true, "alias": "_int_normalized_input_diagnosis_code_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.793875, "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\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": [["normalized_input__int_diagnosis_code_voting"]], "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-02-21 19:58:21.989699+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": []}, "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": "9cdd5402166bc10e8927b3afae5a7f95037c18d6372a1a733b2a5452596cb77e"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_code_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.834872, "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\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": [["normalized_input__int_procedure_code_normalize"], ["normalized_input__int_procedure_code_normalize"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_procedure_code_normalize", "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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": []}, "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": "b26c844757968eeea28c6395551b8a0cd13c66e4d598efaef28f1555216553b2"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "Staging med claims for sc grouper", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "ephemeral", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.734541, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }}", "language": "sql", "refs": [["normalized_input__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim"]}, "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\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.service_category__dq_input_layer_results": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__dq_input_layer_results", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_results.sql", "original_file_path": "models/claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_results.sql", "unique_id": "model.the_tuva_project.service_category__dq_input_layer_results", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "data_quality", "service_category__dq_input_layer_results"], "alias": "_dq_input_layer_results", "checksum": {"name": "sha256", "checksum": "0153d75e226c9f3d5403c0ce0ca022c42b397004ae6111cbd5701d98c79138dc"}, "config": {"enabled": true, "alias": "_dq_input_layer_results", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_dq_input_layer_results", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.736653, "relation_name": "dev_sarah.claims_preprocessing._dq_input_layer_results", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n dq_problem\n, count(distinct claim_id) as distinct_claims\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__dq_input_layer_tests') }}\ngroup by 1", "language": "sql", "refs": [["service_category__dq_input_layer_tests"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__dq_input_layer_tests"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_results.sql", "compiled": true, "compiled_code": "\n\nselect\n dq_problem\n, count(distinct claim_id) as distinct_claims\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._dq_input_layer_tests\ngroup by 1", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.service_category__dq_multiple_service_categories_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__dq_multiple_service_categories_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_professional.sql", "unique_id": "model.the_tuva_project.service_category__dq_multiple_service_categories_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "data_quality", "service_category__dq_multiple_service_categories_professional"], "alias": "_dq_multiple_service_categories_professional", "checksum": {"name": "sha256", "checksum": "75b2b979b8bd7d1d1251a7aa90f4f765b47d1a463596be3dd21570537d35d9ff"}, "config": {"enabled": true, "alias": "_dq_multiple_service_categories_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_dq_multiple_service_categories_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.743784, "relation_name": "dev_sarah.claims_preprocessing._dq_multiple_service_categories_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n claim_id\n, claim_line_number\n, count(distinct service_category_2) as distinct_service_category_count\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__combined_professional') }}\ngroup by 1,2\nhaving count(distinct service_category_2) > 1", "language": "sql", "refs": [["service_category__combined_professional"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__combined_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_professional.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n, claim_line_number\n, count(distinct service_category_2) as distinct_service_category_count\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_combined_professional\ngroup by 1,2\nhaving count(distinct service_category_2) > 1", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.service_category__dq_multiple_service_categories_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__dq_multiple_service_categories_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_institutional.sql", "unique_id": "model.the_tuva_project.service_category__dq_multiple_service_categories_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "data_quality", "service_category__dq_multiple_service_categories_institutional"], "alias": "_dq_multiple_service_categories_institutional", "checksum": {"name": "sha256", "checksum": "b0aa09f9d0ba10b8b974ed8890e0a5791f3a7607dff0d7ef10b2dbf41f51541f"}, "config": {"enabled": true, "alias": "_dq_multiple_service_categories_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_dq_multiple_service_categories_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.7412639, "relation_name": "dev_sarah.claims_preprocessing._dq_multiple_service_categories_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n claim_id\n, count(distinct service_category_2) as distinct_service_category_count\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__combined_institutional') }}\ngroup by 1\nhaving count(distinct service_category_2) > 1", "language": "sql", "refs": [["service_category__combined_institutional"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__combined_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/data_quality/service_category__dq_multiple_service_categories_institutional.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n, count(distinct service_category_2) as distinct_service_category_count\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_combined_institutional\ngroup by 1\nhaving count(distinct service_category_2) > 1", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.service_category__dq_input_layer_tests": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__dq_input_layer_tests", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_tests.sql", "original_file_path": "models/claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_tests.sql", "unique_id": "model.the_tuva_project.service_category__dq_input_layer_tests", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "data_quality", "service_category__dq_input_layer_tests"], "alias": "_dq_input_layer_tests", "checksum": {"name": "sha256", "checksum": "fc16e6bfa3c2a7c10ae467283d062e71fc0d35fb9da979b6a8c65fdd76f7782a"}, "config": {"enabled": true, "alias": "_dq_input_layer_tests", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_dq_input_layer_tests", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.738955, "relation_name": "dev_sarah.claims_preprocessing._dq_input_layer_tests", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Multiple claim_type' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\ngroup by 1\nhaving count(distinct claim_type) > 1\n\nunion all\n\nselect distinct \n claim_id\n, 'Multiple bill_type_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\ngroup by 1\nhaving count(distinct bill_type_code) > 1\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing claim_type' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing place_of_service_code' as dq_problem\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 is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing bill_type_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and bill_type_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing revenue_center_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and revenue_center_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing hcpcs_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and hcpcs_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid claim_type' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__claim_type') }} b\n on a.claim_type = b.claim_type\nwhere b.claim_type is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid place_of_service_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__place_of_service') }} b\n on a.place_of_service_code = b.place_of_service_code\nwhere a.claim_type = 'professional'\n and b.place_of_service_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid bill_type_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__bill_type') }} b\n on a.bill_type_code = b.bill_type_code\nwhere a.claim_type = 'institutional'\n and b.bill_type_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid revenue_center_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__revenue_center') }} b\n on a.revenue_center_code = b.revenue_center_code\nwhere a.claim_type = 'institutional'\n and b.revenue_center_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid hcpcs_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__hcpcs_level_2') }} b\n on a.hcpcs_code = b.hcpcs\nwhere a.claim_type = 'professional'\n and b.hcpcs is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid ms_drg_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__ms_drg') }} b\n on a.ms_drg_code = b.ms_drg_code\nwhere a.claim_type = 'institutional'\n and b.ms_drg_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid apr_drg_code' as dq_problem\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('terminology__apr_drg') }} b\n on a.apr_drg_code = b.apr_drg_code\nwhere a.claim_type = 'institutional'\n and b.apr_drg_code is null", "language": "sql", "refs": [["service_category__stg_medical_claim"], ["service_category__stg_medical_claim"], ["service_category__stg_medical_claim"], ["service_category__stg_medical_claim"], ["service_category__stg_medical_claim"], ["service_category__stg_medical_claim"], ["service_category__stg_medical_claim"], ["service_category__stg_medical_claim"], ["terminology__claim_type"], ["service_category__stg_medical_claim"], ["terminology__place_of_service"], ["service_category__stg_medical_claim"], ["terminology__bill_type"], ["service_category__stg_medical_claim"], ["terminology__revenue_center"], ["service_category__stg_medical_claim"], ["terminology__hcpcs_level_2"], ["service_category__stg_medical_claim"], ["terminology__ms_drg"], ["service_category__stg_medical_claim"], ["terminology__apr_drg"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__claim_type", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__place_of_service", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__bill_type", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__revenue_center", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/data_quality/service_category__dq_input_layer_tests.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, 'Multiple claim_type' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\ngroup by 1\nhaving count(distinct claim_type) > 1\n\nunion all\n\nselect distinct \n claim_id\n, 'Multiple bill_type_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\ngroup by 1\nhaving count(distinct bill_type_code) > 1\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing claim_type' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing place_of_service_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing bill_type_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and bill_type_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing revenue_center_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and revenue_center_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing hcpcs_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and hcpcs_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid claim_type' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join dev_sarah.terminology.claim_type b\n on a.claim_type = b.claim_type\nwhere b.claim_type is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid place_of_service_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join dev_sarah.terminology.place_of_service b\n on a.place_of_service_code = b.place_of_service_code\nwhere a.claim_type = 'professional'\n and b.place_of_service_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid bill_type_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join dev_sarah.terminology.bill_type b\n on a.bill_type_code = b.bill_type_code\nwhere a.claim_type = 'institutional'\n and b.bill_type_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid revenue_center_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join dev_sarah.terminology.revenue_center b\n on a.revenue_center_code = b.revenue_center_code\nwhere a.claim_type = 'institutional'\n and b.revenue_center_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid hcpcs_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join dev_sarah.terminology.hcpcs_level_2 b\n on a.hcpcs_code = b.hcpcs\nwhere a.claim_type = 'professional'\n and b.hcpcs is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid ms_drg_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join dev_sarah.terminology.ms_drg b\n on a.ms_drg_code = b.ms_drg_code\nwhere a.claim_type = 'institutional'\n and b.ms_drg_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid apr_drg_code' as dq_problem\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join dev_sarah.terminology.apr_drg b\n on a.apr_drg_code = b.apr_drg_code\nwhere a.claim_type = 'institutional'\n and b.apr_drg_code is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "ef849e362fb992c82a4c7e60e3a7d9fac20c8be30de7d767fb7b5844e2e4d218"}, "config": {"enabled": true, "alias": "service_category_grouper", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicated the type of claims", "meta": {}, "data_type": null, "quote": null, "tags": []}, "service_category_1": {"name": "service_category_1", "description": "The first service category of the claim line", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.658634, "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)))\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\n when service_category_2 = 'Acute Inpatient' then 'Inpatient'\n when service_category_2 = 'Ambulance' then 'Ancillary'\n when service_category_2 = 'Ambulatory Surgery' then 'Outpatient'\n when service_category_2 = 'Dialysis' then 'Outpatient'\n when service_category_2 = 'Durable Medical Equipment' then 'Ancillary'\n when service_category_2 = 'Emergency Department' then 'Outpatient'\n when service_category_2 = 'Home Health' then 'Outpatient'\n when service_category_2 = 'Hospice' then 'Outpatient'\n when service_category_2 = 'Inpatient Psychiatric' then 'Inpatient'\n when service_category_2 = 'Inpatient Rehabilitation' then 'Inpatient'\n when service_category_2 = 'Lab' then 'Ancillary'\n when service_category_2 = 'Office Visit' then 'Office Visit'\n when service_category_2 = 'Outpatient Hospital or Clinic' then 'Outpatient'\n when service_category_2 = 'Outpatient Psychiatric' then 'Outpatient'\n when service_category_2 = 'Outpatient Rehabilitation' then 'Outpatient'\n when service_category_2 = 'Skilled Nursing' then 'Inpatient'\n when service_category_2 = 'Urgent Care' then 'Outpatient'\n when service_category_2 is null then 'Other'\n end service_category_1\n , case\n when service_category_2 is null then 'Other'\n else service_category_2\n end service_category_2\n , '{{ var('tuva_last_run')}}' as tuva_last_run\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 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\n when service_category_2 = 'Acute Inpatient' then 'Inpatient'\n when service_category_2 = 'Ambulatory Surgery' then 'Outpatient'\n when service_category_2 = 'Dialysis' then 'Outpatient'\n when service_category_2 = 'Emergency Department' then 'Outpatient'\n when service_category_2 = 'Home Health' then 'Outpatient'\n when service_category_2 = 'Hospice' then 'Outpatient'\n when service_category_2 = 'Inpatient Psychiatric' then 'Inpatient'\n when service_category_2 = 'Inpatient Rehabilitation' then 'Inpatient'\n when service_category_2 = 'Lab' then 'Ancillary'\n when service_category_2 = 'Office Visit' then 'Office Visit'\n when service_category_2 = 'Outpatient Hospital or Clinic' then 'Outpatient'\n when service_category_2 = 'Outpatient Psychiatric' then 'Outpatient'\n when service_category_2 = 'Skilled Nursing' then 'Inpatient'\n when service_category_2 = 'Urgent Care' then 'Outpatient'\n when service_category_2 is null then 'Other'\n end service_category_1\n , case\n when service_category_2 is null then 'Other'\n else service_category_2\n end service_category_2\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} a\n left join {{ ref('service_category__combined_institutional') }} b\n on a.claim_id = b.claim_id\n where a.claim_type = 'institutional'\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 , row_number() over (partition by claim_id, claim_line_number order by \n case\n when service_category_2 = 'Acute Inpatient' then 3\n when service_category_2 = 'Ambulance' then 7\n when service_category_2 = 'Ambulatory Surgery' then 8\n when service_category_2 = 'Dialysis' then 17\n when service_category_2 = 'Durable Medical Equipment' then 1\n when service_category_2 = 'Emergency Department' then 5\n when service_category_2 = 'Home Health' then 9\n when service_category_2 = 'Hospice' then 10\n when service_category_2 = 'Inpatient Psychiatric' then 11\n when service_category_2 = 'Inpatient Rehabilitation' then 12\n when service_category_2 = 'Lab' then 13\n when service_category_2 = 'Office Visit' then 4\n when service_category_2 = 'Outpatient Hospital or Clinic' then 14\n when service_category_2 = 'Outpatient Psychiatric' then 15\n when service_category_2 = 'Outpatient Rehabilitation' then 16\n when service_category_2 = 'Skilled Nursing' then 6\n when service_category_2 = 'Urgent Care' then 2\n when service_category_2 is null then 18\n else 99 end) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\nfrom service_category_2_deduplication\nwhere duplicate_row_number = 1", "language": "sql", "refs": [["service_category__stg_medical_claim"], ["service_category__combined_professional"], ["service_category__stg_medical_claim"], ["service_category__combined_institutional"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__combined_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/final/service_category__service_category_grouper.sql", "compiled": true, "compiled_code": "\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n),service_category_1_mapping as(\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case\n when service_category_2 = 'Acute Inpatient' then 'Inpatient'\n when service_category_2 = 'Ambulance' then 'Ancillary'\n when service_category_2 = 'Ambulatory Surgery' then 'Outpatient'\n when service_category_2 = 'Dialysis' then 'Outpatient'\n when service_category_2 = 'Durable Medical Equipment' then 'Ancillary'\n when service_category_2 = 'Emergency Department' then 'Outpatient'\n when service_category_2 = 'Home Health' then 'Outpatient'\n when service_category_2 = 'Hospice' then 'Outpatient'\n when service_category_2 = 'Inpatient Psychiatric' then 'Inpatient'\n when service_category_2 = 'Inpatient Rehabilitation' then 'Inpatient'\n when service_category_2 = 'Lab' then 'Ancillary'\n when service_category_2 = 'Office Visit' then 'Office Visit'\n when service_category_2 = 'Outpatient Hospital or Clinic' then 'Outpatient'\n when service_category_2 = 'Outpatient Psychiatric' then 'Outpatient'\n when service_category_2 = 'Outpatient Rehabilitation' then 'Outpatient'\n when service_category_2 = 'Skilled Nursing' then 'Inpatient'\n when service_category_2 = 'Urgent Care' then 'Outpatient'\n when service_category_2 is null then 'Other'\n end service_category_1\n , case\n when service_category_2 is null then 'Other'\n else service_category_2\n end service_category_2\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from __dbt__cte__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 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\n when service_category_2 = 'Acute Inpatient' then 'Inpatient'\n when service_category_2 = 'Ambulatory Surgery' then 'Outpatient'\n when service_category_2 = 'Dialysis' then 'Outpatient'\n when service_category_2 = 'Emergency Department' then 'Outpatient'\n when service_category_2 = 'Home Health' then 'Outpatient'\n when service_category_2 = 'Hospice' then 'Outpatient'\n when service_category_2 = 'Inpatient Psychiatric' then 'Inpatient'\n when service_category_2 = 'Inpatient Rehabilitation' then 'Inpatient'\n when service_category_2 = 'Lab' then 'Ancillary'\n when service_category_2 = 'Office Visit' then 'Office Visit'\n when service_category_2 = 'Outpatient Hospital or Clinic' then 'Outpatient'\n when service_category_2 = 'Outpatient Psychiatric' then 'Outpatient'\n when service_category_2 = 'Skilled Nursing' then 'Inpatient'\n when service_category_2 = 'Urgent Care' then 'Outpatient'\n when service_category_2 is null then 'Other'\n end service_category_1\n , case\n when service_category_2 is null then 'Other'\n else service_category_2\n end service_category_2\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n from __dbt__cte__service_category__stg_medical_claim a\n left join dev_sarah.claims_preprocessing._int_combined_institutional b\n on a.claim_id = b.claim_id\n where a.claim_type = 'institutional'\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 , row_number() over (partition by claim_id, claim_line_number order by \n case\n when service_category_2 = 'Acute Inpatient' then 3\n when service_category_2 = 'Ambulance' then 7\n when service_category_2 = 'Ambulatory Surgery' then 8\n when service_category_2 = 'Dialysis' then 17\n when service_category_2 = 'Durable Medical Equipment' then 1\n when service_category_2 = 'Emergency Department' then 5\n when service_category_2 = 'Home Health' then 9\n when service_category_2 = 'Hospice' then 10\n when service_category_2 = 'Inpatient Psychiatric' then 11\n when service_category_2 = 'Inpatient Rehabilitation' then 12\n when service_category_2 = 'Lab' then 13\n when service_category_2 = 'Office Visit' then 4\n when service_category_2 = 'Outpatient Hospital or Clinic' then 14\n when service_category_2 = 'Outpatient Psychiatric' then 15\n when service_category_2 = 'Outpatient Rehabilitation' then 16\n when service_category_2 = 'Skilled Nursing' then 6\n when service_category_2 = 'Urgent Care' then 2\n when service_category_2 is null then 18\n else 99 end) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\nfrom service_category_2_deduplication\nwhere duplicate_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.service_category__hospice_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__hospice_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__hospice_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__hospice_professional.sql", "unique_id": "model.the_tuva_project.service_category__hospice_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__hospice_professional"], "alias": "_int_hospice_professional", "checksum": {"name": "sha256", "checksum": "9f6404c47e48a07a0ad0da4d0334375920ca48635c740c17ae2b56bc1f6d7113"}, "config": {"enabled": true, "alias": "_int_hospice_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_hospice_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.695047, "relation_name": "dev_sarah.claims_preprocessing._int_hospice_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Hospice' as service_category_2\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 ('34')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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__hospice_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Hospice' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('34')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "a436c587da1c3c136440ebcfbd6601b73f13bb2c2e7ac18268f3f31c66ee29e9"}, "config": {"enabled": true, "alias": "_int_ambulatory_surgery_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.6734898, "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)))\n )\n}}\n\nselect distinct \n a.claim_id\n, a.claim_line_number\n, 'Ambulatory Surgery' as service_category_2\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 a.claim_type = 'professional'\n and a.place_of_service_code in ('24')\n and (b.claim_id is null and b.claim_line_number is null)", "language": "sql", "refs": [["service_category__stg_medical_claim"], ["service_category__dme_professional"]], "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__ambulatory_surgery_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n a.claim_id\n, a.claim_line_number\n, 'Ambulatory Surgery' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__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 a.claim_type = 'professional'\n and a.place_of_service_code in ('24')\n and (b.claim_id is null and b.claim_line_number is null)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "eb91a35a7bd895dec5029c6a2948c5b216b8b6d5c03f10e704afcbd6fea03ee6"}, "config": {"enabled": true, "alias": "_int_home_health_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.6905951, "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)))\n )\n}}\n\nselect distinct \n a.claim_id\n, a.claim_line_number\n, 'Home Health' as service_category_2\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 a.claim_type = 'professional'\n and a.place_of_service_code in ('12')\n and (b.claim_id is null and b.claim_line_number is null)", "language": "sql", "refs": [["service_category__stg_medical_claim"], ["service_category__dme_professional"]], "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__home_health_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n a.claim_id\n, a.claim_line_number\n, 'Home Health' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__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 a.claim_type = 'professional'\n and a.place_of_service_code in ('12')\n and (b.claim_id is null and b.claim_line_number is null)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "bef186ab9e3a2678df57bd21d4ff55c790ff622a02b79a8ab00a05eb61f015b5"}, "config": {"enabled": true, "alias": "_int_urgent_care_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.7306838, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Urgent Care' as service_category_2\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')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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 __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Urgent Care' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('20')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.service_category__duplicate_bill_types": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__duplicate_bill_types", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__duplicate_bill_types.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__duplicate_bill_types.sql", "unique_id": "model.the_tuva_project.service_category__duplicate_bill_types", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__duplicate_bill_types"], "alias": "_int_duplicate_bill_types", "checksum": {"name": "sha256", "checksum": "18f8d12e785b1774510a0dfbac2e5f68d8796690d63c726bab111863630bc3b9"}, "config": {"enabled": true, "alias": "_int_duplicate_bill_types", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_duplicate_bill_types", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.732942, "relation_name": "dev_sarah.claims_preprocessing._int_duplicate_bill_types", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct\n claim_id\n, count(distinct bill_type_code) as cnt\nfrom {{ ref('service_category__stg_medical_claim') }}\ngroup by 1\nhaving count(distinct bill_type_code) > 1", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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__duplicate_bill_types.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct\n claim_id\n, count(distinct bill_type_code) as cnt\nfrom __dbt__cte__service_category__stg_medical_claim\ngroup by 1\nhaving count(distinct bill_type_code) > 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "9222d5b442380f56a44bee117e590d1536eac15f289db558c713d1a61695c9e3"}, "config": {"enabled": true, "alias": "_int_dialysis_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.678748, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Dialysis' as service_category_2\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 ('65')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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__dialysis_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Dialysis' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('65')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "c93dab069d145e7002b3c5f56ebc380f4f1fea0b9783f63ec994025e68ee6ce9"}, "config": {"enabled": true, "alias": "_int_lab_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.701899, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Lab' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('14')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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__lab_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, 'Lab' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('14')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "15e37d1f5b3af77520031c112df2efaacae32168de0f0368d2e63314ed0bda2e"}, "config": {"enabled": true, "alias": "_int_inpatient_rehab_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.699612, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Inpatient Rehabilitation' as service_category_2\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": [["service_category__stg_medical_claim"]], "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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Inpatient Rehabilitation' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('61')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "0db2c73527e1b488c0ca7196a4dfc3206d7e88c4138214961759af8376f50057"}, "config": {"enabled": true, "alias": "_int_dialysis_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.675755, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Dialysis' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('72')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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__dialysis_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, 'Dialysis' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('72')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "e550991c585a166a0f7ce439bf1b34ad7e715c81f4cac31f0615b6b30dca8c0f"}, "config": {"enabled": true, "alias": "_int_dme_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.681031, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Durable Medical Equipment' as service_category_2\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": [["service_category__stg_medical_claim"]], "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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Durable Medical Equipment' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and hcpcs_code between 'E0100' and 'E8002'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "39a3540db246d1004cf1901a541b584b3d7addac8a79c8defab743851f63429e"}, "config": {"enabled": true, "alias": "_int_home_health_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.6883311, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Home Health' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('31','32','33')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, 'Home Health' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('31','32','33')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "bea86c99330b95669ce9f77ca5d8581293480ab8d1f73aee468cf96d7be5487e"}, "config": {"enabled": true, "alias": "_int_emergency_department_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.6858518, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Emergency Department' as service_category_2\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 = '23'", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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__emergency_department_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Emergency Department' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code = '23'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "465f57389afdc14729f03f1dcab74e8f339d332b43b339f0959671b5fcebfd09"}, "config": {"enabled": true, "alias": "_int_inpatient_psychiatric_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.6971772, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Inpatient Psychiatric' as service_category_2\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": [["service_category__stg_medical_claim"]], "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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Inpatient Psychiatric' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__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": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.service_category__skilled_nursing_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__skilled_nursing_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__skilled_nursing_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__skilled_nursing_institutional.sql", "unique_id": "model.the_tuva_project.service_category__skilled_nursing_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__skilled_nursing_institutional"], "alias": "_int_skilled_nursing_institutional", "checksum": {"name": "sha256", "checksum": "540aa77d916138feb370e1c910f3fe07ab2d3ee30663050821a137c4c1aeb8e9"}, "config": {"enabled": true, "alias": "_int_skilled_nursing_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_skilled_nursing_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.723368, "relation_name": "dev_sarah.claims_preprocessing._int_skilled_nursing_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Skilled Nursing' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('21','22')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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__skilled_nursing_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, 'Skilled Nursing' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('21','22')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.service_category__hospice_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__hospice_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__hospice_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__hospice_institutional.sql", "unique_id": "model.the_tuva_project.service_category__hospice_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__hospice_institutional"], "alias": "_int_hospice_institutional", "checksum": {"name": "sha256", "checksum": "ebbffe3eb2aea1f6a21075a9ed95b78d792249fb0e96881a9602eb67fd932ada"}, "config": {"enabled": true, "alias": "_int_hospice_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_hospice_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.69279, "relation_name": "dev_sarah.claims_preprocessing._int_hospice_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Hospice' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('81','82')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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__hospice_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, 'Hospice' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('81','82')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "052943cb247579c08b433229e0cb7d07e450d099e8a7b1ab8267e006313051ec"}, "config": {"enabled": true, "alias": "_int_outpatient_hospital_or_clinic_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.712309, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Outpatient Hospital or Clinic' as service_category_2\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 ('15','17','19','22','49','50','60','71','72')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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_hospital_or_clinic_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Outpatient Hospital or Clinic' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('15','17','19','22','49','50','60','71','72')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.service_category__skilled_nursing_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__skilled_nursing_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__skilled_nursing_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__skilled_nursing_professional.sql", "unique_id": "model.the_tuva_project.service_category__skilled_nursing_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__skilled_nursing_professional"], "alias": "_int_skilled_nursing_professional", "checksum": {"name": "sha256", "checksum": "2d5376240b800c65d05b28979c7bd88f025545f331e601d88072691f8e85870f"}, "config": {"enabled": true, "alias": "_int_skilled_nursing_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_skilled_nursing_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.725609, "relation_name": "dev_sarah.claims_preprocessing._int_skilled_nursing_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n a.claim_id\n, a.claim_line_number\n, 'Skilled Nursing' as service_category_2\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": [["service_category__stg_medical_claim"], ["service_category__dme_professional"]], "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__skilled_nursing_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n a.claim_id\n, a.claim_line_number\n, 'Skilled Nursing' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__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": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "d02515a43270345cf23a5e6077f4020baa73e090f50c82160a28c964b459c20e"}, "config": {"enabled": true, "alias": "_int_lab_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.7049751, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Lab' as service_category_2\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 = '81'", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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__lab_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Lab' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code = '81'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.service_category__combined_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__combined_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__combined_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional.sql", "unique_id": "model.the_tuva_project.service_category__combined_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__combined_institutional"], "alias": "_int_combined_institutional", "checksum": {"name": "sha256", "checksum": "f69e498d95f17ebbc0e17e220dd7a3fccf3386cff3f3fac856f22ea5b607b608"}, "config": {"enabled": true, "alias": "_int_combined_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_combined_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.663115, "relation_name": "dev_sarah.claims_preprocessing._int_combined_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith duplicate_bill_types as (\nselect distinct\n claim_id\n, 'Other' as service_category_2\nfrom {{ ref('service_category__duplicate_bill_types') }}\n)\n\n, combine as (\nselect *\nfrom {{ ref('service_category__acute_inpatient_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__dialysis_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__emergency_department_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__home_health_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__hospice_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__lab_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__outpatient_hospital_or_clinic_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__outpatient_psychiatric_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__skilled_nursing_institutional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__urgent_care_institutional') }}\n)\n\nselect\n claim_id\n, service_category_2\nfrom duplicate_bill_types\n\nunion all\n\nselect\n a.claim_id\n, a.service_category_2\nfrom combine a\nleft join duplicate_bill_types b\n on a.claim_id = b.claim_id\nwhere b.claim_id is null", "language": "sql", "refs": [["service_category__duplicate_bill_types"], ["service_category__acute_inpatient_institutional"], ["service_category__dialysis_institutional"], ["service_category__emergency_department_institutional"], ["service_category__home_health_institutional"], ["service_category__hospice_institutional"], ["service_category__lab_institutional"], ["service_category__outpatient_hospital_or_clinic_institutional"], ["service_category__outpatient_psychiatric_institutional"], ["service_category__skilled_nursing_institutional"], ["service_category__urgent_care_institutional"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__duplicate_bill_types", "model.the_tuva_project.service_category__acute_inpatient_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__hospice_institutional", "model.the_tuva_project.service_category__lab_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__skilled_nursing_institutional", "model.the_tuva_project.service_category__urgent_care_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional.sql", "compiled": true, "compiled_code": "\n\nwith duplicate_bill_types as (\nselect distinct\n claim_id\n, 'Other' as service_category_2\nfrom dev_sarah.claims_preprocessing._int_duplicate_bill_types\n)\n\n, combine as (\nselect *\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_dialysis_institutional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_emergency_department_institutional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_home_health_institutional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_hospice_institutional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_lab_institutional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_outpatient_psychiatric_institutional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_skilled_nursing_institutional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_urgent_care_institutional\n)\n\nselect\n claim_id\n, service_category_2\nfrom duplicate_bill_types\n\nunion all\n\nselect\n a.claim_id\n, a.service_category_2\nfrom combine a\nleft join duplicate_bill_types b\n on a.claim_id = b.claim_id\nwhere b.claim_id is null", "extra_ctes_injected": true, "extra_ctes": []}, "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": "c9276e41639a67f3426d08db8e9dcbf41f5fd3dbab1aa2aa73619253418bf377"}, "config": {"enabled": true, "alias": "_int_urgent_care_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.727972, "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)))\n )\n}}\n\nselect distinct \n a.claim_id\n, 'Urgent Care' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nleft join {{ ref('service_category__emergency_department_institutional') }} b\n on a.claim_id = b.claim_id\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and left(bill_type_code,2) in ('13','71','73')\n and b.claim_id is null", "language": "sql", "refs": [["service_category__stg_medical_claim"], ["service_category__emergency_department_institutional"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__emergency_department_institutional"]}, "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 __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n a.claim_id\n, 'Urgent Care' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join dev_sarah.claims_preprocessing._int_emergency_department_institutional b\n on a.claim_id = b.claim_id\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and left(bill_type_code,2) in ('13','71','73')\n and b.claim_id is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.service_category__acute_inpatient_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__acute_inpatient_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional.sql", "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__acute_inpatient_institutional"], "alias": "_int_acute_inpatient_institutional", "checksum": {"name": "sha256", "checksum": "102b98bfad308a4b15a56e009424b8cb75e94d87ac512dff9d6b400066ca685c"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.6665359, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith room_and_board_requirement as (\nselect distinct \n claim_id\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and revenue_center_code in\n ('0100','0101',\n '0110','0111','0112','0113','0114','0116','0117','0118','0119',\n '0120','0121','0122','0123','0124','0126','0127','0128','0129',\n '0130','0131','0132','0133','0134','0136','0137','0138','0139',\n '0140','0141','0142','0143','0144','0146','0147','0148','0149',\n '0150','0151','0152','0153','0154','0156','0157','0158','0159',\n '0160','0164','0167','0169',\n '0170','0171','0172','0173','0174','0179',\n '0190','0191','0192','0193','0194','0199',\n '0200','0201','0202','0203','0204','0206','0207','0208','0209',\n '0210','0211','0212','0213','0214','0219',\n '1000','1001','1002')\n)\n\n, drg_requirement as (\nselect distinct \n mc.claim_id\nfrom {{ ref('service_category__stg_medical_claim') }} mc\nleft join {{ ref('terminology__ms_drg')}} msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\nleft join {{ ref('terminology__apr_drg')}} aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\nwhere claim_type = 'institutional'\n and (msdrg.ms_drg_code is not null or aprdrg.apr_drg_code is not null)\n)\n\n, bill_type_requirement as (\nselect distinct \n claim_id\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('11','12') \n)\n\nselect distinct \n a.claim_id\n, 'Acute Inpatient' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join room_and_board_requirement b\n on a.claim_id = b.claim_id\ninner join drg_requirement c\n on a.claim_id = c.claim_id\ninner join bill_type_requirement d\n on a.claim_id = d.claim_id", "language": "sql", "refs": [["service_category__stg_medical_claim"], ["service_category__stg_medical_claim"], ["terminology__ms_drg"], ["terminology__apr_drg"], ["service_category__stg_medical_claim"], ["service_category__stg_medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "model.the_tuva_project.service_category__stg_medical_claim", "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_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n),room_and_board_requirement as (\nselect distinct \n claim_id\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and revenue_center_code in\n ('0100','0101',\n '0110','0111','0112','0113','0114','0116','0117','0118','0119',\n '0120','0121','0122','0123','0124','0126','0127','0128','0129',\n '0130','0131','0132','0133','0134','0136','0137','0138','0139',\n '0140','0141','0142','0143','0144','0146','0147','0148','0149',\n '0150','0151','0152','0153','0154','0156','0157','0158','0159',\n '0160','0164','0167','0169',\n '0170','0171','0172','0173','0174','0179',\n '0190','0191','0192','0193','0194','0199',\n '0200','0201','0202','0203','0204','0206','0207','0208','0209',\n '0210','0211','0212','0213','0214','0219',\n '1000','1001','1002')\n)\n\n, drg_requirement as (\nselect distinct \n mc.claim_id\nfrom __dbt__cte__service_category__stg_medical_claim mc\nleft join dev_sarah.terminology.ms_drg msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\nleft join dev_sarah.terminology.apr_drg aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\nwhere claim_type = 'institutional'\n and (msdrg.ms_drg_code is not null or aprdrg.apr_drg_code is not null)\n)\n\n, bill_type_requirement as (\nselect distinct \n claim_id\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('11','12') \n)\n\nselect distinct \n a.claim_id\n, 'Acute Inpatient' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join room_and_board_requirement b\n on a.claim_id = b.claim_id\ninner join drg_requirement c\n on a.claim_id = c.claim_id\ninner join bill_type_requirement d\n on a.claim_id = d.claim_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.service_category__office_visit_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__office_visit_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_visit_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_visit_professional.sql", "unique_id": "model.the_tuva_project.service_category__office_visit_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_visit_professional"], "alias": "_int_office_visit_professional", "checksum": {"name": "sha256", "checksum": "2cbbf68b4dba7ef381f9b08926d395be97e2d82a474888d03d8cdd211878f3ff"}, "config": {"enabled": true, "alias": "_int_office_visit_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_office_visit_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false}, "created_at": 1708545506.707309, "relation_name": "dev_sarah.claims_preprocessing._int_office_visit_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Office Visit' as service_category_2\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 ('11','02')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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__office_visit_professional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Office Visit' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('11','02')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "3d32397613f5bce6e4fc5ec30b388512cf712a18a5e53a3bc1965c4fabbe37f4"}, "config": {"enabled": true, "alias": "_int_combined_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.6608992, "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)))\n )\n}}\n\nwith combined as (\nselect *\nfrom {{ ref('service_category__acute_inpatient_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__ambulatory_surgery_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__dialysis_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__emergency_department_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__home_health_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__hospice_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__inpatient_psychiatric_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__inpatient_rehab_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__lab_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__office_visit_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__outpatient_hospital_or_clinic_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__outpatient_psychiatric_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__outpatient_rehab_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__skilled_nursing_professional') }}\n\nunion all\n\nselect *\nfrom {{ ref('service_category__urgent_care_professional') }}\n)\n\nselect \n claim_id\n, claim_line_number\n, service_category_2\n, tuva_last_run\nfrom {{ ref('service_category__dme_professional') }}\n\nunion all\n\nselect \n a.claim_id\n, a.claim_line_number\n, a.service_category_2\n, a.tuva_last_run\nfrom {{ ref('service_category__ambulance_professional') }} 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 (b.claim_id is null and b.claim_line_number is null)\n\nunion all\n\nselect \n a.claim_id\n, a.claim_line_number\n, a.service_category_2\n, a.tuva_last_run\nfrom combined 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\nleft join {{ ref('service_category__ambulance_professional') }} c\n on a.claim_id = c.claim_id\n and a.claim_line_number = c.claim_line_number\nwhere (b.claim_id is null and b.claim_line_number is null)\n and (c.claim_id is null and c.claim_line_number is null)", "language": "sql", "refs": [["service_category__acute_inpatient_professional"], ["service_category__ambulatory_surgery_professional"], ["service_category__dialysis_professional"], ["service_category__emergency_department_professional"], ["service_category__home_health_professional"], ["service_category__hospice_professional"], ["service_category__inpatient_psychiatric_professional"], ["service_category__inpatient_rehab_professional"], ["service_category__lab_professional"], ["service_category__office_visit_professional"], ["service_category__outpatient_hospital_or_clinic_professional"], ["service_category__outpatient_psychiatric_professional"], ["service_category__outpatient_rehab_professional"], ["service_category__skilled_nursing_professional"], ["service_category__urgent_care_professional"], ["service_category__dme_professional"], ["service_category__ambulance_professional"], ["service_category__dme_professional"], ["service_category__dme_professional"], ["service_category__ambulance_professional"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "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__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_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__skilled_nursing_professional", "model.the_tuva_project.service_category__urgent_care_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__ambulance_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__ambulance_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 as (\nselect *\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_ambulatory_surgery_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_dialysis_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_emergency_department_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_home_health_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_hospice_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_inpatient_psychiatric_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_inpatient_rehab_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_lab_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_office_visit_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_outpatient_psychiatric_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_outpatient_rehab_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_skilled_nursing_professional\n\nunion all\n\nselect *\nfrom dev_sarah.claims_preprocessing._int_urgent_care_professional\n)\n\nselect \n claim_id\n, claim_line_number\n, service_category_2\n, tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_dme_professional\n\nunion all\n\nselect \n a.claim_id\n, a.claim_line_number\n, a.service_category_2\n, a.tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_ambulance_professional 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 (b.claim_id is null and b.claim_line_number is null)\n\nunion all\n\nselect \n a.claim_id\n, a.claim_line_number\n, a.service_category_2\n, a.tuva_last_run\nfrom combined 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\nleft join dev_sarah.claims_preprocessing._int_ambulance_professional c\n on a.claim_id = c.claim_id\n and a.claim_line_number = c.claim_line_number\nwhere (b.claim_id is null and b.claim_line_number is null)\n and (c.claim_id is null and c.claim_line_number is null)", "extra_ctes_injected": true, "extra_ctes": []}, "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": "50b1e4793cfe956fb8bd2b5add08bbf455f44565cdecb7ab7595a821353121a0"}, "config": {"enabled": true, "alias": "_int_ambulance_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.671048, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Ambulance' as service_category_2\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 'A0425' and 'A0436' or place_of_service_code in ('41','42'))", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Ambulance' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and (hcpcs_code between 'A0425' and 'A0436' or place_of_service_code in ('41','42'))", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "57c360280ab2e02065cd5f171a3140eabf98c45f306ca0c6d25a23cb8d4e8da4"}, "config": {"enabled": true, "alias": "_int_outpatient_psychiatric_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.718039, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Outpatient Psychiatric' as service_category_2\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": [["service_category__stg_medical_claim"]], "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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Outpatient Psychiatric' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__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": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "28541b14bd2f5f643cbe8567d6bbc45847512c8743abc6e30fe0f7f0145f6fdd"}, "config": {"enabled": true, "alias": "_int_emergency_department_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.6833868, "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)))\n )\n}}\n\nselect distinct \n med.claim_id\n , 'Emergency Department' as service_category_2\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\nleft join {{ ref('service_category__acute_inpatient_institutional') }} inpatient\n on med.claim_id = inpatient.claim_id\nwhere claim_type = 'institutional'\nand revenue_center_code in ('0450','0451','0452','0459','0981')\nand inpatient.claim_id is null\n-- 0456, urgent care, is included in most published definitions\n-- that also include a requirement of a bill type code for\n-- inpatient or outpatient hospital.", "language": "sql", "refs": [["service_category__stg_medical_claim"], ["service_category__acute_inpatient_institutional"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__acute_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 __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n med.claim_id\n , 'Emergency Department' as service_category_2\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim med\nleft join dev_sarah.claims_preprocessing._int_acute_inpatient_institutional inpatient\n on med.claim_id = inpatient.claim_id\nwhere claim_type = 'institutional'\nand revenue_center_code in ('0450','0451','0452','0459','0981')\nand inpatient.claim_id is null\n-- 0456, urgent care, is included in most published definitions\n-- that also include a requirement of a bill type code for\n-- inpatient or outpatient hospital.", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "28128bda9ea23283556e27e74e68d38fd43c387634a682af1766424ad7b13262"}, "config": {"enabled": true, "alias": "_int_outpatient_hospital_or_clinic_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.709674, "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)))\n )\n}}\n\nselect distinct \n a.claim_id\n, 'Outpatient Hospital or Clinic' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nleft join {{ ref('service_category__emergency_department_institutional') }} b\n on a.claim_id = b.claim_id\nleft join {{ ref('service_category__urgent_care_institutional') }} c\n on a.claim_id = c.claim_id\nwhere a.claim_type = 'institutional'\n and left(a.bill_type_code,2) in ('13','71','73')\n and b.claim_id is null\n and c.claim_id is null", "language": "sql", "refs": [["service_category__stg_medical_claim"], ["service_category__emergency_department_institutional"], ["service_category__urgent_care_institutional"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__urgent_care_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 __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n a.claim_id\n, 'Outpatient Hospital or Clinic' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join dev_sarah.claims_preprocessing._int_emergency_department_institutional b\n on a.claim_id = b.claim_id\nleft join dev_sarah.claims_preprocessing._int_urgent_care_institutional c\n on a.claim_id = c.claim_id\nwhere a.claim_type = 'institutional'\n and left(a.bill_type_code,2) in ('13','71','73')\n and b.claim_id is null\n and c.claim_id is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "1bff47377ee62565644d65bcbf20b48eb55cd6aa30f26f825a760a79547bc642"}, "config": {"enabled": true, "alias": "_int_outpatient_rehab_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.72068, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, 'Outpatient Rehabilitation' as service_category_2\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": [["service_category__stg_medical_claim"]], "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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, claim_line_number\n, 'Outpatient Rehabilitation' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('62')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "86d5748aa48ca63f0a2ef4fb1fab84cbf0f114d43f16f27f8a4bb0fbe02303be"}, "config": {"enabled": true, "alias": "_int_outpatient_psychiatric_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.714494, "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)))\n )\n}}\n\nselect distinct \n claim_id\n, 'Outpatient Psychiatric' as service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('52')", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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_institutional.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct \n claim_id\n, 'Outpatient Psychiatric' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('52')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "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": "e9bab19d3e02d461a0c3eaa360c38fdf7b386a92891d50701b326e976e9d0e58"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "N/A", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_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}, "created_at": 1708545506.668708, "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)))\n )\n}}\n\nselect distinct\n claim_id\n, claim_line_number\n, 'Acute Inpatient' as service_category_2\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 = '21'", "language": "sql", "refs": [["service_category__stg_medical_claim"]], "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\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)select distinct\n claim_id\n, claim_line_number\n, 'Acute Inpatient' as service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code = '21'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.service_category__stg_medical_claim", "sql": " __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.acute_inpatient__stg_medical_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "acute_inpatient__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_medical_claim.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "staging", "acute_inpatient__stg_medical_claim"], "alias": "acute_inpatient__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "df60d74ac5218cec27b0cd8cac92064235e947bc335535e222c9316fd0d77533"}, "config": {"enabled": true, "alias": "acute_inpatient__stg_medical_claim", "schema": null, "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "acute_inpatient__stg_medical_claim", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.620926, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }}", "language": "sql", "refs": [["normalized_input__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.acute_inpatient__stg_service_category": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "acute_inpatient__stg_service_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_service_category.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_service_category.sql", "unique_id": "model.the_tuva_project.acute_inpatient__stg_service_category", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "staging", "acute_inpatient__stg_service_category"], "alias": "acute_inpatient__stg_service_category", "checksum": {"name": "sha256", "checksum": "2209519a82d2ab3d0f216a7634d07152514384339013c7fed208cffecb3646d3"}, "config": {"enabled": true, "alias": "acute_inpatient__stg_service_category", "schema": null, "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "acute_inpatient__stg_service_category", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.622756, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__service_category_grouper')}}", "language": "sql", "refs": [["service_category__service_category_grouper"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__service_category_grouper"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_service_category.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.service_category_grouper", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.acute_inpatient__stg_eligibility": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "acute_inpatient__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_eligibility.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_eligibility.sql", "unique_id": "model.the_tuva_project.acute_inpatient__stg_eligibility", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "staging", "acute_inpatient__stg_eligibility"], "alias": "acute_inpatient__stg_eligibility", "checksum": {"name": "sha256", "checksum": "da19d68fb195a59a154da1c1138ac88b33b7b8472f808d7adbb7f34ca199ae9d"}, "config": {"enabled": true, "alias": "acute_inpatient__stg_eligibility", "schema": null, "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"alias": "acute_inpatient__stg_eligibility", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.619382, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n patient_id\n , birth_date\n , gender\n , race\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__eligibility') }}", "language": "sql", "refs": [["normalized_input__eligibility"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/staging/acute_inpatient__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , birth_date\n , gender\n , race\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.acute_inpatient__summary": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/final/acute_inpatient__summary.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/final/acute_inpatient__summary.sql", "unique_id": "model.the_tuva_project.acute_inpatient__summary", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "final", "acute_inpatient__summary"], "alias": "acute_inpatient_summary", "checksum": {"name": "sha256", "checksum": "2c7134e1d4bb9293da6cc7b6949924a8ca43abfd1ead18ac20b442d0fdaa02c3"}, "config": {"enabled": true, "alias": "acute_inpatient_summary", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "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 the acute inpatient encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the patient was admitted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the patient was discharged.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient as of their admission date.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "The NPI for the facility where the encounter occurred.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the provider.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "The MS-DRG code 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, "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "The MS-DRG description associted with the inpatient visit", "meta": {}, "data_type": null, "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "Indicates whether the MS-DRG is medical or surgical in nature.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "The APR-DRG code associted with the inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "The APR-DRG description associted with the inpatient visit", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Admission source description for the encounter.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Admission type description for the encounter.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Discharge disposition description for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total paid amount across all claims for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total allowed amount across all claims for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total charge amount across all claims for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "The length of stay for the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "1 if a patient died during the encounter, 0 otherwise.", "meta": {}, "data_type": null, "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\").", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "acute_inpatient_summary", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.592476, "relation_name": "dev_sarah.claims_preprocessing.acute_inpatient_summary", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith distinct_encounters as (\n select distinct\n a.encounter_id\n , a.patient_id\n , b.encounter_start_date\n , b.encounter_end_date\nfrom {{ ref('acute_inpatient__encounter_id') }} a\ninner join {{ ref('acute_inpatient__encounter_start_and_end_dates') }} b\n on a.encounter_id = b.encounter_id\n)\n\n, institutional_claim_details as (\n select\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi as facility_npi\n , first.ms_drg_code as ms_drg_code\n , first.apr_drg_code as apr_drg_code\n , first.admit_source_code as admit_source_code\n , first.admit_type_code as admit_type_code\n , last.discharge_disposition_code as discharge_disposition_code\n , sum(paid_amount) as inst_paid_amount\n , sum(allowed_amount) as inst_allowed_amount\n , sum(charge_amount) as inst_charge_amount\n , max(data_source) as data_source\n from {{ ref('medical_claim') }} a\n inner join {{ ref('acute_inpatient__encounter_id') }} b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'institutional'\n inner join {{ ref('acute_inpatient__first_claim_values') }} first\n on b.encounter_id = first.encounter_id\n and first.claim_row = 1\n inner join {{ ref('acute_inpatient__last_claim_values') }} last\n on b.encounter_id = last.encounter_id\n and last.claim_row = 1\n group by\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi\n , first.ms_drg_code\n , first.apr_drg_code\n , first.admit_source_code\n , first.admit_type_code\n , last.discharge_disposition_code\n)\n\n, professional_claim_details as (\n select\n b.encounter_id\n , sum(paid_amount) as prof_paid_amount\n , sum(allowed_amount) as prof_allowed_amount\n , sum(charge_amount) as prof_charge_amount\n from {{ ref('acute_inpatient__stg_medical_claim') }} a\n inner join {{ ref('acute_inpatient__encounter_id') }} b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'professional'\ngroup by 1\n)\n\n, patient as (\n select distinct\n patient_id\n , birth_date\n , gender\n , race\n from {{ ref('acute_inpatient__stg_eligibility') }}\n )\n\n, provider as (\n select\n a.encounter_id\n , max(a.facility_npi) as facility_npi\n , b.provider_first_name\n , b.provider_last_name\n , count(distinct facility_npi) as npi_count\n from {{ ref('acute_inpatient__institutional_encounter_id') }} a\n left join {{ ref('terminology__provider') }} b\n on a.facility_npi = b.npi\n group by 1,3,4\n)\n\nselect\n a.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, a.patient_id\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.description, icd9cm.long_description) as primary_diagnosis_description\n, f.facility_npi\n, f.provider_first_name\n, f.provider_last_name\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, c.inst_paid_amount + coalesce(d.prof_paid_amount,0) as total_paid_amount\n, c.inst_allowed_amount + coalesce(d.prof_allowed_amount,0) as total_allowed_amount\n, c.inst_charge_amount + coalesce(d.prof_charge_amount,0) as total_charge_amount\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, data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom distinct_encounters a\nleft join institutional_claim_details c\n on a.encounter_id = c.encounter_id\nleft join professional_claim_details d\n on a.encounter_id = d.encounter_id\nleft join patient e\n on a.patient_id = e.patient_id\nleft join provider f\n on a.encounter_id = f.encounter_id\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": [["acute_inpatient__encounter_id"], ["acute_inpatient__encounter_start_and_end_dates"], ["medical_claim"], ["acute_inpatient__encounter_id"], ["acute_inpatient__first_claim_values"], ["acute_inpatient__last_claim_values"], ["acute_inpatient__stg_medical_claim"], ["acute_inpatient__encounter_id"], ["acute_inpatient__stg_eligibility"], ["acute_inpatient__institutional_encounter_id"], ["terminology__provider"], ["terminology__discharge_disposition"], ["terminology__admit_source"], ["terminology__admit_type"], ["terminology__ms_drg"], ["terminology__apr_drg"], ["terminology__icd_10_cm"], ["terminology__icd_9_cm"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.input_layer.medical_claim", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__first_claim_values", "model.the_tuva_project.acute_inpatient__last_claim_values", "model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__stg_eligibility", "model.the_tuva_project.acute_inpatient__institutional_encounter_id", "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/acute_inpatient/final/acute_inpatient__summary.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n), __dbt__cte__acute_inpatient__stg_eligibility as (\n\n\nselect\n patient_id\n , birth_date\n , gender\n , race\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility\n),distinct_encounters as (\n select distinct\n a.encounter_id\n , a.patient_id\n , b.encounter_start_date\n , b.encounter_end_date\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_id a\ninner join dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates b\n on a.encounter_id = b.encounter_id\n)\n\n, institutional_claim_details as (\n select\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi as facility_npi\n , first.ms_drg_code as ms_drg_code\n , first.apr_drg_code as apr_drg_code\n , first.admit_source_code as admit_source_code\n , first.admit_type_code as admit_type_code\n , last.discharge_disposition_code as discharge_disposition_code\n , sum(paid_amount) as inst_paid_amount\n , sum(allowed_amount) as inst_allowed_amount\n , sum(charge_amount) as inst_charge_amount\n , max(data_source) as data_source\n from tuva.input_layer.medical_claim a\n inner join dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'institutional'\n inner join dev_sarah.claims_preprocessing._int_acute_inpatient_first_claim_values first\n on b.encounter_id = first.encounter_id\n and first.claim_row = 1\n inner join dev_sarah.claims_preprocessing._int_acute_inpatient_last_claim_values last\n on b.encounter_id = last.encounter_id\n and last.claim_row = 1\n group by\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi\n , first.ms_drg_code\n , first.apr_drg_code\n , first.admit_source_code\n , first.admit_type_code\n , last.discharge_disposition_code\n)\n\n, professional_claim_details as (\n select\n b.encounter_id\n , sum(paid_amount) as prof_paid_amount\n , sum(allowed_amount) as prof_allowed_amount\n , sum(charge_amount) as prof_charge_amount\n from __dbt__cte__acute_inpatient__stg_medical_claim a\n inner join dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'professional'\ngroup by 1\n)\n\n, patient as (\n select distinct\n patient_id\n , birth_date\n , gender\n , race\n from __dbt__cte__acute_inpatient__stg_eligibility\n )\n\n, provider as (\n select\n a.encounter_id\n , max(a.facility_npi) as facility_npi\n , b.provider_first_name\n , b.provider_last_name\n , count(distinct facility_npi) as npi_count\n from dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_encounter_id a\n left join dev_sarah.terminology.provider b\n on a.facility_npi = b.npi\n group by 1,3,4\n)\n\nselect\n a.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, a.patient_id\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.description, icd9cm.long_description) as primary_diagnosis_description\n, f.facility_npi\n, f.provider_first_name\n, f.provider_last_name\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, c.inst_paid_amount + coalesce(d.prof_paid_amount,0) as total_paid_amount\n, c.inst_allowed_amount + coalesce(d.prof_allowed_amount,0) as total_allowed_amount\n, c.inst_charge_amount + coalesce(d.prof_charge_amount,0) as total_charge_amount\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, data_source\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom distinct_encounters a\nleft join institutional_claim_details c\n on a.encounter_id = c.encounter_id\nleft join professional_claim_details d\n on a.encounter_id = d.encounter_id\nleft join patient e\n on a.patient_id = e.patient_id\nleft join provider f\n on a.encounter_id = f.encounter_id\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": [{"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}, {"id": "model.the_tuva_project.acute_inpatient__stg_eligibility", "sql": " __dbt__cte__acute_inpatient__stg_eligibility as (\n\n\nselect\n patient_id\n , birth_date\n , gender\n , race\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility\n)"}]}, "model.the_tuva_project.acute_inpatient__professional_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__professional_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__professional_encounter_id.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__professional_encounter_id.sql", "unique_id": "model.the_tuva_project.acute_inpatient__professional_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__professional_encounter_id"], "alias": "_int_acute_inpatient_professional_encounter_id", "checksum": {"name": "sha256", "checksum": "b4f528f3fe605f8db1790672e351bd86e8c560547d5e0a904a84c9699e4863f0"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_professional_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Assigns encounter_id to every acute inpatient professional claim", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_professional_encounter_id", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.605016, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_professional_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model assigns professional acute inpatient\n-- claims to acute inpatient encounters.\n-- Some acute inpatient professional claims do not fall\n-- within an acute inpatient encounter. We call these\n-- orphan claims, and they do not have an encounter_id.\n-- Some acute inpatient professional claims fall within\n-- more than one acute inpatient encounter. Since we do not\n-- know what encounter these claims should be mapped to\n-- we do not assign them an encounter_id. These claims\n-- have encounter_count > 1.\n-- This model returns a table with 5 fields:\n-- patient_id\n-- claim_id\n-- encounter_id (is null for orphan claims or claims\n-- that fall within more than one encounter)\n-- orphan_claim_flag (is always 0 or 1)\n-- encounter_count (an integer that represents the number\n-- of acute inpatient encounters this\n-- professional claim could fall into:\n-- could be 0,1,2,3,... but is never null\n-- for acute inpatient professional claims)\n-- *************************************************\n\n\n\n\nwith acute_inpatient_professional_claim_ids as (\nselect distinct \n claim_id\n , claim_line_number\nfrom {{ ref('acute_inpatient__stg_service_category') }} \nwhere claim_type = 'professional'\n and service_category_2 = 'Acute Inpatient'\n),\n\nacute_inpatient_professional_claim_lines as (\nselect\n mc.claim_id,\n mc.claim_line_number,\n mc.patient_id,\n mc.claim_start_date as start_date,\n mc.claim_end_date as end_date\t \nfrom {{ ref('acute_inpatient__stg_medical_claim') }} mc\ninner join acute_inpatient_professional_claim_ids prof\n on mc.claim_id = prof.claim_id\n and mc.claim_line_number = prof.claim_line_number\n),\n\n\nacute_inpatient_professional_claim_dates as (\nselect\n claim_id,\n claim_line_number,\n patient_id,\n min(start_date) as start_date,\n max(end_date) as end_date\nfrom acute_inpatient_professional_claim_lines\ngroup by claim_id, claim_line_number, patient_id\n),\n\n\nroll_up_professional_claims_to_institutional_claims as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n bb.encounter_id,\n case\n when bb.encounter_id is null then 1\n else 0\n end as orphan_claim_flag\nfrom acute_inpatient_professional_claim_dates aa\nleft join {{ ref('acute_inpatient__encounter_start_and_end_dates') }} bb\n on aa.patient_id = bb.patient_id\n and (coalesce(aa.start_date, aa.end_date) between bb.encounter_start_date and bb.encounter_end_date)\n and (coalesce(aa.end_date, aa.start_date) between bb.encounter_start_date and bb.encounter_end_date)\n),\n\nprofessional_claims_in_more_than_one_encounter as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n min(start_date) as start_date,\n max(end_date) as end_date,\n count(distinct encounter_id) as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims\ngroup by patient_id, claim_line_number, claim_id\nhaving count(distinct encounter_id) > 1\n),\n\n\nprofessional_claims_not_in_more_than_one_encounter as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.orphan_claim_flag,\n case\n when (aa.orphan_claim_flag = 1) then 0\n else 1\n end as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims aa\nleft join professional_claims_in_more_than_one_encounter bb\non aa.claim_id = bb.claim_id\nand aa.claim_line_number = bb.claim_line_number\nand aa.patient_id = bb.patient_id\nwhere (bb.patient_id is null) and (bb.claim_id is null)\n),\n\n\nall_acute_inpatient_professional_claims as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n encounter_id,\n orphan_claim_flag,\n encounter_count\nfrom professional_claims_not_in_more_than_one_encounter\n\nunion all\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n null as encounter_id,\n 0 as orphan_claim_count,\n encounter_count\nfrom professional_claims_in_more_than_one_encounter\n)\n\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom all_acute_inpatient_professional_claims", "language": "sql", "refs": [["acute_inpatient__stg_service_category"], ["acute_inpatient__stg_medical_claim"], ["acute_inpatient__encounter_start_and_end_dates"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__stg_service_category", "model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__professional_encounter_id.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model assigns professional acute inpatient\n-- claims to acute inpatient encounters.\n-- Some acute inpatient professional claims do not fall\n-- within an acute inpatient encounter. We call these\n-- orphan claims, and they do not have an encounter_id.\n-- Some acute inpatient professional claims fall within\n-- more than one acute inpatient encounter. Since we do not\n-- know what encounter these claims should be mapped to\n-- we do not assign them an encounter_id. These claims\n-- have encounter_count > 1.\n-- This model returns a table with 5 fields:\n-- patient_id\n-- claim_id\n-- encounter_id (is null for orphan claims or claims\n-- that fall within more than one encounter)\n-- orphan_claim_flag (is always 0 or 1)\n-- encounter_count (an integer that represents the number\n-- of acute inpatient encounters this\n-- professional claim could fall into:\n-- could be 0,1,2,3,... but is never null\n-- for acute inpatient professional claims)\n-- *************************************************\n\n\n\n\nwith __dbt__cte__acute_inpatient__stg_service_category as (\n\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.service_category_grouper\n), __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n),acute_inpatient_professional_claim_ids as (\nselect distinct \n claim_id\n , claim_line_number\nfrom __dbt__cte__acute_inpatient__stg_service_category \nwhere claim_type = 'professional'\n and service_category_2 = 'Acute Inpatient'\n),\n\nacute_inpatient_professional_claim_lines as (\nselect\n mc.claim_id,\n mc.claim_line_number,\n mc.patient_id,\n mc.claim_start_date as start_date,\n mc.claim_end_date as end_date\t \nfrom __dbt__cte__acute_inpatient__stg_medical_claim mc\ninner join acute_inpatient_professional_claim_ids prof\n on mc.claim_id = prof.claim_id\n and mc.claim_line_number = prof.claim_line_number\n),\n\n\nacute_inpatient_professional_claim_dates as (\nselect\n claim_id,\n claim_line_number,\n patient_id,\n min(start_date) as start_date,\n max(end_date) as end_date\nfrom acute_inpatient_professional_claim_lines\ngroup by claim_id, claim_line_number, patient_id\n),\n\n\nroll_up_professional_claims_to_institutional_claims as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n bb.encounter_id,\n case\n when bb.encounter_id is null then 1\n else 0\n end as orphan_claim_flag\nfrom acute_inpatient_professional_claim_dates aa\nleft join dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates bb\n on aa.patient_id = bb.patient_id\n and (coalesce(aa.start_date, aa.end_date) between bb.encounter_start_date and bb.encounter_end_date)\n and (coalesce(aa.end_date, aa.start_date) between bb.encounter_start_date and bb.encounter_end_date)\n),\n\nprofessional_claims_in_more_than_one_encounter as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n min(start_date) as start_date,\n max(end_date) as end_date,\n count(distinct encounter_id) as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims\ngroup by patient_id, claim_line_number, claim_id\nhaving count(distinct encounter_id) > 1\n),\n\n\nprofessional_claims_not_in_more_than_one_encounter as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.orphan_claim_flag,\n case\n when (aa.orphan_claim_flag = 1) then 0\n else 1\n end as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims aa\nleft join professional_claims_in_more_than_one_encounter bb\non aa.claim_id = bb.claim_id\nand aa.claim_line_number = bb.claim_line_number\nand aa.patient_id = bb.patient_id\nwhere (bb.patient_id is null) and (bb.claim_id is null)\n),\n\n\nall_acute_inpatient_professional_claims as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n encounter_id,\n orphan_claim_flag,\n encounter_count\nfrom professional_claims_not_in_more_than_one_encounter\n\nunion all\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n null as encounter_id,\n 0 as orphan_claim_count,\n encounter_count\nfrom professional_claims_in_more_than_one_encounter\n)\n\n\n\nselect *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom all_acute_inpatient_professional_claims", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.acute_inpatient__stg_service_category", "sql": " __dbt__cte__acute_inpatient__stg_service_category as (\n\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.service_category_grouper\n)"}, {"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.acute_inpatient__last_claim_values": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__last_claim_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__last_claim_values.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__last_claim_values.sql", "unique_id": "model.the_tuva_project.acute_inpatient__last_claim_values", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__last_claim_values"], "alias": "_int_acute_inpatient_last_claim_values", "checksum": {"name": "sha256", "checksum": "f186ca93d67a8ea70a6f9c0069d883a0e1b4e732187a37420b047a8486d8a50a"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_last_claim_values", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Orders claims to pull out encounter details (admit type, drg, etc)", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_last_claim_values", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.617698, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_last_claim_values", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith first_claim_values as(\r\n select distinct\r\n e.encounter_id\r\n , coalesce(claim_start_date, admission_date) as claim_start\r\n , discharge_disposition_code\r\n from {{ ref('acute_inpatient__encounter_id')}} e\r\n inner join {{ ref('acute_inpatient__stg_medical_claim') }} m\r\n on e.claim_id = m.claim_id\r\n where claim_type = 'institutional'\r\n)\r\n\r\nselect\r\n encounter_id\r\n , claim_start\r\n , discharge_disposition_code\r\n , row_number() over (partition by encounter_id order by claim_start desc) as claim_row\r\nfrom first_claim_values", "language": "sql", "refs": [["acute_inpatient__encounter_id"], ["acute_inpatient__stg_medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__last_claim_values.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n),first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , discharge_disposition_code\n from dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_id e\n inner join __dbt__cte__acute_inpatient__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , discharge_disposition_code\n , row_number() over (partition by encounter_id order by claim_start desc) as claim_row\nfrom first_claim_values", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__encounter_data_for_medical_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_data_for_medical_claims.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_data_for_medical_claims.sql", "unique_id": "model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__encounter_data_for_medical_claims"], "alias": "_int_encounter_data_for_medical_claims", "checksum": {"name": "sha256", "checksum": "fe3d0e76699c5090ec2702da0044f101bb4a8b5106089058eef255c8d08cd741"}, "config": {"enabled": true, "alias": "_int_encounter_data_for_medical_claims", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "All encounter-related fields that will be added to medical_claim", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_encounter_data_for_medical_claims", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.613065, "relation_name": "dev_sarah.claims_preprocessing._int_encounter_data_for_medical_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model returns all the columns with relevant\n-- encounter fields that we will append to the medical_claim\n-- table.\n\n-- It returns a table with these columns:\n-- patient_id\n-- claim_id\n-- encounter_type\n-- encounter_id\n-- start_date (date used for merging claims into encounters)\n-- end_date (date used for merging claims into encounters)\n-- encounter_start_date,\n-- encounter_end_date,\n-- encounter_admit_source_code,\n-- encounter_admit_type_code,\n-- encounter_discharge_disposition_code\n-- orphan_claim_flag (always 0 or 1) (never null)\n-- encounter_count (could be 0,1,2,3,...) (never null)\n-- *************************************************\n\n\n\n\nwith acute_inpatient_claims_with_encounter_id as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date, \n-- Relevant encounter-level fields for\n-- professional and institutional acute inpatient\n-- claims that are assigned to an encounter:\n 'acute inpatient' as encounter_type,\n encounter_id,\n encounter_start_date,\n encounter_end_date,\n encounter_admit_source_code,\n encounter_admit_type_code,\n encounter_discharge_disposition_code,\n-- Fields that are only relevant for professional\n-- acute inpatient claims that are not assigned to\n-- an encounter because they are orphan claims or because\n-- they overlap with more than one encounter:\n 0 as orphan_claim_flag,\n 1 as encounter_count\nfrom {{ ref('acute_inpatient__claims_with_encounter_data') }}\n),\n\n\nacute_inpatient_claims_without_encounter_id as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date, \n-- Relevant encounter-level fields for\n-- professional and institutional acute inpatient\n-- claims that are assigned to an encounter:\n 'acute inpatient' encounter_type,\n cast(null as {{ dbt.type_string() }}) as encounter_id,\n cast(null as date) as encounter_start_date,\n cast(null as date) as encounter_end_date,\n cast(null as {{ dbt.type_string() }}) as encounter_admit_source_code,\n cast(null as {{ dbt.type_string() }}) as encounter_admit_type_code,\n cast(null as {{ dbt.type_string() }}) as encounter_discharge_disposition_code,\n-- Fields that are only relevant for professional\n-- acute inpatient claims that are not assigned to\n-- an encounter because they are orphan claims or because\n-- they overlap with more than one encounter:\n orphan_claim_flag,\n encounter_count\n \nfrom {{ ref('acute_inpatient__professional_encounter_id') }}\nwhere (orphan_claim_flag = 1) or (encounter_count > 1)\n)\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom acute_inpatient_claims_with_encounter_id\n\nunion all\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom acute_inpatient_claims_without_encounter_id", "language": "sql", "refs": [["acute_inpatient__claims_with_encounter_data"], ["acute_inpatient__professional_encounter_id"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "model.the_tuva_project.acute_inpatient__professional_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_data_for_medical_claims.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model returns all the columns with relevant\n-- encounter fields that we will append to the medical_claim\n-- table.\n\n-- It returns a table with these columns:\n-- patient_id\n-- claim_id\n-- encounter_type\n-- encounter_id\n-- start_date (date used for merging claims into encounters)\n-- end_date (date used for merging claims into encounters)\n-- encounter_start_date,\n-- encounter_end_date,\n-- encounter_admit_source_code,\n-- encounter_admit_type_code,\n-- encounter_discharge_disposition_code\n-- orphan_claim_flag (always 0 or 1) (never null)\n-- encounter_count (could be 0,1,2,3,...) (never null)\n-- *************************************************\n\n\n\n\nwith acute_inpatient_claims_with_encounter_id as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date, \n-- Relevant encounter-level fields for\n-- professional and institutional acute inpatient\n-- claims that are assigned to an encounter:\n 'acute inpatient' as encounter_type,\n encounter_id,\n encounter_start_date,\n encounter_end_date,\n encounter_admit_source_code,\n encounter_admit_type_code,\n encounter_discharge_disposition_code,\n-- Fields that are only relevant for professional\n-- acute inpatient claims that are not assigned to\n-- an encounter because they are orphan claims or because\n-- they overlap with more than one encounter:\n 0 as orphan_claim_flag,\n 1 as encounter_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_claims_with_encounter_data\n),\n\n\nacute_inpatient_claims_without_encounter_id as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date, \n-- Relevant encounter-level fields for\n-- professional and institutional acute inpatient\n-- claims that are assigned to an encounter:\n 'acute inpatient' encounter_type,\n cast(null as TEXT) as encounter_id,\n cast(null as date) as encounter_start_date,\n cast(null as date) as encounter_end_date,\n cast(null as TEXT) as encounter_admit_source_code,\n cast(null as TEXT) as encounter_admit_type_code,\n cast(null as TEXT) as encounter_discharge_disposition_code,\n-- Fields that are only relevant for professional\n-- acute inpatient claims that are not assigned to\n-- an encounter because they are orphan claims or because\n-- they overlap with more than one encounter:\n orphan_claim_flag,\n encounter_count\n \nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_professional_encounter_id\nwhere (orphan_claim_flag = 1) or (encounter_count > 1)\n)\n\n\nselect *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom acute_inpatient_claims_with_encounter_id\n\nunion all\n\nselect *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom acute_inpatient_claims_without_encounter_id", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.acute_inpatient__data_quality_summary": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__data_quality_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__data_quality_summary.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__data_quality_summary.sql", "unique_id": "model.the_tuva_project.acute_inpatient__data_quality_summary", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__data_quality_summary"], "alias": "_int_acute_inpatient_data_quality_summary", "checksum": {"name": "sha256", "checksum": "edc0f5b74b6e1561baa5941028f6c14f4eafe3c2e2dba669ae2e2ed7bba6e4d0"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_data_quality_summary", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Summary of data quality issues with acute inpatient claims", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_data_quality_summary", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.598034, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_data_quality_summary", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model summarizes data quality issues\n-- that could affect claims preprocessing.\n-- The table returns 2 fields:\n-- field\n-- total_count\n--\n-- If we order the results by 'field', the first\n-- 3 rows give us a high level summary:\n--\n-- 01 Total acute inpatient institutional claims:\n-- This is the total number of acute inpatient\n-- institutional claims\n-- 02 Acute inpatient institutional claims with insights:\n-- This is the number of acute inpatient institutional\n-- claims for which something is not ideal (e.g. they\n-- are missing a claim_start_date) but it's not something\n-- that prevents the claim from being used in the\n-- encounter grouper.\n\n-- 03 Acute inpatient institutional claims with problems:\n-- This is the number of acute inpatient institutional\n-- claims that have a data quality problem that\n-- prevents them from being used in the encounter grouper.\n\n-- The rest of the rows in the table give us counts\n-- of the number of acute inpatient institutional claims\n-- that have specific data quality problems.\n-- *************************************************\n\n\n\n\nwith total_acute_inpatient__institutional_claims as (\nselect\n '01 Total acute inpatient institutional claims' as field,\n count(*) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\ntotal_claims_with_insights as (\nselect\n '02 Acute inpatient institutional claims with insights' as field,\n count(*) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\nwhere dq_insight = 1\n),\n\n\ntotal_claims_with_problems as (\nselect\n '03 Acute inpatient institutional claims with problems' as field,\n count(*) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\nwhere dq_problem = 1\n),\n\n\npatient_id_not_unique as (\nselect\n '04 patient_id_not_unique' as field,\n sum(patient_id_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\npatient_id_missing as (\nselect\n '05 patient_id_missing' as field,\n sum(patient_id_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_start_date_not_unique as (\nselect\n '06 claim_start_date_not_unique' as field,\n sum(claim_start_date_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_start_date_missing as (\nselect\n '07 claim_start_date_missing' as field,\n sum(claim_start_date_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_end_date_not_unique as (\nselect\n '08 claim_end_date_not_unique' as field,\n sum(claim_end_date_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_end_date_missing as (\nselect\n '09 claim_end_date_missing' as field,\n sum(claim_end_date_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_start_date_after_claim_end_date as (\nselect\n '10 claim_start_date_after_claim_end_date' as field,\n sum(claim_start_date_after_claim_end_date) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmission_date_not_unique as (\nselect\n '11 admission_date_not_unique' as field,\n sum(admission_date_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmission_date_missing as (\nselect\n '12 admission_date_missing' as field,\n sum(admission_date_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\ndischarge_date_not_unique as (\nselect\n '13 discharge_date_not_unique' as field,\n sum(discharge_date_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\ndischarge_date_missing as (\nselect\n '14 discharge_date_missing' as field,\n sum(discharge_date_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmission_date_after_discharge_date as (\nselect\n '15 admission_date_after_discharge_date' as field,\n sum(admission_date_after_discharge_date) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmit_type_code_not_unique as (\nselect\n '16 admit_type_code_not_unique' as field,\n sum(admit_type_code_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmit_type_code_missing as (\nselect\n '17 admit_type_code_missing' as field,\n sum(admit_type_code_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmit_source_code_not_unique as (\nselect\n '18 admit_source_code_not_unique' as field,\n sum(admit_source_code_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nadmit_source_code_missing as (\nselect\n '19 admit_source_code_missing' as field,\n sum(admit_source_code_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\ndischarge_disposition_code_not_unique as (\nselect\n '20 discharge_disposition_code_not_unique' as field,\n sum(discharge_disposition_code_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\ndischarge_disposition_code_missing as (\nselect\n '21 discharge_disposition_code_missing' as field,\n sum(discharge_disposition_code_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nfacility_npi_not_unique as (\nselect\n '22 facility_npi_not_unique' as field,\n sum(facility_npi_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nfacility_npi_missing as (\nselect\n '23 facility_npi_missing' as field,\n sum(facility_npi_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_type_not_unique as (\nselect\n '24 claim_type_not_unique' as field,\n sum(claim_type_not_unique) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_type_missing as (\nselect\n '25 claim_type_missing' as field,\n sum(claim_type_missing) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nclaim_type_not_institutional as (\nselect\n '26 claim_type_not_institutional' as field,\n sum(claim_type_not_institutional) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nstart_date_not_determined as (\nselect\n '27 start_date_not_determined' as field,\n sum(start_date_not_determined) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nend_date_not_determined as (\nselect\n '28 end_date_not_determined' as field,\n sum(end_date_not_determined) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\nstart_date_after_end_date as (\nselect\n '29 start_date_after_end_date' as field,\n sum(start_date_after_end_date) as total_count\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\n\n\nunion_cte as (\nselect *\nfrom total_acute_inpatient__institutional_claims\n\nunion all\n\nselect *\nfrom total_claims_with_insights\n\nunion all\n\nselect *\nfrom total_claims_with_problems\n\nunion all\n\nselect *\nfrom patient_id_not_unique\n\nunion all\n\nselect *\nfrom patient_id_missing\n\nunion all\n\nselect *\nfrom claim_start_date_not_unique\n\nunion all\n\nselect *\nfrom claim_start_date_missing\n\nunion all\n\nselect *\nfrom claim_end_date_not_unique\n\nunion all\n\nselect *\nfrom claim_end_date_missing\n\nunion all\n\nselect *\nfrom claim_start_date_after_claim_end_date\n\nunion all\n\nselect *\nfrom admission_date_not_unique\n\nunion all\n\nselect *\nfrom admission_date_missing\n\nunion all\n\nselect *\nfrom discharge_date_not_unique\n\nunion all\n\nselect *\nfrom discharge_date_missing\n\nunion all\n\nselect *\nfrom admission_date_after_discharge_date\n\nunion all\n\nselect *\nfrom admit_type_code_not_unique\n\nunion all\n\nselect *\nfrom admit_type_code_missing\n\nunion all\n\nselect *\nfrom admit_source_code_not_unique\n\nunion all\n\nselect *\nfrom admit_source_code_missing\n\nunion all\n\nselect *\nfrom discharge_disposition_code_not_unique\n\nunion all\n\nselect *\nfrom discharge_disposition_code_missing\n\nunion all\n\nselect *\nfrom facility_npi_not_unique\n\nunion all\n\nselect *\nfrom facility_npi_missing\n\nunion all\n\nselect *\nfrom claim_type_not_unique\n\nunion all\n\nselect *\nfrom claim_type_missing\n\nunion all\n\nselect *\nfrom claim_type_not_institutional\n\nunion all\n\nselect *\nfrom start_date_not_determined\n\nunion all\n\nselect *\nfrom end_date_not_determined\n\nunion all\n\nselect *\nfrom start_date_after_end_date\n)\n\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_claims"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__data_quality_summary.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model summarizes data quality issues\n-- that could affect claims preprocessing.\n-- The table returns 2 fields:\n-- field\n-- total_count\n--\n-- If we order the results by 'field', the first\n-- 3 rows give us a high level summary:\n--\n-- 01 Total acute inpatient institutional claims:\n-- This is the total number of acute inpatient\n-- institutional claims\n-- 02 Acute inpatient institutional claims with insights:\n-- This is the number of acute inpatient institutional\n-- claims for which something is not ideal (e.g. they\n-- are missing a claim_start_date) but it's not something\n-- that prevents the claim from being used in the\n-- encounter grouper.\n\n-- 03 Acute inpatient institutional claims with problems:\n-- This is the number of acute inpatient institutional\n-- claims that have a data quality problem that\n-- prevents them from being used in the encounter grouper.\n\n-- The rest of the rows in the table give us counts\n-- of the number of acute inpatient institutional claims\n-- that have specific data quality problems.\n-- *************************************************\n\n\n\n\nwith total_acute_inpatient__institutional_claims as (\nselect\n '01 Total acute inpatient institutional claims' as field,\n count(*) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ntotal_claims_with_insights as (\nselect\n '02 Acute inpatient institutional claims with insights' as field,\n count(*) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\nwhere dq_insight = 1\n),\n\n\ntotal_claims_with_problems as (\nselect\n '03 Acute inpatient institutional claims with problems' as field,\n count(*) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\nwhere dq_problem = 1\n),\n\n\npatient_id_not_unique as (\nselect\n '04 patient_id_not_unique' as field,\n sum(patient_id_not_unique) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\npatient_id_missing as (\nselect\n '05 patient_id_missing' as field,\n sum(patient_id_missing) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_start_date_not_unique as (\nselect\n '06 claim_start_date_not_unique' as field,\n sum(claim_start_date_not_unique) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_start_date_missing as (\nselect\n '07 claim_start_date_missing' as field,\n sum(claim_start_date_missing) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_end_date_not_unique as (\nselect\n '08 claim_end_date_not_unique' as field,\n sum(claim_end_date_not_unique) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_end_date_missing as (\nselect\n '09 claim_end_date_missing' as field,\n sum(claim_end_date_missing) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_start_date_after_claim_end_date as (\nselect\n '10 claim_start_date_after_claim_end_date' as field,\n sum(claim_start_date_after_claim_end_date) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmission_date_not_unique as (\nselect\n '11 admission_date_not_unique' as field,\n sum(admission_date_not_unique) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmission_date_missing as (\nselect\n '12 admission_date_missing' as field,\n sum(admission_date_missing) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_date_not_unique as (\nselect\n '13 discharge_date_not_unique' as field,\n sum(discharge_date_not_unique) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_date_missing as (\nselect\n '14 discharge_date_missing' as field,\n sum(discharge_date_missing) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmission_date_after_discharge_date as (\nselect\n '15 admission_date_after_discharge_date' as field,\n sum(admission_date_after_discharge_date) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_type_code_not_unique as (\nselect\n '16 admit_type_code_not_unique' as field,\n sum(admit_type_code_not_unique) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_type_code_missing as (\nselect\n '17 admit_type_code_missing' as field,\n sum(admit_type_code_missing) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_source_code_not_unique as (\nselect\n '18 admit_source_code_not_unique' as field,\n sum(admit_source_code_not_unique) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_source_code_missing as (\nselect\n '19 admit_source_code_missing' as field,\n sum(admit_source_code_missing) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_disposition_code_not_unique as (\nselect\n '20 discharge_disposition_code_not_unique' as field,\n sum(discharge_disposition_code_not_unique) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_disposition_code_missing as (\nselect\n '21 discharge_disposition_code_missing' as field,\n sum(discharge_disposition_code_missing) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nfacility_npi_not_unique as (\nselect\n '22 facility_npi_not_unique' as field,\n sum(facility_npi_not_unique) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nfacility_npi_missing as (\nselect\n '23 facility_npi_missing' as field,\n sum(facility_npi_missing) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_type_not_unique as (\nselect\n '24 claim_type_not_unique' as field,\n sum(claim_type_not_unique) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_type_missing as (\nselect\n '25 claim_type_missing' as field,\n sum(claim_type_missing) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_type_not_institutional as (\nselect\n '26 claim_type_not_institutional' as field,\n sum(claim_type_not_institutional) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nstart_date_not_determined as (\nselect\n '27 start_date_not_determined' as field,\n sum(start_date_not_determined) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nend_date_not_determined as (\nselect\n '28 end_date_not_determined' as field,\n sum(end_date_not_determined) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nstart_date_after_end_date as (\nselect\n '29 start_date_after_end_date' as field,\n sum(start_date_after_end_date) as total_count\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\n\nunion_cte as (\nselect *\nfrom total_acute_inpatient__institutional_claims\n\nunion all\n\nselect *\nfrom total_claims_with_insights\n\nunion all\n\nselect *\nfrom total_claims_with_problems\n\nunion all\n\nselect *\nfrom patient_id_not_unique\n\nunion all\n\nselect *\nfrom patient_id_missing\n\nunion all\n\nselect *\nfrom claim_start_date_not_unique\n\nunion all\n\nselect *\nfrom claim_start_date_missing\n\nunion all\n\nselect *\nfrom claim_end_date_not_unique\n\nunion all\n\nselect *\nfrom claim_end_date_missing\n\nunion all\n\nselect *\nfrom claim_start_date_after_claim_end_date\n\nunion all\n\nselect *\nfrom admission_date_not_unique\n\nunion all\n\nselect *\nfrom admission_date_missing\n\nunion all\n\nselect *\nfrom discharge_date_not_unique\n\nunion all\n\nselect *\nfrom discharge_date_missing\n\nunion all\n\nselect *\nfrom admission_date_after_discharge_date\n\nunion all\n\nselect *\nfrom admit_type_code_not_unique\n\nunion all\n\nselect *\nfrom admit_type_code_missing\n\nunion all\n\nselect *\nfrom admit_source_code_not_unique\n\nunion all\n\nselect *\nfrom admit_source_code_missing\n\nunion all\n\nselect *\nfrom discharge_disposition_code_not_unique\n\nunion all\n\nselect *\nfrom discharge_disposition_code_missing\n\nunion all\n\nselect *\nfrom facility_npi_not_unique\n\nunion all\n\nselect *\nfrom facility_npi_missing\n\nunion all\n\nselect *\nfrom claim_type_not_unique\n\nunion all\n\nselect *\nfrom claim_type_missing\n\nunion all\n\nselect *\nfrom claim_type_not_institutional\n\nunion all\n\nselect *\nfrom start_date_not_determined\n\nunion all\n\nselect *\nfrom end_date_not_determined\n\nunion all\n\nselect *\nfrom start_date_after_end_date\n)\n\n\n\nselect *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.acute_inpatient__institutional_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__institutional_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_encounter_id.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_encounter_id.sql", "unique_id": "model.the_tuva_project.acute_inpatient__institutional_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__institutional_encounter_id"], "alias": "_int_acute_inpatient_institutional_encounter_id", "checksum": {"name": "sha256", "checksum": "9dce5cfe76f8e38b1e46bc352549d797fc727a8edd73f4b9be546a77be5eff3c"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Assigns encounter_id to every acute inpatient institutional claim", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional_encounter_id", "tags": ["acute_inpatient", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.600391, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model groups acute inpatient institutional\n-- claims into encounters. It assigns an encounter_id\n-- to each acute inpatient institutional claim.\n-- This returns a table with 3 fields:\n-- patient_id\n-- claim_id\n-- encounter_id\n-- The number of rows in the table should be equal\n-- to the number of acute inpatient institutional claims.\n-- *************************************************\n\n\nwith add_row_num as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_npi,\n row_number() over (partition by patient_id order by end_date, start_date, claim_id) as row_num\nfrom {{ ref('acute_inpatient__institutional_claims') }}\n),\n\ncheck_for_merges_with_larger_row_num as (\nselect\n aa.patient_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_npi should be merged:\n when (aa.end_date = bb.end_date\n and aa.facility_npi = bb.facility_npi) 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_npi = bb.facility_npi\n\t 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) and \n (aa.end_date >= bb.start_date) and --overlap requirement\n (aa.facility_npi = bb.facility_npi)\n\t )then 1\n else 0\n end as merge_flag\nfrom add_row_num aa\n inner join add_row_num bb\n on aa.patient_id = bb.patient_id\n and aa.row_num < bb.row_num\n),\n\nmerges_with_larger_row_num as (\nselect\n patient_id,\n claim_id_a,\n claim_id_b,\n row_num_a,\n row_num_b,\n merge_flag\nfrom check_for_merges_with_larger_row_num\nwhere merge_flag = 1\n),\n\n\nclaim_ids_that_merge_with_larger_row_num as (\nselect distinct claim_id_a as claim_id\nfrom merges_with_larger_row_num\n),\n\n\nclaim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\nselect distinct aa.claim_id as claim_id\nfrom add_row_num aa\n inner join\n merges_with_larger_row_num bb\n on aa.patient_id = bb.patient_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n),\n\n\nclose_flags as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.discharge_disposition_code,\n aa.facility_npi,\n aa.row_num,\n case when (bb.claim_id is null and cc.claim_id is null) then 1\n else 0\n end as close_flag\n\nfrom add_row_num aa\n\nleft join claim_ids_that_merge_with_larger_row_num bb\non aa.claim_id = bb.claim_id\n\nleft join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num cc\non aa.claim_id = cc.claim_id\n),\n\n\njoin_every_row_to_later_closes as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.row_num as row_num,\n bb.row_num as row_num_b\nfrom close_flags aa inner join close_flags bb\n on aa.patient_id = bb.patient_id\n and aa.row_num <= bb.row_num\nwhere bb.close_flag = 1\n),\n\n\nfind_min_closing_row_num_for_every_claim as (\nselect\n patient_id,\n claim_id,\n min(row_num_b) as min_closing_row\nfrom join_every_row_to_later_closes\ngroup by patient_id, claim_id\n),\n\n\nadd_min_closing_row_to_every_claim as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n bb.min_closing_row as min_closing_row\nfrom close_flags aa\n left join find_min_closing_row_num_for_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.claim_id = bb.claim_id\n),\n\n\nadd_encounter_id as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n aa.min_closing_row as min_closing_row,\n bb.claim_id as encounter_id\nfrom add_min_closing_row_to_every_claim aa\n left join add_min_closing_row_to_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_encounter_id", "language": "sql", "refs": [["acute_inpatient__institutional_claims"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.acute_inpatient__institutional_claims"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_encounter_id.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model groups acute inpatient institutional\n-- claims into encounters. It assigns an encounter_id\n-- to each acute inpatient institutional claim.\n-- This returns a table with 3 fields:\n-- patient_id\n-- claim_id\n-- encounter_id\n-- The number of rows in the table should be equal\n-- to the number of acute inpatient institutional claims.\n-- *************************************************\n\n\nwith add_row_num as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_npi,\n row_number() over (partition by patient_id order by end_date, start_date, claim_id) as row_num\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\ncheck_for_merges_with_larger_row_num as (\nselect\n aa.patient_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_npi should be merged:\n when (aa.end_date = bb.end_date\n and aa.facility_npi = bb.facility_npi) 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_npi = bb.facility_npi\n\t 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) and \n (aa.end_date >= bb.start_date) and --overlap requirement\n (aa.facility_npi = bb.facility_npi)\n\t )then 1\n else 0\n end as merge_flag\nfrom add_row_num aa\n inner join add_row_num bb\n on aa.patient_id = bb.patient_id\n and aa.row_num < bb.row_num\n),\n\nmerges_with_larger_row_num as (\nselect\n patient_id,\n claim_id_a,\n claim_id_b,\n row_num_a,\n row_num_b,\n merge_flag\nfrom check_for_merges_with_larger_row_num\nwhere merge_flag = 1\n),\n\n\nclaim_ids_that_merge_with_larger_row_num as (\nselect distinct claim_id_a as claim_id\nfrom merges_with_larger_row_num\n),\n\n\nclaim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\nselect distinct aa.claim_id as claim_id\nfrom add_row_num aa\n inner join\n merges_with_larger_row_num bb\n on aa.patient_id = bb.patient_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n),\n\n\nclose_flags as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.discharge_disposition_code,\n aa.facility_npi,\n aa.row_num,\n case when (bb.claim_id is null and cc.claim_id is null) then 1\n else 0\n end as close_flag\n\nfrom add_row_num aa\n\nleft join claim_ids_that_merge_with_larger_row_num bb\non aa.claim_id = bb.claim_id\n\nleft join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num cc\non aa.claim_id = cc.claim_id\n),\n\n\njoin_every_row_to_later_closes as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.row_num as row_num,\n bb.row_num as row_num_b\nfrom close_flags aa inner join close_flags bb\n on aa.patient_id = bb.patient_id\n and aa.row_num <= bb.row_num\nwhere bb.close_flag = 1\n),\n\n\nfind_min_closing_row_num_for_every_claim as (\nselect\n patient_id,\n claim_id,\n min(row_num_b) as min_closing_row\nfrom join_every_row_to_later_closes\ngroup by patient_id, claim_id\n),\n\n\nadd_min_closing_row_to_every_claim as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n bb.min_closing_row as min_closing_row\nfrom close_flags aa\n left join find_min_closing_row_num_for_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.claim_id = bb.claim_id\n),\n\n\nadd_encounter_id as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n aa.min_closing_row as min_closing_row,\n bb.claim_id as encounter_id\nfrom add_min_closing_row_to_every_claim aa\n left join add_min_closing_row_to_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__encounter_start_and_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_start_and_end_dates.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_start_and_end_dates.sql", "unique_id": "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__encounter_start_and_end_dates"], "alias": "_int_acute_inpatient_encounter_start_and_end_dates", "checksum": {"name": "sha256", "checksum": "00d8b121239396bf248e423eebd1778333289ae41b58ec73887aae231e6473a3"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_encounter_start_and_end_dates", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Defines encounter start and end dates for acute inpatient encounters", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_encounter_start_and_end_dates", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.602779, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model assigns an encounter_start_date and\n-- an encounter_end_date to each acute inpatient\n-- encounter_id.\n-- This returns a table with 4 fields:\n-- patient_id\n-- encounter_id\n-- encounter_start_date\n-- encounter_end_date\n-- The number of rows in the table should be equal\n-- to the number of acute inpatient encounters.\n-- *************************************************\n\n\nwith add_encounter_id_to_acute_inpatient_encounters as (\nselect\n aip.claim_id as claim_id,\n aip.patient_id as patient_id,\n aip.start_date as start_date,\n aip.end_date as end_date,\n eid.encounter_id as encounter_id\nfrom {{ ref('acute_inpatient__institutional_claims') }} aip\nleft join {{ ref('acute_inpatient__institutional_encounter_id') }} eid\n on aip.patient_id = eid.patient_id\n and aip.claim_id = eid.claim_id\n),\n\nencounter_start_and_end_dates as (\nselect\n patient_id,\n encounter_id,\n min(start_date) as encounter_start_date,\n max(end_date) as encounter_end_date\nfrom add_encounter_id_to_acute_inpatient_encounters\ngroup by patient_id, encounter_id\n)\n\nselect\n patient_id\n , encounter_id\n , encounter_start_date\n , encounter_end_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom encounter_start_and_end_dates", "language": "sql", "refs": [["acute_inpatient__institutional_claims"], ["acute_inpatient__institutional_encounter_id"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_start_and_end_dates.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model assigns an encounter_start_date and\n-- an encounter_end_date to each acute inpatient\n-- encounter_id.\n-- This returns a table with 4 fields:\n-- patient_id\n-- encounter_id\n-- encounter_start_date\n-- encounter_end_date\n-- The number of rows in the table should be equal\n-- to the number of acute inpatient encounters.\n-- *************************************************\n\n\nwith add_encounter_id_to_acute_inpatient_encounters as (\nselect\n aip.claim_id as claim_id,\n aip.patient_id as patient_id,\n aip.start_date as start_date,\n aip.end_date as end_date,\n eid.encounter_id as encounter_id\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims aip\nleft join dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_encounter_id eid\n on aip.patient_id = eid.patient_id\n and aip.claim_id = eid.claim_id\n),\n\nencounter_start_and_end_dates as (\nselect\n patient_id,\n encounter_id,\n min(start_date) as encounter_start_date,\n max(end_date) as encounter_end_date\nfrom add_encounter_id_to_acute_inpatient_encounters\ngroup by patient_id, encounter_id\n)\n\nselect\n patient_id\n , encounter_id\n , encounter_start_date\n , encounter_end_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom encounter_start_and_end_dates", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.acute_inpatient__claims_with_encounter_data": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__claims_with_encounter_data", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__claims_with_encounter_data.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__claims_with_encounter_data.sql", "unique_id": "model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__claims_with_encounter_data"], "alias": "_int_acute_inpatient_claims_with_encounter_data", "checksum": {"name": "sha256", "checksum": "bc581de736de2e2ea6f4613588447286e9ddfa13f1527337c725918ede422636"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_claims_with_encounter_data", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Add all relevant encounter data to each acute inpatient claim_id", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_claims_with_encounter_data", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.610092, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_claims_with_encounter_data", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model returns relevant encounter-level\n-- data for every professional or institutional\n-- acute inpatient claim that is part of an encounter\n-- (note that all institutional acute inpatienet claims\n-- are part of an acute inpatient encounter, but only\n-- professional acute inpatient claims that are not\n-- orphan claims and that belong to one and only\n-- one encounter, i.e. have encounter_count = 1,\n-- are part of an acute inpatient encounter).\n-- It returns a table with these columns:\n-- patient_id\n-- claim_id\n-- start_date (date used for merging claims into encounters)\n-- end_date (date used for merging claims into encounters)\n-- encounter_id\n-- encounter_start_date,\n-- encounter_end_date,\n-- encounter_admit_source_code,\n-- encounter_admit_type_code,\n-- encounter_discharge_disposition_code\n-- *************************************************\n\n\n\n\nwith useful_fields_at_claim_id_level as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.admit_type_code,\n aa.admit_source_code,\n aa.discharge_disposition_code,\n aa.start_date,\n aa.end_date,\n\n bb.encounter_id,\n\n cc.encounter_start_date,\n cc.encounter_end_date\n\nfrom {{ ref('acute_inpatient__institutional_claims') }} aa\n\nleft join\n{{ ref('acute_inpatient__encounter_id') }} bb\non aa.claim_id = bb.claim_id\nand aa.patient_id = bb.patient_id\n\nleft join\n{{ ref('acute_inpatient__encounter_start_and_end_dates') }} cc\non bb.encounter_id = cc.encounter_id\nand bb.patient_id = cc.patient_id\n),\n\n\n\nadmit_codes as (\nselect\n encounter_id,\n max(admit_source_code) as encounter_admit_source_code,\n max(admit_type_code) as encounter_admit_type_code\nfrom useful_fields_at_claim_id_level\nwhere start_date = encounter_start_date\ngroup by encounter_id\n),\n\n\ndischarge_code as (\nselect\n encounter_id,\n max(discharge_disposition_code) as encounter_discharge_disposition_code\nfrom useful_fields_at_claim_id_level\nwhere end_date = encounter_end_date\ngroup by encounter_id\n),\n\n\nall_useful_fields_at_claim_id_level as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.encounter_start_date,\n aa.encounter_end_date,\n\n bb.encounter_admit_source_code,\n bb.encounter_admit_type_code,\n \n cc.encounter_discharge_disposition_code\n\nfrom useful_fields_at_claim_id_level aa \n left join admit_codes bb on aa.encounter_id = bb.encounter_id\n left join discharge_code cc on aa.encounter_id = cc.encounter_id\n)\n\n\n\nselect \n *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom all_useful_fields_at_claim_id_level", "language": "sql", "refs": [["acute_inpatient__institutional_claims"], ["acute_inpatient__encounter_id"], ["acute_inpatient__encounter_start_and_end_dates"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__claims_with_encounter_data.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model returns relevant encounter-level\n-- data for every professional or institutional\n-- acute inpatient claim that is part of an encounter\n-- (note that all institutional acute inpatienet claims\n-- are part of an acute inpatient encounter, but only\n-- professional acute inpatient claims that are not\n-- orphan claims and that belong to one and only\n-- one encounter, i.e. have encounter_count = 1,\n-- are part of an acute inpatient encounter).\n-- It returns a table with these columns:\n-- patient_id\n-- claim_id\n-- start_date (date used for merging claims into encounters)\n-- end_date (date used for merging claims into encounters)\n-- encounter_id\n-- encounter_start_date,\n-- encounter_end_date,\n-- encounter_admit_source_code,\n-- encounter_admit_type_code,\n-- encounter_discharge_disposition_code\n-- *************************************************\n\n\n\n\nwith useful_fields_at_claim_id_level as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.admit_type_code,\n aa.admit_source_code,\n aa.discharge_disposition_code,\n aa.start_date,\n aa.end_date,\n\n bb.encounter_id,\n\n cc.encounter_start_date,\n cc.encounter_end_date\n\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims aa\n\nleft join\ndev_sarah.claims_preprocessing._int_acute_inpatient_encounter_id bb\non aa.claim_id = bb.claim_id\nand aa.patient_id = bb.patient_id\n\nleft join\ndev_sarah.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates cc\non bb.encounter_id = cc.encounter_id\nand bb.patient_id = cc.patient_id\n),\n\n\n\nadmit_codes as (\nselect\n encounter_id,\n max(admit_source_code) as encounter_admit_source_code,\n max(admit_type_code) as encounter_admit_type_code\nfrom useful_fields_at_claim_id_level\nwhere start_date = encounter_start_date\ngroup by encounter_id\n),\n\n\ndischarge_code as (\nselect\n encounter_id,\n max(discharge_disposition_code) as encounter_discharge_disposition_code\nfrom useful_fields_at_claim_id_level\nwhere end_date = encounter_end_date\ngroup by encounter_id\n),\n\n\nall_useful_fields_at_claim_id_level as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.encounter_start_date,\n aa.encounter_end_date,\n\n bb.encounter_admit_source_code,\n bb.encounter_admit_type_code,\n \n cc.encounter_discharge_disposition_code\n\nfrom useful_fields_at_claim_id_level aa \n left join admit_codes bb on aa.encounter_id = bb.encounter_id\n left join discharge_code cc on aa.encounter_id = cc.encounter_id\n)\n\n\n\nselect \n *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom all_useful_fields_at_claim_id_level", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.acute_inpatient__first_claim_values": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__first_claim_values", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__first_claim_values.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__first_claim_values.sql", "unique_id": "model.the_tuva_project.acute_inpatient__first_claim_values", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__first_claim_values"], "alias": "_int_acute_inpatient_first_claim_values", "checksum": {"name": "sha256", "checksum": "a10a00e30b3a5b7daa01e231453b22bcc53d408a016c59f2986a9adc7677c32b"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_first_claim_values", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Orders claims to pull out encounter details (admit type, drg, etc)", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_first_claim_values", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.615287, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_first_claim_values", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n )\r\n}}\r\n\r\nwith first_claim_values as(\r\n select distinct\r\n e.encounter_id\r\n , coalesce(claim_start_date, admission_date) as claim_start\r\n , diagnosis_code_1\r\n , diagnosis_code_type\r\n , admit_source_code\r\n , admit_type_code\r\n , facility_npi\r\n , ms_drg_code\r\n , apr_drg_code\r\n from {{ ref('acute_inpatient__encounter_id')}} e\r\n inner join {{ ref('acute_inpatient__stg_medical_claim') }} m\r\n on e.claim_id = m.claim_id\r\n where claim_type = 'institutional'\r\n)\r\n\r\nselect\r\n encounter_id\r\n , claim_start\r\n , diagnosis_code_1\r\n , diagnosis_code_type\r\n , admit_source_code\r\n , admit_type_code\r\n , facility_npi\r\n , ms_drg_code\r\n , apr_drg_code\r\n , row_number() over (partition by encounter_id order by claim_start) as claim_row\r\nfrom first_claim_values", "language": "sql", "refs": [["acute_inpatient__encounter_id"], ["acute_inpatient__stg_medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__first_claim_values.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n),first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n from dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_id e\n inner join __dbt__cte__acute_inpatient__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , row_number() over (partition by encounter_id order by claim_start) as claim_row\nfrom first_claim_values", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.acute_inpatient__encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_id.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_id.sql", "unique_id": "model.the_tuva_project.acute_inpatient__encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__encounter_id"], "alias": "_int_acute_inpatient_encounter_id", "checksum": {"name": "sha256", "checksum": "00ff719ddd8e88ccbebcc3d5c68aee3e0915d657d67d1d322afca1ecd90a1eb0"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_encounter_id", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "Fix encounter_id so each professional claim can only belong to one encounter", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_encounter_id", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.607595, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model assigns an encounter_id to each\n-- institutional or professional acute inpatient claim\n-- that is eligible to be part of an encounter.\n-- Professional acute inpatient claims that are\n-- orphan claims (don't overlap with an institutional\n-- acute inpatient claim) or that have\n-- encounter_count > 1 (overlap with more than one different\n-- acute inpatient encounter) are not included here.\n-- It returns a table with these 3 columns:\n-- patient_id\n-- claim_id\n-- encounter_id\n-- *************************************************\n\n\n\n\nselect\n inst.patient_id,\n inst.claim_id,\n med.claim_line_number,\n inst.encounter_id,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('acute_inpatient__institutional_encounter_id') }} inst\nleft join {{ ref('acute_inpatient__stg_medical_claim') }} med\n on inst.claim_id = med.claim_id\n\nunion distinct\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n encounter_id,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('acute_inpatient__professional_encounter_id') }}\nwhere (orphan_claim_flag = 0) and (encounter_count = 1)", "language": "sql", "refs": [["acute_inpatient__institutional_encounter_id"], ["acute_inpatient__stg_medical_claim"], ["acute_inpatient__professional_encounter_id"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__institutional_encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__professional_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)-- *************************************************\n-- This dbt model assigns an encounter_id to each\n-- institutional or professional acute inpatient claim\n-- that is eligible to be part of an encounter.\n-- Professional acute inpatient claims that are\n-- orphan claims (don't overlap with an institutional\n-- acute inpatient claim) or that have\n-- encounter_count > 1 (overlap with more than one different\n-- acute inpatient encounter) are not included here.\n-- It returns a table with these 3 columns:\n-- patient_id\n-- claim_id\n-- encounter_id\n-- *************************************************\n\n\n\n\nselect\n inst.patient_id,\n inst.claim_id,\n med.claim_line_number,\n inst.encounter_id,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_encounter_id inst\nleft join __dbt__cte__acute_inpatient__stg_medical_claim med\n on inst.claim_id = med.claim_id\n\nunion distinct\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n encounter_id,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_acute_inpatient_professional_encounter_id\nwhere (orphan_claim_flag = 0) and (encounter_count = 1)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}]}, "model.the_tuva_project.acute_inpatient__institutional_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__institutional_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_claims.sql", "original_file_path": "models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_claims.sql", "unique_id": "model.the_tuva_project.acute_inpatient__institutional_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "acute_inpatient", "intermediate", "acute_inpatient__institutional_claims"], "alias": "_int_acute_inpatient_institutional_claims", "checksum": {"name": "sha256", "checksum": "7b8e75f9fad7f381b211d8d4378681e187564775bc783bada56831600ee68a25"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional_claims", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#0f3d0b"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["acute_inpatient", "claims_preprocessing"], "description": "All acute inpatient institutional claim_ids with header values and data quality flags", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#0f3d0b"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional_claims", "tags": ["acute_inpatient", "claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#0f3d0b"}}, "created_at": 1708545506.595139, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n-- *************************************************\n-- This dbt model gives us all acute inpatient institutional claims.\n-- We have one row per claim_id (for all claim_ids belonging to\n-- acute inpatient institutinal claims).\n-- The number of rows in the table is equal to the number of unique\n-- claim_ids (i.e. claim_id is a primary key).\n-- Note that we are assuming that a claim_id is unique across\n-- all people in the datset, i.e.\n-- that no two people can have the same claim_id.\n-- *************************************************\n\nwith acute_inpatient_claim_lines as (\nselect\n mc.patient_id,\n mc.claim_id,\n mc.claim_line_number,\n mc.claim_start_date,\n mc.claim_end_date,\n mc.admission_date,\n mc.discharge_date,\n mc.admit_source_code,\n mc.admit_type_code,\n mc.discharge_disposition_code,\n mc.facility_npi,\n mc.claim_type,\n mc.data_source\nfrom {{ ref('acute_inpatient__stg_medical_claim') }} mc\ninner join {{ ref('acute_inpatient__stg_service_category')}} sc\n on mc.claim_id = sc.claim_id\nwhere mc.claim_type = 'institutional'\n and sc.service_category_2 = 'Acute Inpatient'\n),\n\ndata_quality_flags as (\nselect\n claim_id,\n-- patient_id_not_unique:\n case\n when count(distinct patient_id) > 1 then 1\n else 0\n end as patient_id_not_unique,\n-- patient_id_missing: \n case\n when max(patient_id) is null then 1\n else 0\n end as patient_id_missing, \n-- claim_start_date_not_unique:\n case\n when count(distinct claim_start_date) > 1 then 1\n else 0\n end as claim_start_date_not_unique,\n-- claim_start_date_missing: \n case\n when max(claim_start_date) is null then 1\n else 0\n end as claim_start_date_missing,\n-- claim_end_date_not_unique:\n case\n when count(distinct claim_end_date) > 1 then 1\n else 0\n end as claim_end_date_not_unique,\n-- claim_end_date_missing: \n case\n when max(claim_end_date) is null then 1\n else 0\n end as claim_end_date_missing,\n-- claim_start_date_after_claim_end_date:\n case\n when min(claim_start_date) > max(claim_end_date) then 1\n else 0\n end as claim_start_date_after_claim_end_date,\n-- admission_date_not_unique:\n case\n when count(distinct admission_date) > 1 then 1\n else 0\n end as admission_date_not_unique,\n-- admission_date_missing: \n case\n when max(admission_date) is null then 1\n else 0\n end as admission_date_missing,\n-- discharge_date_not_unique:\n case\n when count(distinct discharge_date) > 1 then 1\n else 0\n end as discharge_date_not_unique,\n-- discharge_date_missing: \n case\n when max(discharge_date) is null then 1\n else 0\n end as discharge_date_missing,\n-- admission_date_after_discharge_date:\n case\n when min(admission_date) > max(discharge_date) then 1\n else 0\n end as admission_date_after_discharge_date,\n-- admit_type_code_not_unique:\n case\n when count(distinct admit_type_code) > 1 then 1\n else 0\n end as admit_type_code_not_unique,\n-- admit_type_code_missing: \n case\n when max(admit_type_code) is null then 1\n else 0\n end as admit_type_code_missing, \n-- admit_source_code_not_unique:\n case\n when count(distinct admit_source_code) > 1 then 1\n else 0\n end as admit_source_code_not_unique,\n-- admit_source_code_missing: \n case\n when max(admit_source_code) is null then 1\n else 0\n end as admit_source_code_missing, \n-- discharge_disposition_code_not_unique:\n case\n when count(distinct discharge_disposition_code) > 1 then 1\n else 0\n end as discharge_disposition_code_not_unique,\n-- discharge_disposition_code_missing: \n case\n when max(discharge_disposition_code) is null then 1\n else 0\n end as discharge_disposition_code_missing,\n-- facility_npi_not_unique:\n case\n when count(distinct facility_npi) > 1 then 1\n else 0\n end as facility_npi_not_unique,\n-- facility_npi_missing: \n case\n when max(facility_npi) is null then 1\n else 0\n end as facility_npi_missing,\n-- claim_type_not_unique:\n case\n when count(distinct claim_type) > 1 then 1\n else 0\n end as claim_type_not_unique,\n-- claim_type_missing: \n case\n when max(claim_type) is null then 1\n else 0\n end as claim_type_missing,\n-- claim_type_not_institutional:\n case\n when max(claim_type) <> 'institutional'\n and min(claim_type) <> 'institutional' then 1\n else 0\n end as claim_type_not_institutional\nfrom acute_inpatient_claim_lines\ngroup by claim_id\n),\n\n\nheader_level_values as (\nselect\n claim_id,\n max(patient_id) as patient_id,\n min(claim_start_date) as claim_start_date,\n max(claim_end_date) as claim_end_date,\n min(admission_date) as admission_date,\n max(discharge_date) as discharge_date,\n max(admit_source_code) as admit_source_code,\n max(admit_type_code) as admit_type_code,\n max(discharge_disposition_code) as discharge_disposition_code,\n max(facility_npi) as facility_npi,\n max(claim_type) as claim_type,\n coalesce(min(admission_date),\n min(claim_start_date)) as start_date,\n coalesce(max(discharge_date),\n max(claim_end_date)) as end_date,\n case\n when min(admission_date) is not null then 'admission_date'\n when min(claim_start_date) is not null then 'claim_start_date'\n else null\n end as date_used_as_start_date,\n case\n when max(discharge_date) is not null then 'discharge_date'\n when max(claim_end_date) is not null then 'claim_end_date'\n else null\n end as date_used_as_end_date,\n data_source\nfrom acute_inpatient_claim_lines\ngroup by claim_id, data_source\n)\n\nselect\n h.patient_id as patient_id,\n h.claim_id as claim_id, \n h.claim_start_date as claim_start_date,\n h.claim_end_date as claim_end_date,\n h.admission_date as admission_date,\n h.discharge_date as discharge_date,\n h.admit_source_code as admit_source_code,\n h.admit_type_code as admit_type_code,\n h.discharge_disposition_code as discharge_disposition_code,\n h.facility_npi as facility_npi,\n h.claim_type as claim_type,\n h.start_date as start_date,\n h.end_date as end_date,\n h.date_used_as_start_date,\n h.date_used_as_end_date, \n\n case\n when\n ( (dq.patient_id_not_unique = 1) or\n (dq.patient_id_missing = 1) or\n (dq.discharge_disposition_code_not_unique = 1) or\n (dq.discharge_disposition_code_missing = 1) or\n (dq.facility_npi_not_unique = 1) or\n (dq.facility_npi_missing = 1) or\n (h.date_used_as_start_date is null) or\n\t(h.date_used_as_end_date is null) or\n\t(h.start_date > h.end_date) ) then 1\n else 0\n end as dq_problem,\n\n case\n when\n ( (dq.claim_start_date_not_unique = 1) or\n\t(dq.claim_start_date_missing = 1) or\n (dq.claim_end_date_not_unique = 1) or\n (dq.claim_end_date_missing = 1) or\n (dq.claim_start_date_after_claim_end_date = 1) or\n (dq.admission_date_not_unique = 1) or\n (dq.admission_date_missing = 1) or\n (dq.discharge_date_not_unique = 1) or\n (dq.discharge_date_missing = 1) or\n (dq.admission_date_after_discharge_date = 1) or\n (dq.admit_type_code_not_unique = 1) or\n (dq.admit_type_code_missing = 1) or\n (dq.admit_source_code_not_unique = 1) or\n (dq.admit_source_code_missing = 1) or\t\n (dq.claim_type_not_unique = 1) or\n (dq.claim_type_missing = 1) or\n (dq.claim_type_not_institutional = 1) ) then 1\n else 0\n end as dq_insight,\n\n case\n when (h.date_used_as_start_date is null) then 1\n else 0\n end as start_date_not_determined,\n \n case\n when (h.date_used_as_end_date is null) then 1\n else 0\n end as end_date_not_determined,\n\n case\n when (h.start_date > h.end_date) then 1\n else 0\n end as start_date_after_end_date,\n \n dq.patient_id_not_unique as patient_id_not_unique,\n dq.patient_id_missing as patient_id_missing,\n dq.claim_start_date_not_unique as claim_start_date_not_unique,\n dq.claim_start_date_missing as claim_start_date_missing,\n dq.claim_end_date_not_unique as claim_end_date_not_unique,\n dq.claim_end_date_missing as claim_end_date_missing,\n dq.claim_start_date_after_claim_end_date\n as claim_start_date_after_claim_end_date,\n dq.admission_date_not_unique as admission_date_not_unique,\n dq.admission_date_missing as admission_date_missing,\n dq.discharge_date_not_unique as discharge_date_not_unique,\n dq.discharge_date_missing as discharge_date_missing,\n dq.admission_date_after_discharge_date\n as admission_date_after_discharge_date,\n dq.admit_type_code_not_unique\n as admit_type_code_not_unique,\n dq.admit_type_code_missing\n as admit_type_code_missing,\n dq.admit_source_code_not_unique\n as admit_source_code_not_unique,\n dq.admit_source_code_missing\n as admit_source_code_missing,\n dq.discharge_disposition_code_not_unique\n as discharge_disposition_code_not_unique,\n dq.discharge_disposition_code_missing\n as discharge_disposition_code_missing,\n dq.facility_npi_not_unique as facility_npi_not_unique,\n dq.facility_npi_missing as facility_npi_missing,\n dq.claim_type_not_unique as claim_type_not_unique,\n dq.claim_type_missing as claim_type_missing,\n dq.claim_type_not_institutional as claim_type_not_institutional,\n h.data_source,\n '{{ var('tuva_last_run')}}' as tuva_last_run\n\nfrom header_level_values h\nleft join data_quality_flags dq\n on h.claim_id = dq.claim_id", "language": "sql", "refs": [["acute_inpatient__stg_medical_claim"], ["acute_inpatient__stg_service_category"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__stg_service_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/acute_inpatient/intermediate/acute_inpatient__institutional_claims.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model gives us all acute inpatient institutional claims.\n-- We have one row per claim_id (for all claim_ids belonging to\n-- acute inpatient institutinal claims).\n-- The number of rows in the table is equal to the number of unique\n-- claim_ids (i.e. claim_id is a primary key).\n-- Note that we are assuming that a claim_id is unique across\n-- all people in the datset, i.e.\n-- that no two people can have the same claim_id.\n-- *************************************************\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n), __dbt__cte__acute_inpatient__stg_service_category as (\n\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.service_category_grouper\n),acute_inpatient_claim_lines as (\nselect\n mc.patient_id,\n mc.claim_id,\n mc.claim_line_number,\n mc.claim_start_date,\n mc.claim_end_date,\n mc.admission_date,\n mc.discharge_date,\n mc.admit_source_code,\n mc.admit_type_code,\n mc.discharge_disposition_code,\n mc.facility_npi,\n mc.claim_type,\n mc.data_source\nfrom __dbt__cte__acute_inpatient__stg_medical_claim mc\ninner join __dbt__cte__acute_inpatient__stg_service_category sc\n on mc.claim_id = sc.claim_id\nwhere mc.claim_type = 'institutional'\n and sc.service_category_2 = 'Acute Inpatient'\n),\n\ndata_quality_flags as (\nselect\n claim_id,\n-- patient_id_not_unique:\n case\n when count(distinct patient_id) > 1 then 1\n else 0\n end as patient_id_not_unique,\n-- patient_id_missing: \n case\n when max(patient_id) is null then 1\n else 0\n end as patient_id_missing, \n-- claim_start_date_not_unique:\n case\n when count(distinct claim_start_date) > 1 then 1\n else 0\n end as claim_start_date_not_unique,\n-- claim_start_date_missing: \n case\n when max(claim_start_date) is null then 1\n else 0\n end as claim_start_date_missing,\n-- claim_end_date_not_unique:\n case\n when count(distinct claim_end_date) > 1 then 1\n else 0\n end as claim_end_date_not_unique,\n-- claim_end_date_missing: \n case\n when max(claim_end_date) is null then 1\n else 0\n end as claim_end_date_missing,\n-- claim_start_date_after_claim_end_date:\n case\n when min(claim_start_date) > max(claim_end_date) then 1\n else 0\n end as claim_start_date_after_claim_end_date,\n-- admission_date_not_unique:\n case\n when count(distinct admission_date) > 1 then 1\n else 0\n end as admission_date_not_unique,\n-- admission_date_missing: \n case\n when max(admission_date) is null then 1\n else 0\n end as admission_date_missing,\n-- discharge_date_not_unique:\n case\n when count(distinct discharge_date) > 1 then 1\n else 0\n end as discharge_date_not_unique,\n-- discharge_date_missing: \n case\n when max(discharge_date) is null then 1\n else 0\n end as discharge_date_missing,\n-- admission_date_after_discharge_date:\n case\n when min(admission_date) > max(discharge_date) then 1\n else 0\n end as admission_date_after_discharge_date,\n-- admit_type_code_not_unique:\n case\n when count(distinct admit_type_code) > 1 then 1\n else 0\n end as admit_type_code_not_unique,\n-- admit_type_code_missing: \n case\n when max(admit_type_code) is null then 1\n else 0\n end as admit_type_code_missing, \n-- admit_source_code_not_unique:\n case\n when count(distinct admit_source_code) > 1 then 1\n else 0\n end as admit_source_code_not_unique,\n-- admit_source_code_missing: \n case\n when max(admit_source_code) is null then 1\n else 0\n end as admit_source_code_missing, \n-- discharge_disposition_code_not_unique:\n case\n when count(distinct discharge_disposition_code) > 1 then 1\n else 0\n end as discharge_disposition_code_not_unique,\n-- discharge_disposition_code_missing: \n case\n when max(discharge_disposition_code) is null then 1\n else 0\n end as discharge_disposition_code_missing,\n-- facility_npi_not_unique:\n case\n when count(distinct facility_npi) > 1 then 1\n else 0\n end as facility_npi_not_unique,\n-- facility_npi_missing: \n case\n when max(facility_npi) is null then 1\n else 0\n end as facility_npi_missing,\n-- claim_type_not_unique:\n case\n when count(distinct claim_type) > 1 then 1\n else 0\n end as claim_type_not_unique,\n-- claim_type_missing: \n case\n when max(claim_type) is null then 1\n else 0\n end as claim_type_missing,\n-- claim_type_not_institutional:\n case\n when max(claim_type) <> 'institutional'\n and min(claim_type) <> 'institutional' then 1\n else 0\n end as claim_type_not_institutional\nfrom acute_inpatient_claim_lines\ngroup by claim_id\n),\n\n\nheader_level_values as (\nselect\n claim_id,\n max(patient_id) as patient_id,\n min(claim_start_date) as claim_start_date,\n max(claim_end_date) as claim_end_date,\n min(admission_date) as admission_date,\n max(discharge_date) as discharge_date,\n max(admit_source_code) as admit_source_code,\n max(admit_type_code) as admit_type_code,\n max(discharge_disposition_code) as discharge_disposition_code,\n max(facility_npi) as facility_npi,\n max(claim_type) as claim_type,\n coalesce(min(admission_date),\n min(claim_start_date)) as start_date,\n coalesce(max(discharge_date),\n max(claim_end_date)) as end_date,\n case\n when min(admission_date) is not null then 'admission_date'\n when min(claim_start_date) is not null then 'claim_start_date'\n else null\n end as date_used_as_start_date,\n case\n when max(discharge_date) is not null then 'discharge_date'\n when max(claim_end_date) is not null then 'claim_end_date'\n else null\n end as date_used_as_end_date,\n data_source\nfrom acute_inpatient_claim_lines\ngroup by claim_id, data_source\n)\n\nselect\n h.patient_id as patient_id,\n h.claim_id as claim_id, \n h.claim_start_date as claim_start_date,\n h.claim_end_date as claim_end_date,\n h.admission_date as admission_date,\n h.discharge_date as discharge_date,\n h.admit_source_code as admit_source_code,\n h.admit_type_code as admit_type_code,\n h.discharge_disposition_code as discharge_disposition_code,\n h.facility_npi as facility_npi,\n h.claim_type as claim_type,\n h.start_date as start_date,\n h.end_date as end_date,\n h.date_used_as_start_date,\n h.date_used_as_end_date, \n\n case\n when\n ( (dq.patient_id_not_unique = 1) or\n (dq.patient_id_missing = 1) or\n (dq.discharge_disposition_code_not_unique = 1) or\n (dq.discharge_disposition_code_missing = 1) or\n (dq.facility_npi_not_unique = 1) or\n (dq.facility_npi_missing = 1) or\n (h.date_used_as_start_date is null) or\n\t(h.date_used_as_end_date is null) or\n\t(h.start_date > h.end_date) ) then 1\n else 0\n end as dq_problem,\n\n case\n when\n ( (dq.claim_start_date_not_unique = 1) or\n\t(dq.claim_start_date_missing = 1) or\n (dq.claim_end_date_not_unique = 1) or\n (dq.claim_end_date_missing = 1) or\n (dq.claim_start_date_after_claim_end_date = 1) or\n (dq.admission_date_not_unique = 1) or\n (dq.admission_date_missing = 1) or\n (dq.discharge_date_not_unique = 1) or\n (dq.discharge_date_missing = 1) or\n (dq.admission_date_after_discharge_date = 1) or\n (dq.admit_type_code_not_unique = 1) or\n (dq.admit_type_code_missing = 1) or\n (dq.admit_source_code_not_unique = 1) or\n (dq.admit_source_code_missing = 1) or\t\n (dq.claim_type_not_unique = 1) or\n (dq.claim_type_missing = 1) or\n (dq.claim_type_not_institutional = 1) ) then 1\n else 0\n end as dq_insight,\n\n case\n when (h.date_used_as_start_date is null) then 1\n else 0\n end as start_date_not_determined,\n \n case\n when (h.date_used_as_end_date is null) then 1\n else 0\n end as end_date_not_determined,\n\n case\n when (h.start_date > h.end_date) then 1\n else 0\n end as start_date_after_end_date,\n \n dq.patient_id_not_unique as patient_id_not_unique,\n dq.patient_id_missing as patient_id_missing,\n dq.claim_start_date_not_unique as claim_start_date_not_unique,\n dq.claim_start_date_missing as claim_start_date_missing,\n dq.claim_end_date_not_unique as claim_end_date_not_unique,\n dq.claim_end_date_missing as claim_end_date_missing,\n dq.claim_start_date_after_claim_end_date\n as claim_start_date_after_claim_end_date,\n dq.admission_date_not_unique as admission_date_not_unique,\n dq.admission_date_missing as admission_date_missing,\n dq.discharge_date_not_unique as discharge_date_not_unique,\n dq.discharge_date_missing as discharge_date_missing,\n dq.admission_date_after_discharge_date\n as admission_date_after_discharge_date,\n dq.admit_type_code_not_unique\n as admit_type_code_not_unique,\n dq.admit_type_code_missing\n as admit_type_code_missing,\n dq.admit_source_code_not_unique\n as admit_source_code_not_unique,\n dq.admit_source_code_missing\n as admit_source_code_missing,\n dq.discharge_disposition_code_not_unique\n as discharge_disposition_code_not_unique,\n dq.discharge_disposition_code_missing\n as discharge_disposition_code_missing,\n dq.facility_npi_not_unique as facility_npi_not_unique,\n dq.facility_npi_missing as facility_npi_missing,\n dq.claim_type_not_unique as claim_type_not_unique,\n dq.claim_type_missing as claim_type_missing,\n dq.claim_type_not_institutional as claim_type_not_institutional,\n h.data_source,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\n\nfrom header_level_values h\nleft join data_quality_flags dq\n on h.claim_id = dq.claim_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.acute_inpatient__stg_medical_claim", "sql": " __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)"}, {"id": "model.the_tuva_project.acute_inpatient__stg_service_category", "sql": " __dbt__cte__acute_inpatient__stg_service_category as (\n\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.service_category_grouper\n)"}]}, "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": "2598a77f063c83df17e4263dd10147ee0914b36917186e3e35d51f4dae0a8756"}, "config": {"enabled": true, "alias": "_stg_medical_claim", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "place_of_service": {"name": "place_of_service", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.089209, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , '{{ 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 , '{{ 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\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_timestamp() }} ) as tuva_last_run\nlimit 0\n\n{%- endif %}", "language": "sql", "refs": [["core__medical_claim"]], "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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n", "extra_ctes_injected": true, "extra_ctes": []}, "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": "e450b5ec0c774f3e3624565aee8e99b0fb4638cb3bfa3fad3b1646ea49ad7795"}, "config": {"enabled": true, "alias": "_stg_patient", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Staging eligibility from the input layer.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sex": {"name": "sex", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.072166, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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": [["core__patient"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": []}, "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": "6ac64920ae666a218eb2065d9d319b7ae7f5ec53c8cda0b870b9e8ac45f36505"}, "config": {"enabled": true, "alias": "_stg_observation", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.069004, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , 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__observation') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , observation_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__observation') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\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 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\nlimit 0\n\n{%- endif %}", "language": "sql", "refs": [["core__observation"]], "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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n", "extra_ctes_injected": true, "extra_ctes": []}, "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": "1d1eb6e4f6a76a6c0e528be64d6ffd0491eaeb5937e25f4801bc1a9600281693"}, "config": {"enabled": true, "alias": "_stg_medication", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "rxnorm_code": {"name": "rxnorm_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.065142, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , 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 , 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\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_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\nlimit 0\n\n{%- endif %}", "language": "sql", "refs": [["core__medication"]], "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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n", "extra_ctes_injected": true, "extra_ctes": []}, "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": "b790318c4300a32e582021281be30e5bf483c03ba77c5805ac9bbdc8a9437190"}, "config": {"enabled": true, "alias": "_stg_condition", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Staging conditions from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.057732, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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": [["core__condition"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": []}, "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": "bc3e6c10fe1a85fecc62024f81338b7544fca2aa1188e92b2a6f3c8409ffa3d9"}, "config": {"enabled": true, "alias": "_stg_lab_result", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "collection_date": {"name": "collection_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.096687, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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\nselect\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\nlimit 0\n\n{%- endif %}", "language": "sql", "refs": [["core__lab_result"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n", "extra_ctes_injected": true, "extra_ctes": []}, "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": "d3cc37b103a2cdce19944f7fff56a050f260fa91d716da4ba2be10fe4dddb001"}, "config": {"enabled": true, "alias": "_stg_pharmacy_claim", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.092845, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , 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 , 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\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 ndc_code\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as paid_date\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\nlimit 0\n\n{%- endif %}", "language": "sql", "refs": [["core__pharmacy_claim"]], "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 , paid_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n", "extra_ctes_injected": true, "extra_ctes": []}, "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": "61025c6978615c6c9369fdb019207e0d5154cb47f90e696ba3bc9c2ea5c5db8c"}, "config": {"enabled": true, "alias": "_stg_procedure", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Staging procedures from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "procedure_date": {"name": "procedure_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.079648, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\nselect\n patient_id\n , procedure_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__procedure') }}", "language": "sql", "refs": [["core__procedure"]], "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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure", "extra_ctes_injected": true, "extra_ctes": []}, "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": "abbe08199c70ac49e84a5924353b906b3116e2673beeed612ac0c1d56c9f3a9f"}, "config": {"enabled": true, "alias": "_stg_encounter", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.061294, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , 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 , 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\nselect\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 , {{ 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\nlimit 0\n\n{%- endif %}", "language": "sql", "refs": [["core__encounter"]], "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 , encounter_start_date\n , encounter_end_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n", "extra_ctes_injected": true, "extra_ctes": []}, "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": "2cfbc9c38145242cba524dcaf0cf6efa9d5b67deb1619e8dc8b1047cb8374a83"}, "config": {"enabled": true, "alias": "summary_wide", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "nqf_2372": {"name": "nqf_2372", "description": "Each measure has a boolean flag which is the result of evaluating the denominator, numerator, and exclusion indicators for the patient. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.867742, "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))))\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, 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, joined as (\n\n select\n measures_long.patient_id\n , nqf_2372.performance_flag as nqf_2372\n , nqf_0034.performance_flag as nqf_0034\n , nqf_0059.performance_flag as nqf_0059\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\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 from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\n , nqf_0059\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [["quality_measures__summary_long"]], "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, 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, joined as (\n\n select\n measures_long.patient_id\n , nqf_2372.performance_flag as nqf_2372\n , nqf_0034.performance_flag as nqf_0034\n , nqf_0059.performance_flag as nqf_0059\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\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 from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\n , nqf_0059\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "9ea6415f97f1fbff5cd793f0822094e560602822b97cb3ea32ed265025a43191"}, "config": {"enabled": true, "alias": "summary_counts", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "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, "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "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, "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, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.8595998, "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))))\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": [["quality_measures__summary_long"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "b59e97db3ebb6e8206676b3b566748b383b4cd7e2a7e7a32ba9d9ceff07af859"}, "config": {"enabled": true, "alias": "summary_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.8649962, "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))))\n )\n}}\n\n/* measures should already be at the full eligibility population grain */\nwith measures_unioned as (\n\n select * from {{ ref('quality_measures__int_nqf2372_long') }}\n union all\n select * from {{ ref('quality_measures__int_nqf0034_long') }}\n union all\n select * from {{ ref('quality_measures__int_nqf0059_long') }}\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 measures_unioned\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , case\n when exclusion_flag = 1 then null\n when numerator_flag = 1 then 1\n when denominator_flag = 1 then 0\n else null end as performance_flag\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": [["quality_measures__int_nqf2372_long"], ["quality_measures__int_nqf0034_long"], ["quality_measures__int_nqf0059_long"]], "sources": [], "metrics": [], "depends_on": {"macros": ["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"]}, "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 measures_unioned as (\n\n select * from dev_sarah.quality_measures._int_nqf2372_long\n union all\n select * from dev_sarah.quality_measures._int_nqf0034_long\n union all\n select * from dev_sarah.quality_measures._int_nqf0059_long\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 measures_unioned\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , case\n when exclusion_flag = 1 then null\n when numerator_flag = 1 then 1\n when denominator_flag = 1 then 0\n else null end as performance_flag\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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "1d03b9f7580863adc845af8cd09d5287de5bcb9d1138260fafebf1a3cd035440"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_mastectomy", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.9298692, "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))))\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": [["quality_measures__int_nqf2372_denominator"], ["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"]], "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-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf2372__frailty": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372__frailty", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372__frailty.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372__frailty.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372__frailty"], "alias": "_int_nqf2372__frailty", "checksum": {"name": "sha256", "checksum": "03fec5d7df9045ff25d56ab1d0b5449b04371a917ac4c002ce589f1f69f3dd88"}, "config": {"enabled": true, "alias": "_int_nqf2372__frailty", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty used by other exclusion models.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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__frailty", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false}, "created_at": 1708545506.8717551, "relation_name": "dev_sarah.quality_measures._int_nqf2372__frailty", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n/*\n This concept is used in multiple exclusions. Patients greater than\n or equal to 66 with at least one claim/encounter for frailty during\n the measurement period.\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_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 '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 denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and condition_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and condition_exclusions.recorded_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where denominator.age >= 66\n and med_claim_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and observation_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and procedure_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom patients_with_frailty", "language": "sql", "refs": [["quality_measures__int_nqf2372_denominator"], ["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"]], "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_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__frailty.sql", "compiled": true, "compiled_code": "\n/*\n This concept is used in multiple exclusions. Patients greater than\n or equal to 66 with at least one claim/encounter for frailty during\n the measurement period.\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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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_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 '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 denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and condition_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and condition_exclusions.recorded_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where denominator.age >= 66\n and med_claim_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and observation_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and procedure_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+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__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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_advanced_illness", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_advanced_illness.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_advanced_illness.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_advanced_illness"], "alias": "_int_nqf2372_exclude_advanced_illness", "checksum": {"name": "sha256", "checksum": "89a304c805c5f5840606f26a90b33877c14b89379befcdd9d2821892025fd74b"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_advanced_illness", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and advanced illness 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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_advanced_illness", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.897341, "relation_name": "dev_sarah.quality_measures._int_nqf2372_exclude_advanced_illness", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n OR two outpatient, observation, ED or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\nwith patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372__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 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\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/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name = 'Acute Inpatient'\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n med_claim_exclusions.claim_start_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 procedure_exclusions.concept_name = 'Acute Inpatient'\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n procedure_exclusions.procedure_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND two outpatient, observation, ED or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name in (\n 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n med_claim_exclusions.claim_start_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 procedure_exclusions.concept_name in (\n 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n procedure_exclusions.procedure_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n Filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n, acute_inpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient\n group by patient_id\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient\n group by patient_id\n\n)\n\n, eligible_acute_inpatient as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n from acute_inpatient\n left join acute_inpatient_counts\n on acute_inpatient.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n)\n\n, eligible_nonacute_outpatient as (\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n from nonacute_outpatient\n left join nonacute_outpatient_counts\n on nonacute_outpatient.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n\n, exclusions_unioned as (\n\n select\n eligible_acute_inpatient.patient_id\n , eligible_acute_inpatient.exclusion_date\n , eligible_acute_inpatient.exclusion_reason\n from eligible_acute_inpatient\n\n union all\n\n select\n eligible_nonacute_outpatient.patient_id\n , eligible_nonacute_outpatient.exclusion_date\n , eligible_nonacute_outpatient.exclusion_reason\n from eligible_nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions_unioned", "language": "sql", "refs": [["quality_measures__int_nqf2372__frailty"], ["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__procedure"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372__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/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_advanced_illness.sql", "compiled": true, "compiled_code": "\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n OR two outpatient, observation, ED or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n),patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf2372__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 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\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/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name = 'Acute Inpatient'\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n med_claim_exclusions.claim_start_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 procedure_exclusions.concept_name = 'Acute Inpatient'\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n procedure_exclusions.procedure_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND two outpatient, observation, ED or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name in (\n 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n med_claim_exclusions.claim_start_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 procedure_exclusions.concept_name in (\n 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n procedure_exclusions.procedure_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n Filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n, acute_inpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient\n group by patient_id\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient\n group by patient_id\n\n)\n\n, eligible_acute_inpatient as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n from acute_inpatient\n left join acute_inpatient_counts\n on acute_inpatient.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n)\n\n, eligible_nonacute_outpatient as (\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n from nonacute_outpatient\n left join nonacute_outpatient_counts\n on nonacute_outpatient.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n\n, exclusions_unioned as (\n\n select\n eligible_acute_inpatient.patient_id\n , eligible_acute_inpatient.exclusion_date\n , eligible_acute_inpatient.exclusion_reason\n from eligible_acute_inpatient\n\n union all\n\n select\n eligible_nonacute_outpatient.patient_id\n , eligible_nonacute_outpatient.exclusion_date\n , eligible_nonacute_outpatient.exclusion_reason\n from eligible_nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_institutional.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_institutional.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_institutional"], "alias": "_int_nqf2372_exclude_institutional", "checksum": {"name": "sha256", "checksum": "d24105c7382317fb5122acf989e144582f62e850baa7350016e230782aeae1d6"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_institutional", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients staying in an institution 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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_institutional", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.910115, "relation_name": "dev_sarah.quality_measures._int_nqf2372_exclude_institutional", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Patients greater than or equal to 66 in Institutional Special Needs Plans (SNP)\n or residing in long term care\n\n Future enhancement: group claims into encounters\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_nqf2372_denominator') }}\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 denominator.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 denominator\n inner join medical_claim\n on denominator.patient_id = medical_claim.patient_id\n where denominator.age >= 66\n and (\n medical_claim.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or medical_claim.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n and 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 , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [["quality_measures__int_nqf2372_denominator"], ["quality_measures__stg_medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_institutional.sql", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 in Institutional Special Needs Plans (SNP)\n or residing in long term care\n\n Future enhancement: group claims into encounters\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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\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_nqf2372_denominator\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 denominator.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 denominator\n inner join medical_claim\n on denominator.patient_id = medical_claim.patient_id\n where denominator.age >= 66\n and (\n medical_claim.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or medical_claim.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n and 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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom exclusions", "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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}]}, "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": "325f2b8405e1c308fe0ce98776cdda1da15e499c7ebfc1f7bad6e4731c12671e"}, "config": {"enabled": true, "alias": "_int_nqf2372__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Performance Period definition for Breast Cancer screening.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.869783, "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))))\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": [["quality_measures__measures"], ["quality_measures__measures"], ["quality_measures__measures"]], "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", "seed.the_tuva_project.quality_measures__measures", "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": []}, "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": "0cfdf5a2bf37c8de59fd04d624c654e0f3c50135ade5672540f56e99e316ad28"}, "config": {"enabled": true, "alias": "_int_nqf2372_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.9537978, "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))))\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": [["quality_measures__int_nqf2372_denominator"], ["quality_measures__value_sets"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"]], "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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "5154133f60202353f7f9e3ad89ff63f8a1361d30f21892a764b763b38717ec79"}, "config": {"enabled": true, "alias": "_int_nqf2372_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.948837, "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))))\n )\n}}\n\n/* selecting the full patient population as the grain of this table */\nwith patient as (\n\n select distinct patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\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 , denominator_flag\n from {{ ref('quality_measures__int_nqf2372_denominator') }}\n\n)\n\n, numerator 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 , numerator_flag\n from {{ ref('quality_measures__int_nqf2372_numerator') }}\n\n)\n\n, exclusions 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 , 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 patient.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 patient\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 evidence_date desc nulls last\n , exclusion_date desc nulls last\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 , 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": [["quality_measures__stg_core__patient"], ["quality_measures__int_nqf2372_denominator"], ["quality_measures__int_nqf2372_numerator"], ["quality_measures__int_nqf2372_exclusions"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient", "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\n/* selecting the full patient population as the grain of this table */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n),patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\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 , denominator_flag\n from dev_sarah.quality_measures._int_nqf2372_denominator\n\n)\n\n, numerator 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 , numerator_flag\n from dev_sarah.quality_measures._int_nqf2372_numerator\n\n)\n\n, exclusions 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 , 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 patient.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 patient\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 evidence_date desc nulls last\n , exclusion_date desc nulls last\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 , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_dementia", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_dementia.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_dementia.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_dementia"], "alias": "_int_nqf2372_exclude_dementia", "checksum": {"name": "sha256", "checksum": "2961f61e7f5fd3fd5b44a73646dba576626654750cce2f3bb18c4e477a5c1e14"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_dementia", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and taking dementia medications 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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_dementia", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.902378, "relation_name": "dev_sarah.quality_measures._int_nqf2372_exclude_dementia", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period AND a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372__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 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 , patients_with_frailty.exclusion_reason\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n where (\n pharmacy_claim_exclusions.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n or pharmacy_claim_exclusions.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n )\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\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n where medication_exclusions.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom frailty_with_dementia", "language": "sql", "refs": [["quality_measures__int_nqf2372__frailty"], ["quality_measures__value_sets"], ["quality_measures__stg_core__medication"], ["quality_measures__stg_pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372__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/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_dementia.sql", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period AND a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-21 19:58:21.989699+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 , paid_date\n , '2024-02-21 19:58:21.989699+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 , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf2372__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 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\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n where (\n pharmacy_claim_exclusions.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or pharmacy_claim_exclusions.paid_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\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\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n where medication_exclusions.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-21 19:58:21.989699+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 , paid_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_palliative", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_palliative.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_palliative.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_palliative"], "alias": "_int_nqf2372_exclude_palliative", "checksum": {"name": "sha256", "checksum": "c918c4c5bd88f84a06ba57d6bb47c5aa2ad66a028c856e6a11823c9615bed9f6"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_palliative", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients using palliative services 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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_palliative", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.935793, "relation_name": "dev_sarah.quality_measures._int_nqf2372_exclude_palliative", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Palliative care services used by patient any time during the measurement period\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 'Palliative Care Encounter'\n , 'Palliative Care Intervention'\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 , 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, 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, palliative_care as (\n\n select\n denominator.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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\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 where observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\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 where procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom palliative_care", "language": "sql", "refs": [["quality_measures__int_nqf2372_denominator"], ["quality_measures__value_sets"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"]], "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_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_exclude_palliative.sql", "compiled": true, "compiled_code": "\n\n/*\n Palliative care services used by patient any time during the measurement period\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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 'Palliative Care Encounter'\n , 'Palliative Care Intervention'\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 , 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, 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, palliative_care as (\n\n select\n denominator.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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\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 where observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\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 where procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom palliative_care", "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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "c6a26a6b0fb05ea2806a8181b62d61e27d1ba02c27f21929481c879ebd33b1fb"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.9406998, "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))))\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 , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_nqf2372_denominator') }}\n\n)\n\n, advanced_illness as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_advanced_illness') }}\n\n)\n\n, dementia as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_dementia') }}\n\n)\n\n, hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_hospice') }}\n\n)\n\n, institutional as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_institutional') }}\n\n)\n\n, mastectomy 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\n, palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_palliative') }}\n\n)\n\n, denominator_with_advanced_illness 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 , case\n when advanced_illness.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , advanced_illness.exclusion_date\n , advanced_illness.exclusion_reason\n from denominator\n left join advanced_illness\n on denominator.patient_id = advanced_illness.patient_id\n\n)\n\n, denominator_with_dementia 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 , case\n when dementia.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , dementia.exclusion_date\n , dementia.exclusion_reason\n from denominator\n left join dementia\n on denominator.patient_id = dementia.patient_id\n\n)\n\n, denominator_with_hospice 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 , case\n when hospice.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , hospice.exclusion_date\n , hospice.exclusion_reason\n from denominator\n left join hospice\n on denominator.patient_id = hospice.patient_id\n\n)\n\n, denominator_with_institutional 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 , case\n when institutional.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , institutional.exclusion_date\n , institutional.exclusion_reason\n from denominator\n left join institutional\n on denominator.patient_id = institutional.patient_id\n\n)\n\n, denominator_with_mastectomy 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 , case\n when mastectomy.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , mastectomy.exclusion_date\n , mastectomy.exclusion_reason\n from denominator\n left join mastectomy\n on denominator.patient_id = mastectomy.patient_id\n\n)\n\n, denominator_with_palliative 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 , case\n when palliative.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , palliative.exclusion_date\n , palliative.exclusion_reason\n from denominator\n left join palliative\n on denominator.patient_id = palliative.patient_id\n\n)\n\n, exclusions_unioned as (\n\n select * from denominator_with_advanced_illness\n union all\n select * from denominator_with_dementia\n union all\n select * from denominator_with_hospice\n union all\n select * from denominator_with_institutional\n union all\n select * from denominator_with_mastectomy\n union all\n select * from denominator_with_palliative\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 , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(exclusion_flag as integer) as exclusion_flag\n from exclusions_unioned\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 , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [["quality_measures__int_nqf2372_denominator"], ["quality_measures__int_nqf2372_exclude_advanced_illness"], ["quality_measures__int_nqf2372_exclude_dementia"], ["quality_measures__int_nqf2372_exclude_hospice"], ["quality_measures__int_nqf2372_exclude_institutional"], ["quality_measures__int_nqf2372_exclude_mastectomy"], ["quality_measures__int_nqf2372_exclude_palliative"]], "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_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative"]}, "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": "\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 , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf2372_denominator\n\n)\n\n, advanced_illness as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf2372_exclude_advanced_illness\n\n)\n\n, dementia as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf2372_exclude_dementia\n\n)\n\n, hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf2372_exclude_hospice\n\n)\n\n, institutional as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf2372_exclude_institutional\n\n)\n\n, mastectomy 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\n, palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf2372_exclude_palliative\n\n)\n\n, denominator_with_advanced_illness 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 , case\n when advanced_illness.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , advanced_illness.exclusion_date\n , advanced_illness.exclusion_reason\n from denominator\n left join advanced_illness\n on denominator.patient_id = advanced_illness.patient_id\n\n)\n\n, denominator_with_dementia 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 , case\n when dementia.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , dementia.exclusion_date\n , dementia.exclusion_reason\n from denominator\n left join dementia\n on denominator.patient_id = dementia.patient_id\n\n)\n\n, denominator_with_hospice 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 , case\n when hospice.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , hospice.exclusion_date\n , hospice.exclusion_reason\n from denominator\n left join hospice\n on denominator.patient_id = hospice.patient_id\n\n)\n\n, denominator_with_institutional 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 , case\n when institutional.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , institutional.exclusion_date\n , institutional.exclusion_reason\n from denominator\n left join institutional\n on denominator.patient_id = institutional.patient_id\n\n)\n\n, denominator_with_mastectomy 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 , case\n when mastectomy.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , mastectomy.exclusion_date\n , mastectomy.exclusion_reason\n from denominator\n left join mastectomy\n on denominator.patient_id = mastectomy.patient_id\n\n)\n\n, denominator_with_palliative 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 , case\n when palliative.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , palliative.exclusion_date\n , palliative.exclusion_reason\n from denominator\n left join palliative\n on denominator.patient_id = palliative.patient_id\n\n)\n\n, exclusions_unioned as (\n\n select * from denominator_with_advanced_illness\n union all\n select * from denominator_with_dementia\n union all\n select * from denominator_with_hospice\n union all\n select * from denominator_with_institutional\n union all\n select * from denominator_with_mastectomy\n union all\n select * from denominator_with_palliative\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 , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(exclusion_flag as integer) as exclusion_flag\n from exclusions_unioned\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 , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "20d37b8969ab10d2558aaaacd61b8f468f2be15c0c811928d5392f7b0304e1e0"}, "config": {"enabled": true, "alias": "_int_nqf2372_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age as of the performance_period_begin date.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.885355, "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))))\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_end', 'hour') }} / 8766.0) as age\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": [["quality_measures__int_nqf2372__performance_period"], ["quality_measures__stg_core__patient"], ["quality_measures__stg_core__encounter"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__procedure"], ["quality_measures__value_sets"]], "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-02-21 19:58:21.989699+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 , encounter_start_date\n , encounter_end_date\n , '2024-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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_end\n ) / 8766.0) as age\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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 , encounter_start_date\n , encounter_end_date\n , '2024-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_hospice", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_hospice.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_hospice.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_hospice"], "alias": "_int_nqf2372_exclude_hospice", "checksum": {"name": "sha256", "checksum": "cf39611efb8664f7c8a5873de910d5aa4642e4ab4a5e3774a868d6e40b444e8b"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_hospice", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients using hospice services 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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_hospice", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.9065459, "relation_name": "dev_sarah.quality_measures._int_nqf2372_exclude_hospice", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Hospice services used by patient any time during the measurement period\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 'Hospice Care Ambulatory'\n , 'Hospice Encounter'\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 {{ ref('quality_measures__stg_core__observation') }}\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, procedures as (\n\n select\n patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n from {{ ref('quality_measures__stg_core__procedure') }}\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, 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, 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.normalized_code = exclusion_codes.code\n and procedures.normalized_code_type = exclusion_codes.code_system\n\n)\n\n, hospice as (\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 where observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\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 where procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom hospice", "language": "sql", "refs": [["quality_measures__int_nqf2372_denominator"], ["quality_measures__value_sets"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__procedure"]], "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__observation", "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/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_hospice.sql", "compiled": true, "compiled_code": "\n\n/*\n Hospice services used by patient any time during the measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\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 , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 'Hospice Care Ambulatory'\n , 'Hospice Encounter'\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\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, procedures as (\n\n select\n patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__procedure\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, 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, 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.normalized_code = exclusion_codes.code\n and procedures.normalized_code_type = exclusion_codes.code_system\n\n)\n\n, hospice as (\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 where observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\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 where procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom hospice", "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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\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 , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "b4486f850648c72a9ab815fa10c71b5ecc8df95931bfce77674fcd68af5b7c9c"}, "config": {"enabled": true, "alias": "_int_nqf0034_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 0034, Colorectal Cancer Screening. \n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.957542, "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))))\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 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), visits_encounters as (\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_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\n,procedure_encounters as (\n select patient_id, PROCEDURE_DATE as min_date, PROCEDURE_DATE as max_date\n from {{ref('quality_measures__stg_core__procedure')}} proc\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(proc.normalized_code,proc.source_code) = visit_codes.code\n\n\n)\n,\nclaims_encounters as (\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\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, patients_with_age as (\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.BIRTH_DATE is not null\n\n)\n\nselect 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": [["quality_measures__value_sets"], ["quality_measures__stg_core__encounter"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__stg_core__procedure"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__stg_medical_claim"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__stg_core__patient"]], "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__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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 , encounter_start_date\n , encounter_end_date\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 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), visits_encounters as (\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_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\n,procedure_encounters as (\n select patient_id, PROCEDURE_DATE as min_date, PROCEDURE_DATE as max_date\n from __dbt__cte__quality_measures__stg_core__procedure proc\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(proc.normalized_code,proc.source_code) = visit_codes.code\n\n\n)\n,\nclaims_encounters as (\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\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, 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 ) / 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.BIRTH_DATE is not null\n\n)\n\nselect 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 , encounter_start_date\n , encounter_end_date\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclude_dementia", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_dementia.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_dementia.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclude_dementia"], "alias": "_int_nqf0034_exclude_dementia", "checksum": {"name": "sha256", "checksum": "d2f02c3c35e222bc37544de648dbf0f068a98eccaff95634b79d4d4b51131d05"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_dementia", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and taking dementia medications for the reporting version of NQF 0034, Colorectal Cancer Screening.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_dementia", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.9717078, "relation_name": "dev_sarah.quality_measures._int_nqf0034_exclude_dementia", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period AND a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith\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 ( '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\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 {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on pharmacy_claim.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\n or pharmacy_claim.paid_date between pp.performance_period_begin_1yp and pp.performance_period_end\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\n\n, patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , concept_name\nfrom {{ref('quality_measures__int_nqf0034__frailty')}}\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.concept_name\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\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\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , patients_with_frailty.concept_name\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom frailty_with_dementia d", "language": "sql", "refs": [["quality_measures__value_sets"], ["quality_measures__stg_core__medication"], ["quality_measures__stg_pharmacy_claim"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__frailty"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["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", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__frailty"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_dementia.sql", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period AND a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith\n __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-21 19:58:21.989699+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 , paid_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_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 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\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 dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on pharmacy_claim.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\n or pharmacy_claim.paid_date between pp.performance_period_begin_1yp and pp.performance_period_end\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\n\n, patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , concept_name\nfrom dev_sarah.quality_measures._int_nqf0034__frailty\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.concept_name\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\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\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , patients_with_frailty.concept_name\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom frailty_with_dementia d", "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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-21 19:58:21.989699+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 , paid_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}]}, "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": "c5dcad10a4a404c61a7dc446e4b963cb54f89268fbb38607bc8546e9376b1102"}, "config": {"enabled": true, "alias": "_int_nqf0034_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0034, Colorectal Cancer Screening before combining with other measures. \n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.988091, "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))))\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\n/* selecting the full patient population as the grain of this table */\nwith patient as (\n\n select distinct patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n, 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 patient.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 patient\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on 1 = 1\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 evidence_date desc nulls last\n , exclusion_date desc nulls last\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 , 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": [["quality_measures__measures"], ["quality_measures__measures"], ["quality_measures__measures"], ["quality_measures__stg_core__patient"], ["quality_measures__int_nqf0034_denominator"], ["quality_measures__int_nqf0034_numerator"], ["quality_measures__int_nqf0034_exclusions"], ["quality_measures__int_nqf0034__performance_period"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures", "seed.the_tuva_project.quality_measures__measures", "seed.the_tuva_project.quality_measures__measures", "model.the_tuva_project.quality_measures__stg_core__patient", "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": "/* selecting the full patient population as the grain of this table */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n),patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, 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 patient.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 patient\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 evidence_date desc nulls last\n , exclusion_date desc nulls last\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 , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}]}, "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": "cca2e6986e8b7f77a62452621da6107ca7e54007c5d07495b7da112464495da7"}, "config": {"enabled": true, "alias": "_int_nqf0034__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Performance Period definition for NQF 0034 Colorectal Cancer screening.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.004443, "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))))\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": []}, "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": "6298ca02233276966995fda43fa85da02fcd4130dbcf384e4e46cbfd75b4504f"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0034, Colorectal Cancer Screening. \n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.9846258, "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))))\n )\n}}\n\nwith exclusions as (\nselect *\nFrom {{ref('quality_measures__int_nqf0034_exclude_advanced_illness')}}\n\nunion all\n\nselect *\nFrom {{ref('quality_measures__int_nqf0034_exclude_colectomy_cancer')}}\n\nunion all\n\nselect *\nFrom {{ref('quality_measures__int_nqf0034_exclude_dementia')}}\n\nunion all\n\nselect *\nFrom {{ref('quality_measures__int_nqf0034_exclude_hospice_palliative')}}\n\nunion all\n\nselect *\nFrom {{ref('quality_measures__int_nqf0034_exclude_institutional_snp')}}\n)\n\nselect exclusions.*\nfrom exclusions\ninner join {{ref('quality_measures__int_nqf0034_denominator')}} p\n on exclusions.patient_id = p.patient_id", "language": "sql", "refs": [["quality_measures__int_nqf0034_exclude_advanced_illness"], ["quality_measures__int_nqf0034_exclude_colectomy_cancer"], ["quality_measures__int_nqf0034_exclude_dementia"], ["quality_measures__int_nqf0034_exclude_hospice_palliative"], ["quality_measures__int_nqf0034_exclude_institutional_snp"], ["quality_measures__int_nqf0034_denominator"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "model.the_tuva_project.quality_measures__int_nqf0034_denominator"]}, "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": "\n\nwith exclusions as (\nselect *\nFrom dev_sarah.quality_measures._int_nqf0034_exclude_advanced_illness\n\nunion all\n\nselect *\nFrom dev_sarah.quality_measures._int_nqf0034_exclude_colectomy_cancer\n\nunion all\n\nselect *\nFrom dev_sarah.quality_measures._int_nqf0034_exclude_dementia\n\nunion all\n\nselect *\nFrom dev_sarah.quality_measures._int_nqf0034_exclude_hospice_palliative\n\nunion all\n\nselect *\nFrom dev_sarah.quality_measures._int_nqf0034_exclude_institutional_snp\n)\n\nselect exclusions.*\nfrom exclusions\ninner join dev_sarah.quality_measures._int_nqf0034_denominator p\n on exclusions.patient_id = p.patient_id", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.quality_measures__int_nqf0034__frailty": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034__frailty", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__frailty.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__frailty.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__frailty", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034__frailty"], "alias": "_int_nqf0034__frailty", "checksum": {"name": "sha256", "checksum": "64c3341f811ebbe1082f8146944799c29089899c8d4412fa6599817bafd65559"}, "config": {"enabled": true, "alias": "_int_nqf0034__frailty", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Frailty definition for nqf 0034 colorectal cancer screening used in multiple exclusions\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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__frailty", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false}, "created_at": 1708545506.996005, "relation_name": "dev_sarah.quality_measures._int_nqf0034__frailty", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients 66 years of age and older with at least one claim/encounter\nfor frailty during the measurement period (not full exclusion, used\nin conjunction with dementia medication or\n*/\n\n\nwith aged_patients as (\n select distinct patient_id\n from {{ref('quality_measures__int_nqf0034_denominator')}}\n where max_age >=66\n\n)\n\n, exclusion_codes as (\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 , case when code in ('G2100','G2101') then 1 else 0 end as meets_all_criteria\n From {{ref('quality_measures__value_sets')}}\n where concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n\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 {{ ref('quality_measures__stg_core__condition') }} )\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\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 aged_patients\n on conditions.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on\n recorded_date between pp.performance_period_begin and pp.performance_period_end\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 aged_patients\n on medical_claim.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp\n on claim_start_date between pp.performance_period_begin and pp.performance_period_end\n where exclusion_codes.code_system = 'hcpcs'\n\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 aged_patients\n on observations.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp\n on observation_date between pp.performance_period_begin and pp.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\n from procedures\n inner join aged_patients\n on procedures.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on\n procedure_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as concept_name\n from condition_exclusions\n\n union distinct\n\n select patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , concept_name as concept_name\n from med_claim_exclusions\n\n union distinct\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as concept_name\n from observation_exclusions\n\n union distinct\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as concept_name\n from procedure_exclusions\n\n)\n, ordered_exclusions as (\n select patient_id\n , exclusion_date\n , concept_name\n , row_number() over (partition by patient_id order by exclusion_date) as exclusion_row\n from patients_with_exclusions\n )\n\nselect patient_id\n , exclusion_date\n , concept_name\nfrom ordered_exclusions", "language": "sql", "refs": [["quality_measures__int_nqf0034_denominator"], ["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0034_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_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__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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__frailty.sql", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients 66 years of age and older with at least one claim/encounter\nfor frailty during the measurement period (not full exclusion, used\nin conjunction with dementia medication or\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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n),aged_patients as (\n select distinct patient_id\n from dev_sarah.quality_measures._int_nqf0034_denominator\n where max_age >=66\n\n)\n\n, exclusion_codes as (\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 , case when code in ('G2100','G2101') then 1 else 0 end as meets_all_criteria\n From dev_sarah.quality_measures._value_set_codes\n where concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n\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\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\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 aged_patients\n on conditions.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp on\n recorded_date between pp.performance_period_begin and pp.performance_period_end\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 aged_patients\n on medical_claim.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp\n on claim_start_date between pp.performance_period_begin and pp.performance_period_end\n where exclusion_codes.code_system = 'hcpcs'\n\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 aged_patients\n on observations.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp\n on observation_date between pp.performance_period_begin and pp.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\n from procedures\n inner join aged_patients\n on procedures.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp on\n procedure_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as concept_name\n from condition_exclusions\n\n union distinct\n\n select patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , concept_name as concept_name\n from med_claim_exclusions\n\n union distinct\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as concept_name\n from observation_exclusions\n\n union distinct\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as concept_name\n from procedure_exclusions\n\n)\n, ordered_exclusions as (\n select patient_id\n , exclusion_date\n , concept_name\n , row_number() over (partition by patient_id order by exclusion_date) as exclusion_row\n from patients_with_exclusions\n )\n\nselect patient_id\n , exclusion_date\n , concept_name\nfrom ordered_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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclude_hospice_palliative", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_hospice_palliative.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_hospice_palliative.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclude_hospice_palliative"], "alias": "_int_nqf0034_exclude_hospice_palliative", "checksum": {"name": "sha256", "checksum": "3c6edbda4dde2dc317e096187c65b3e0e7c7a157154b2ca8e1a0b83f47f1dacc"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_hospice_palliative", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients using hospice or palliative services for the reporting version of NQF 0034, Colorectal Cancer Screening. \n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_hospice_palliative", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.976973, "relation_name": "dev_sarah.quality_measures._int_nqf0034_exclude_hospice_palliative", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9710\n*/\n\n\nwith exclusion_codes as (\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 concept_name in (\n 'Hospice Care Ambulatory'\n , 'Hospice Encounter'\n , 'Palliative Care Encounter'\n , 'Palliative Care Intervention'\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 {{ ref('quality_measures__stg_core__condition') }} )\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 inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp\n on recorded_date between pp.performance_period_begin and pp.performance_period_end\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 inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on 1=1\n where exclusion_codes.code_system = 'hcpcs'\n and claim_start_date between pp.performance_period_begin and pp.performance_period_end\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 inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on 1=1\n where observation_date between pp.performance_period_begin and pp.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 inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on 1=1\n where procedure_date between pp.performance_period_begin and pp.performance_period_end\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\n\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom patients_with_exclusions", "language": "sql", "refs": [["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"]], "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", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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_exclude_hospice_palliative.sql", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9710\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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n),exclusion_codes as (\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 concept_name in (\n 'Hospice Care Ambulatory'\n , 'Hospice Encounter'\n , 'Palliative Care Encounter'\n , 'Palliative Care Intervention'\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\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 inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp\n on recorded_date between pp.performance_period_begin and pp.performance_period_end\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 inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp on 1=1\n where exclusion_codes.code_system = 'hcpcs'\n and claim_start_date between pp.performance_period_begin and pp.performance_period_end\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 inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp on 1=1\n where observation_date between pp.performance_period_begin and pp.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 inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp on 1=1\n where procedure_date between pp.performance_period_begin and pp.performance_period_end\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\n\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclude_advanced_illness", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_advanced_illness.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_advanced_illness.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclude_advanced_illness"], "alias": "_int_nqf0034_exclude_advanced_illness", "checksum": {"name": "sha256", "checksum": "883ef1a27debafec2ad51c859405f7db601797d9c9005ba5d7e45b9a944b418c"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_advanced_illness", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_advanced_illness", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.962105, "relation_name": "dev_sarah.quality_measures._int_nqf0034_exclude_advanced_illness", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n OR two outpatient, observation, ED or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\nwith encounter_exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n , case when concept_name = 'Acute Inpatient' then 'Acute Inpatient'\n else 'Other Encounter' end as concept_category\n , case when concept_name = 'Acute Inpatient' then 1\n else 2 end as qualifying_count\n from {{ ref('quality_measures__value_sets') }}\n where concept_name in (\n 'Acute Inpatient'\n , 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n\n)\n\n, condition_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 'Advanced Illness'\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/* -- observation based exclusions removed until we have better testing data\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 select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , condition_exclusion_codes.concept_name\n from conditions\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on conditions.recorded_date between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join condition_exclusion_codes\n on conditions.code = condition_exclusion_codes.code\n and conditions.code_type = condition_exclusion_codes.code_system\n\n/* -- observations temporarily removed until we have better testing data\n union all\n select\n observations.patient_id\n , cast(null as {{ dbt.type_string() }}) as claim_id\n , observations.observation_date\n , condition_exclusion_codes.concept_name\n from observations\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on observations.observation_date between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join condition_exclusion_codes\n on observations.code = condition_exclusion_codes.code\n and observations.code_type = condition_exclusion_codes.code_system\n*/\n\n\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 , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from medical_claim\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on coalesce(medical_claim.claim_start_date,medical_claim.claim_end_date) between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join encounter_exclusion_codes\n on medical_claim.hcpcs_code = encounter_exclusion_codes.code\n where encounter_exclusion_codes.code_system = 'hcpcs'\n\n)\n\n/* -- observations temporarily removed until we get better testing data\n, observation_exclusions as (\n\n\n select\n observations.patient_id\n , observations.observation_date\n , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from observations\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on observations.observation_date between pp.performance_period_begin_1yp and pp.performance_period_end\n\n inner join encounter_exclusion_codes\n on observations.code = encounter_exclusion_codes.code\n and observations.code_type = encounter_exclusion_codes.code_system\n\n)\n*/\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from procedures\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on procedures.procedure_date between pp.performance_period_begin_1yp and pp.performance_period_end\n\n inner join encounter_exclusion_codes\n on procedures.code = encounter_exclusion_codes.code\n and procedures.code_type = encounter_exclusion_codes.code_system\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n*/\n, patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , concept_name\nfrom {{ref('quality_measures__int_nqf0034__frailty')}}\n\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\n*/\n, encounters_with_conditions 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 , med_claim_exclusions.concept_name\n || ' with '\n || condition_exclusions.concept_name\n as exclusion_reason\n , med_claim_exclusions.concept_category\n , med_claim_exclusions.qualifying_count\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\n\n union all\n\n/* -- observations temporarily removed until we get better testing data\n select distinct\n patients_with_frailty.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n , observation_exclusions.concept_category\n , observation_exclusions.qualifying_count\n from patients_with_frailty\n inner join observation_exclusions\n on patients_with_frailty.patient_id = observation_exclusions.patient_id\n inner join condition_exclusions\n on observation_exclusions.patient_id = condition_exclusions.patient_id\n and observation_exclusions.observation_date = condition_exclusions.recorded_date\n\n union all\n*/\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n , procedure_exclusions.concept_category\n , procedure_exclusions.qualifying_count\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\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND two outpatient, observation, ED or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\n/*\n Filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n\n\n, qualifying_encounters as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\nfrom encounters_with_conditions e\nqualify dense_rank() over(partition by patient_id,concept_category order by exclusion_date) >= qualifying_count\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom qualifying_encounters", "language": "sql", "refs": [["quality_measures__value_sets"], ["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__int_nqf0034__frailty"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "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", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__frailty"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_advanced_illness.sql", "compiled": true, "compiled_code": "\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n OR two outpatient, observation, ED or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n),encounter_exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n , case when concept_name = 'Acute Inpatient' then 'Acute Inpatient'\n else 'Other Encounter' end as concept_category\n , case when concept_name = 'Acute Inpatient' then 1\n else 2 end as qualifying_count\n from dev_sarah.quality_measures._value_set_codes\n where concept_name in (\n 'Acute Inpatient'\n , 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n\n)\n\n, condition_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 'Advanced Illness'\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/* -- observation based exclusions removed until we have better testing data\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 select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , condition_exclusion_codes.concept_name\n from conditions\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on conditions.recorded_date between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join condition_exclusion_codes\n on conditions.code = condition_exclusion_codes.code\n and conditions.code_type = condition_exclusion_codes.code_system\n\n/* -- observations temporarily removed until we have better testing data\n union all\n select\n observations.patient_id\n , cast(null as TEXT) as claim_id\n , observations.observation_date\n , condition_exclusion_codes.concept_name\n from observations\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on observations.observation_date between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join condition_exclusion_codes\n on observations.code = condition_exclusion_codes.code\n and observations.code_type = condition_exclusion_codes.code_system\n*/\n\n\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 , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from medical_claim\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on coalesce(medical_claim.claim_start_date,medical_claim.claim_end_date) between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join encounter_exclusion_codes\n on medical_claim.hcpcs_code = encounter_exclusion_codes.code\n where encounter_exclusion_codes.code_system = 'hcpcs'\n\n)\n\n/* -- observations temporarily removed until we get better testing data\n, observation_exclusions as (\n\n\n select\n observations.patient_id\n , observations.observation_date\n , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from observations\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on observations.observation_date between pp.performance_period_begin_1yp and pp.performance_period_end\n\n inner join encounter_exclusion_codes\n on observations.code = encounter_exclusion_codes.code\n and observations.code_type = encounter_exclusion_codes.code_system\n\n)\n*/\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from procedures\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on procedures.procedure_date between pp.performance_period_begin_1yp and pp.performance_period_end\n\n inner join encounter_exclusion_codes\n on procedures.code = encounter_exclusion_codes.code\n and procedures.code_type = encounter_exclusion_codes.code_system\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n*/\n, patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , concept_name\nfrom dev_sarah.quality_measures._int_nqf0034__frailty\n\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\n*/\n, encounters_with_conditions 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 , med_claim_exclusions.concept_name\n || ' with '\n || condition_exclusions.concept_name\n as exclusion_reason\n , med_claim_exclusions.concept_category\n , med_claim_exclusions.qualifying_count\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\n\n union all\n\n/* -- observations temporarily removed until we get better testing data\n select distinct\n patients_with_frailty.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n , observation_exclusions.concept_category\n , observation_exclusions.qualifying_count\n from patients_with_frailty\n inner join observation_exclusions\n on patients_with_frailty.patient_id = observation_exclusions.patient_id\n inner join condition_exclusions\n on observation_exclusions.patient_id = condition_exclusions.patient_id\n and observation_exclusions.observation_date = condition_exclusions.recorded_date\n\n union all\n*/\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n , procedure_exclusions.concept_category\n , procedure_exclusions.qualifying_count\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\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND two outpatient, observation, ED or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\n/*\n Filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n\n\n, qualifying_encounters as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\nfrom encounters_with_conditions e\nqualify dense_rank() over(partition by patient_id,concept_category order by exclusion_date) >= qualifying_count\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom qualifying_encounters", "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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclude_institutional_snp", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_institutional_snp.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_institutional_snp.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclude_institutional_snp"], "alias": "_int_nqf0034_exclude_institutional_snp", "checksum": {"name": "sha256", "checksum": "5cb4e700829a5c7fa8a9e31905679350f6910351b1087788ef84a9ce6bf47366"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_institutional_snp", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients staying in an institution for the reporting version of NQF 0034, Colorectal Cancer Screening. \n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_institutional_snp", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545506.981598, "relation_name": "dev_sarah.quality_measures._int_nqf0034_exclude_institutional_snp", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\n/*\n Patients greater than or equal to 66 in Institutional Special Needs Plans (SNP)\n or residing in long term care\n\n Future enhancement: group claims into encounters\n*/\n\nwith aged_patients as (\n select distinct patient_id\n from {{ref('quality_measures__int_nqf0034_denominator')}}\n where max_age >=66\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 aged_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 aged_patients\n inner join medical_claim\n on aged_patients.patient_id = medical_claim.patient_id\n\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) between pp.performance_period_begin and pp.performance_period_end\n\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\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [["quality_measures__int_nqf0034_denominator"], ["quality_measures__stg_medical_claim"], ["quality_measures__int_nqf0034__performance_period"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__stg_medical_claim", "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_exclude_institutional_snp.sql", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 in Institutional Special Needs Plans (SNP)\n or residing in long term care\n\n Future enhancement: group claims into encounters\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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n),aged_patients as (\n select distinct patient_id\n from dev_sarah.quality_measures._int_nqf0034_denominator\n where max_age >=66\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 aged_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 aged_patients\n inner join medical_claim\n on aged_patients.patient_id = medical_claim.patient_id\n\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) between pp.performance_period_begin and pp.performance_period_end\n\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\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom exclusions", "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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}]}, "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": "e229d8f1e7f4e6a18d48fa5cd4b6638f4f6d4b4eaec10333d5a51bebf970ec65"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_colectomy_cancer", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.968009, "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))))\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 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 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\n\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom patients_with_exclusions", "language": "sql", "refs": [["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"]], "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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n),exclusion_codes as (\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 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\n\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "a052209de002644d9cd1fce8f6520b61c3a5c6fe9036a44a76bdd46ee28bc3e9"}, "config": {"enabled": true, "alias": "_int_nqf0034_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0034, Colorectal Cancer Screening\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545506.9918668, "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))))\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\n from {{ ref('quality_measures__int_nqf0034_denominator') }}\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) end as code_system\n , concept_name\n From {{ref('quality_measures__value_sets')}}\n where 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, screening_periods as (\n select *,\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 end as effective_performance_period_begin\n\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 select 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,qualifying_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) between screening_periods.effective_performance_period_begin and 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 or ( labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system )\n )\n\n,qualifying_events as (\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() }}) patient_id\n ,cast( evidence_date as date) as evidence_date\n ,cast( evidence as {{ dbt.type_string() }}) as evidence\n\nfrom qualifying_events\ninner join denominator\n on qualifying_events.patient_id = denominator.patient_id", "language": "sql", "refs": [["quality_measures__int_nqf0034_denominator"], ["quality_measures__value_sets"], ["quality_measures__int_nqf0034__performance_period"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"], ["quality_measures__stg_core__lab_result"]], "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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n),denominator as (\n\n select\n patient_id\n\n from dev_sarah.quality_measures._int_nqf0034_denominator\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) end as code_system\n , concept_name\n From dev_sarah.quality_measures._value_set_codes\n where 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, screening_periods as (\n select *,\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 end as effective_performance_period_begin\n\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 select 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,qualifying_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) between screening_periods.effective_performance_period_begin and 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 or ( labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system )\n )\n\n,qualifying_events as (\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) patient_id\n ,cast( evidence_date as date) as evidence_date\n ,cast( evidence as TEXT) as evidence\n\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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf0059__frailty": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0059__frailty", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059__frailty.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059__frailty.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059__frailty", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059__frailty"], "alias": "_int_nqf0059__frailty", "checksum": {"name": "sha256", "checksum": "79b52e162acd44105fea004cad507222375d336f74201216552912912a876e33"}, "config": {"enabled": true, "alias": "_int_nqf0059__frailty", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty used by other exclusion models.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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__frailty", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false}, "created_at": 1708545507.0203369, "relation_name": "dev_sarah.quality_measures._int_nqf0059__frailty", "raw_code": "{{ config(\r\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\r\n )\r\n}}\r\n/*\r\n This concept is used in multiple exclusions. Patients greater than\r\n or equal to 66 with at least one claim/encounter for frailty during\r\n the measurement period.\r\n*/\r\nwith denominator as (\r\n\r\n select\r\n patient_id\r\n , age\r\n , performance_period_begin\r\n , performance_period_end\r\n from {{ ref('quality_measures__int_nqf0059_denominator') }}\r\n\r\n)\r\n\r\n, exclusion_codes as (\r\n\r\n select\r\n code\r\n , code_system\r\n , concept_name\r\n from {{ ref('quality_measures__value_sets') }}\r\n where lower(concept_name) in (\r\n 'frailty device'\r\n , 'frailty diagnosis'\r\n , 'frailty encounter'\r\n , 'frailty symptom'\r\n )\r\n\r\n)\r\n\r\n, conditions as (\r\n\r\n select\r\n patient_id\r\n , recorded_date\r\n , coalesce (\r\n normalized_code_type\r\n , case\r\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\r\n else lower(source_code_type)\r\n end\r\n ) as code_type\r\n , coalesce (\r\n normalized_code\r\n , source_code\r\n ) as code\r\n from {{ ref('quality_measures__stg_core__condition') }}\r\n\r\n)\r\n\r\n, medical_claim as (\r\n\r\n select\r\n patient_id\r\n , claim_start_date\r\n , claim_end_date\r\n , hcpcs_code\r\n , place_of_service_code\r\n from {{ ref('quality_measures__stg_medical_claim') }}\r\n\r\n)\r\n\r\n, observations as (\r\n\r\n select\r\n patient_id\r\n , observation_date\r\n , coalesce (\r\n normalized_code_type\r\n , case\r\n when lower(source_code_type) = 'cpt' then 'hcpcs'\r\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\r\n else lower(source_code_type)\r\n end\r\n ) as code_type\r\n , coalesce (\r\n normalized_code\r\n , source_code\r\n ) as code\r\n from {{ ref('quality_measures__stg_core__observation') }}\r\n\r\n)\r\n\r\n, procedures as (\r\n\r\n select\r\n patient_id\r\n , procedure_date\r\n , coalesce (\r\n normalized_code_type\r\n , case\r\n when lower(source_code_type) = 'cpt' then 'hcpcs'\r\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\r\n else lower(source_code_type)\r\n end\r\n ) as code_type\r\n , coalesce (\r\n normalized_code\r\n , source_code\r\n ) as code\r\n from {{ ref('quality_measures__stg_core__procedure') }}\r\n\r\n)\r\n\r\n, condition_exclusions as (\r\n\r\n select\r\n conditions.patient_id\r\n , conditions.recorded_date\r\n , exclusion_codes.concept_name\r\n from conditions\r\n inner join exclusion_codes\r\n on conditions.code = exclusion_codes.code\r\n and conditions.code_type = exclusion_codes.code_system\r\n\r\n)\r\n\r\n, med_claim_exclusions as (\r\n\r\n select\r\n medical_claim.patient_id\r\n , medical_claim.claim_start_date\r\n , medical_claim.claim_end_date\r\n , medical_claim.hcpcs_code\r\n , exclusion_codes.concept_name\r\n from medical_claim\r\n inner join exclusion_codes\r\n on medical_claim.hcpcs_code = exclusion_codes.code\r\n where exclusion_codes.code_system = 'hcpcs'\r\n\r\n)\r\n\r\n, observation_exclusions as (\r\n\r\n select\r\n observations.patient_id\r\n , observations.observation_date\r\n , exclusion_codes.concept_name\r\n from observations\r\n inner join exclusion_codes\r\n on observations.code = exclusion_codes.code\r\n and observations.code_type = exclusion_codes.code_system\r\n\r\n)\r\n\r\n, procedure_exclusions as (\r\n\r\n select\r\n procedures.patient_id\r\n , procedures.procedure_date\r\n , exclusion_codes.concept_name\r\n from procedures\r\n inner join exclusion_codes\r\n on procedures.code = exclusion_codes.code\r\n and procedures.code_type = exclusion_codes.code_system\r\n\r\n)\r\n\r\n, patients_with_frailty as (\r\n\r\n select\r\n denominator.patient_id\r\n , denominator.performance_period_begin\r\n , denominator.performance_period_end\r\n , condition_exclusions.recorded_date as exclusion_date\r\n , condition_exclusions.concept_name as exclusion_reason\r\n from denominator\r\n inner join condition_exclusions\r\n on denominator.patient_id = condition_exclusions.patient_id\r\n where denominator.age >= 66\r\n and condition_exclusions.recorded_date\r\n between denominator.performance_period_begin\r\n and denominator.performance_period_end\r\n\r\n union all\r\n\r\n select\r\n denominator.patient_id\r\n , denominator.performance_period_begin\r\n , denominator.performance_period_end\r\n , coalesce(\r\n med_claim_exclusions.claim_start_date\r\n , med_claim_exclusions.claim_end_date\r\n ) as exclusion_date\r\n , med_claim_exclusions.concept_name as exclusion_reason\r\n from denominator\r\n inner join med_claim_exclusions\r\n on denominator.patient_id = med_claim_exclusions.patient_id\r\n where denominator.age >= 66\r\n and (\r\n med_claim_exclusions.claim_start_date\r\n between denominator.performance_period_begin\r\n and denominator.performance_period_end\r\n or med_claim_exclusions.claim_end_date\r\n between denominator.performance_period_begin\r\n and denominator.performance_period_end\r\n )\r\n\r\n union all\r\n\r\n select\r\n denominator.patient_id\r\n , denominator.performance_period_begin\r\n , denominator.performance_period_end\r\n , observation_exclusions.observation_date as exclusion_date\r\n , observation_exclusions.concept_name as exclusion_reason\r\n from denominator\r\n inner join observation_exclusions\r\n on denominator.patient_id = observation_exclusions.patient_id\r\n where denominator.age >= 66\r\n and observation_exclusions.observation_date\r\n between denominator.performance_period_begin\r\n and denominator.performance_period_end\r\n\r\n union all\r\n\r\n select\r\n denominator.patient_id\r\n , denominator.performance_period_begin\r\n , denominator.performance_period_end\r\n , procedure_exclusions.procedure_date as exclusion_date\r\n , procedure_exclusions.concept_name as exclusion_reason\r\n from denominator\r\n inner join procedure_exclusions\r\n on denominator.patient_id = procedure_exclusions.patient_id\r\n where denominator.age >= 66\r\n and procedure_exclusions.procedure_date\r\n between denominator.performance_period_begin\r\n and denominator.performance_period_end\r\n\r\n)\r\n\r\nselect\r\n patient_id\r\n , performance_period_begin\r\n , performance_period_end\r\n , exclusion_date\r\n , exclusion_reason\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom patients_with_frailty", "language": "sql", "refs": [["quality_measures__int_nqf0059_denominator"], ["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "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__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/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059__frailty.sql", "compiled": true, "compiled_code": "\n/*\n This concept is used in multiple exclusions. Patients greater than\n or equal to 66 with at least one claim/encounter for frailty during\n the measurement period.\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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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_nqf0059_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 '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 denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and condition_exclusions.recorded_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where denominator.age >= 66\n and (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+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__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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "1750db8ba11d714254297911e9f8b6f867fc1bbba84e4afaf7c6c479246a36ec"}, "config": {"enabled": true, "alias": "_int_nqf0059_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age as of the performance_period_begin date.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.025461, "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))))\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), visits_encounters as (\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, procedure_encounters as (\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')}} proc\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(proc.normalized_code,proc.source_code) = visit_codes.code\n\n\n)\n, claims_encounters as (\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_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\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 , 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 conditions.source_code_type = diabetics_codes.code_system\n and 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\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": [["quality_measures__value_sets"], ["quality_measures__stg_core__encounter"], ["quality_measures__int_nqf0059__performance_period"], ["quality_measures__stg_core__procedure"], ["quality_measures__int_nqf0059__performance_period"], ["quality_measures__stg_medical_claim"], ["quality_measures__int_nqf0059__performance_period"], ["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_core__patient"], ["quality_measures__int_nqf0059__performance_period"]], "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__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__int_nqf0059__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__patient", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period"]}, "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 , encounter_start_date\n , encounter_end_date\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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), visits_encounters as (\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, procedure_encounters as (\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 proc\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(proc.normalized_code,proc.source_code) = visit_codes.code\n\n\n)\n, claims_encounters as (\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_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\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 , 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 conditions.source_code_type = diabetics_codes.code_system\n and 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\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-02-21 19:58:21.989699+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 , encounter_start_date\n , encounter_end_date\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf0059_exclude_institutional_snp": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_exclude_institutional_snp", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_institutional_snp.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_institutional_snp.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclude_institutional_snp", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_exclude_institutional_snp"], "alias": "_int_nqf0059_exclude_institutional_snp", "checksum": {"name": "sha256", "checksum": "de92ba93d1b98d36821e3af6742494a16817c976807133dc073fb437d44b36bd"}, "config": {"enabled": true, "alias": "_int_nqf0059_exclude_institutional_snp", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients staying in an institution 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, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_exclude_institutional_snp", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545507.0398421, "relation_name": "dev_sarah.quality_measures._int_nqf0059_exclude_institutional_snp", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false))))\n )\n}}\n\n/*\n patients greater than or equal to 66 in institutional special needs plans (snp)\n or residing in long term care\n\n future enhancement: group claims into encounters\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_nqf0059_denominator') }}\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 denominator.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 denominator\n inner join medical_claim\n on denominator.patient_id = medical_claim.patient_id\n where denominator.age >= 66\n and (\n medical_claim.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or medical_claim.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n and 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 , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [["quality_measures__int_nqf0059_denominator"], ["quality_measures__stg_medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_institutional_snp.sql", "compiled": true, "compiled_code": "\n\n/*\n patients greater than or equal to 66 in institutional special needs plans (snp)\n or residing in long term care\n\n future enhancement: group claims into encounters\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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\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_nqf0059_denominator\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 denominator.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 denominator\n inner join medical_claim\n on denominator.patient_id = medical_claim.patient_id\n where denominator.age >= 66\n and (\n medical_claim.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or medical_claim.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n and 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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom exclusions", "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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}]}, "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": "f13d126ee3f63520220d3e2643773684254c01c132827614d087026d7d6bf1e1"}, "config": {"enabled": true, "alias": "_int_nqf0059_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.044411, "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))))\n )\n}}\n\nwith exclusions as (\n\nselect *\nfrom {{ref('quality_measures__int_nqf0059_exclude_advanced_illness')}}\n\nunion all\n\nselect *\nfrom {{ref('quality_measures__int_nqf0059_exclude_dementia')}}\n\nunion all\n\nselect *\nfrom {{ref('quality_measures__int_nqf0059_exclude_hospice_palliative')}}\n\nunion all\n\nselect *\nfrom {{ref('quality_measures__int_nqf0059_exclude_institutional_snp')}}\n\n)\n\n, valid_exclusions as (\n\n select \n exclusions.*\n from exclusions\n inner join {{ref('quality_measures__int_nqf0059_denominator')}} p\n on exclusions.patient_id = p.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(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , tuva_last_run\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 , tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [["quality_measures__int_nqf0059_exclude_advanced_illness"], ["quality_measures__int_nqf0059_exclude_dementia"], ["quality_measures__int_nqf0059_exclude_hospice_palliative"], ["quality_measures__int_nqf0059_exclude_institutional_snp"], ["quality_measures__int_nqf0059_denominator"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0059_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_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": "\n\nwith exclusions as (\n\nselect *\nfrom dev_sarah.quality_measures._int_nqf0059_exclude_advanced_illness\n\nunion all\n\nselect *\nfrom dev_sarah.quality_measures._int_nqf0059_exclude_dementia\n\nunion all\n\nselect *\nfrom dev_sarah.quality_measures._int_nqf0059_exclude_hospice_palliative\n\nunion all\n\nselect *\nfrom dev_sarah.quality_measures._int_nqf0059_exclude_institutional_snp\n\n)\n\n, valid_exclusions as (\n\n select \n exclusions.*\n from exclusions\n inner join dev_sarah.quality_measures._int_nqf0059_denominator p\n on exclusions.patient_id = p.patient_id\n\n)\n\n, add_data_types as (\n\n select\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 , tuva_last_run\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 , tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "cb2a1f3af835f5d73889da0f06d825f9db32cc4bcd2fae01b95c4e0378d1b8a5"}, "config": {"enabled": true, "alias": "_int_nqf0059_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.054097, "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))))\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, labs as (\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 select\n labs.patient_id\n , labs.result\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 ( labs.normalized_code = hba1c_test_code.code\n and labs.normalized_code_type = hba1c_test_code.code_system )\n or ( labs.source_code = hba1c_test_code.code\n and 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 and {{ apply_regex('labs.result', '[+-]?([0-9]*[.])?[0-9]+') }}\n\n)\n\n, recent_readings as (\n select\n patient_id\n , evidence_date\n , result\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.result\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 , 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 , case\n when cast(result 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(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 , numerator_flag\nfrom add_data_types", "language": "sql", "refs": [["quality_measures__int_nqf0059_denominator"], ["quality_measures__value_sets"], ["quality_measures__stg_core__lab_result"]], "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-02-21 19:58:21.989699+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, labs as (\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 select\n labs.patient_id\n , labs.result\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 ( labs.normalized_code = hba1c_test_code.code\n and labs.normalized_code_type = hba1c_test_code.code_system )\n or ( labs.source_code = hba1c_test_code.code\n and 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 and regexp_like(labs.result, '[+-]?([0-9]*[.])?[0-9]+')\n\n)\n\n, recent_readings as (\n select\n patient_id\n , evidence_date\n , result\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.result\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 , 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 , case\n when cast(result 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(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 , 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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf0059_exclude_advanced_illness": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_exclude_advanced_illness", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_advanced_illness.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_advanced_illness.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclude_advanced_illness", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_exclude_advanced_illness"], "alias": "_int_nqf0059_exclude_advanced_illness", "checksum": {"name": "sha256", "checksum": "cf9aee8e24716153fc0bbd37fb93118b06f59f078431b49e69770c7fe3b71616"}, "config": {"enabled": true, "alias": "_int_nqf0059_exclude_advanced_illness", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and advanced illness 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, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_exclude_advanced_illness", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545507.028567, "relation_name": "dev_sarah.quality_measures._int_nqf0059_exclude_advanced_illness", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false))))\n )\n}}\n/*\n patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n and either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n or two outpatient, observation, ed or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\nwith patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0059__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/*\n patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n and one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name = 'acute inpatient'\n and (\n med_claim_exclusions.claim_start_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 and (\n procedure_exclusions.procedure_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n and two outpatient, observation, ed or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 and (\n med_claim_exclusions.claim_start_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 and (\n procedure_exclusions.procedure_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n, acute_inpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient\n group by patient_id\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient\n group by patient_id\n\n)\n\n, eligible_acute_inpatient as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n from acute_inpatient\n left join acute_inpatient_counts\n on acute_inpatient.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n)\n\n, eligible_nonacute_outpatient as (\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n from nonacute_outpatient\n left join nonacute_outpatient_counts\n on nonacute_outpatient.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n\n, exclusions_unioned as (\n\n select\n eligible_acute_inpatient.patient_id\n , eligible_acute_inpatient.exclusion_date\n , eligible_acute_inpatient.exclusion_reason\n from eligible_acute_inpatient\n\n union all\n\n select\n eligible_nonacute_outpatient.patient_id\n , eligible_nonacute_outpatient.exclusion_date\n , eligible_nonacute_outpatient.exclusion_reason\n from eligible_nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions_unioned", "language": "sql", "refs": [["quality_measures__int_nqf0059__frailty"], ["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__procedure"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0059__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/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_advanced_illness.sql", "compiled": true, "compiled_code": "\n/*\n patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n and either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n or two outpatient, observation, ed or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n),patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0059__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/*\n patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n and one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name = 'acute inpatient'\n and (\n med_claim_exclusions.claim_start_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 and (\n procedure_exclusions.procedure_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n and two outpatient, observation, ed or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 and (\n med_claim_exclusions.claim_start_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 and (\n procedure_exclusions.procedure_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n, acute_inpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient\n group by patient_id\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient\n group by patient_id\n\n)\n\n, eligible_acute_inpatient as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n from acute_inpatient\n left join acute_inpatient_counts\n on acute_inpatient.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n)\n\n, eligible_nonacute_outpatient as (\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n from nonacute_outpatient\n left join nonacute_outpatient_counts\n on nonacute_outpatient.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n\n, exclusions_unioned as (\n\n select\n eligible_acute_inpatient.patient_id\n , eligible_acute_inpatient.exclusion_date\n , eligible_acute_inpatient.exclusion_reason\n from eligible_acute_inpatient\n\n union all\n\n select\n eligible_nonacute_outpatient.patient_id\n , eligible_nonacute_outpatient.exclusion_date\n , eligible_nonacute_outpatient.exclusion_reason\n from eligible_nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "52d565d32b0e4c4d8642cc299cc7275071d25b3bf95dd8b7cef11957eda11750"}, "config": {"enabled": true, "alias": "_int_nqf0059__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Performance Period definition for Diabetes Hemoglobin a1c.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.01397, "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\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": [["quality_measures__measures"], ["quality_measures__measures"], ["quality_measures__measures"]], "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", "seed.the_tuva_project.quality_measures__measures", "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": []}, "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": "800e0c20e43a75b6a7032ff6858ffa03d89d40de8feac0fec7eaae6562295364"}, "config": {"enabled": true, "alias": "_int_nqf0059_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.049302, "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))))\n )\n}}\n\n/* selecting the full patient population as the grain of this table */\nwith patient as (\n\n select distinct patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n, denominator as (\n\n select\n *\n from {{ ref('quality_measures__int_nqf0059_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\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 patient.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 , 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 patient.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n numerator.evidence_date desc nulls last\n , exclusions.exclusion_date desc nulls last\n )) as rn\n from patient\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 , 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(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 , 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": [["quality_measures__stg_core__patient"], ["quality_measures__int_nqf0059_denominator"], ["quality_measures__int_nqf0059_numerator"], ["quality_measures__int_nqf0059_exclusions"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient", "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\n/* selecting the full patient population as the grain of this table */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n),patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, denominator as (\n\n select\n *\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 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 patient.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 , 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 patient.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n numerator.evidence_date desc nulls last\n , exclusions.exclusion_date desc nulls last\n )) as rn\n from patient\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 , 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(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 , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_exclude_dementia", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_dementia.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_dementia.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_exclude_dementia"], "alias": "_int_nqf0059_exclude_dementia", "checksum": {"name": "sha256", "checksum": "35746a979d087b8af00885e9527d9c1252e94154dde3699a1f3fab1058435328"}, "config": {"enabled": true, "alias": "_int_nqf0059_exclude_dementia", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and taking dementia medications 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, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_exclude_dementia", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545507.03174, "relation_name": "dev_sarah.quality_measures._int_nqf0059_exclude_dementia", "raw_code": "{{ config(\r\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false))))\r\n )\r\n}}\r\n\r\n/*\r\n patients greater than or equal to 66 with at least one claim/encounter for frailty\r\n during the measurement period and a dispensed medication for dementia during the measurement period\r\n or year prior to measurement period\r\n*/\r\n\r\nwith patients_with_frailty as (\r\n\r\n select\r\n patient_id\r\n , performance_period_begin\r\n , performance_period_end\r\n , exclusion_date\r\n , exclusion_reason\r\n from {{ ref('quality_measures__int_nqf0059__frailty') }}\r\n\r\n)\r\n\r\n, exclusion_codes as (\r\n\r\n select\r\n code\r\n , code_system\r\n , concept_name\r\n from {{ ref('quality_measures__value_sets') }}\r\n where lower(concept_name) in (\r\n 'dementia medications'\r\n )\r\n\r\n)\r\n\r\n, medications as (\r\n\r\n select\r\n patient_id\r\n , dispensing_date\r\n , source_code_type\r\n , source_code\r\n , ndc_code\r\n , rxnorm_code\r\n from {{ ref('quality_measures__stg_core__medication') }}\r\n\r\n)\r\n\r\n, pharmacy_claim as (\r\n\r\n select\r\n patient_id\r\n , dispensing_date\r\n , ndc_code\r\n , paid_date\r\n from {{ ref('quality_measures__stg_pharmacy_claim') }}\r\n\r\n)\r\n\r\n, medication_exclusions as (\r\n\r\n select\r\n medications.patient_id\r\n , medications.dispensing_date\r\n , exclusion_codes.concept_name\r\n from medications\r\n inner join exclusion_codes\r\n on medications.ndc_code = exclusion_codes.code\r\n where exclusion_codes.code_system = 'ndc'\r\n\r\n union all\r\n\r\n select\r\n medications.patient_id\r\n , medications.dispensing_date\r\n , exclusion_codes.concept_name\r\n from medications\r\n inner join exclusion_codes\r\n on medications.rxnorm_code = exclusion_codes.code\r\n where exclusion_codes.code_system = 'rxnorm'\r\n\r\n union all\r\n\r\n select\r\n medications.patient_id\r\n , medications.dispensing_date\r\n , exclusion_codes.concept_name\r\n from medications\r\n inner join exclusion_codes\r\n on medications.source_code = exclusion_codes.code\r\n and medications.source_code_type = exclusion_codes.code_system\r\n\r\n)\r\n\r\n, pharmacy_claim_exclusions as (\r\n\r\n select\r\n pharmacy_claim.patient_id\r\n , pharmacy_claim.dispensing_date\r\n , pharmacy_claim.ndc_code\r\n , pharmacy_claim.paid_date\r\n , exclusion_codes.concept_name\r\n from pharmacy_claim\r\n inner join exclusion_codes\r\n on pharmacy_claim.ndc_code = exclusion_codes.code\r\n where exclusion_codes.code_system = 'ndc'\r\n\r\n)\r\n\r\n, frailty_with_dementia as (\r\n\r\n select\r\n patients_with_frailty.patient_id\r\n , patients_with_frailty.exclusion_date\r\n , patients_with_frailty.exclusion_reason\r\n || ' with '\r\n || pharmacy_claim_exclusions.concept_name\r\n as exclusion_reason\r\n from patients_with_frailty\r\n inner join pharmacy_claim_exclusions\r\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\r\n where (\r\n pharmacy_claim_exclusions.dispensing_date\r\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\r\n and patients_with_frailty.performance_period_end\r\n or pharmacy_claim_exclusions.paid_date\r\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\r\n and patients_with_frailty.performance_period_end\r\n )\r\n\r\n union all\r\n\r\n select\r\n patients_with_frailty.patient_id\r\n , medication_exclusions.dispensing_date as exclusion_date\r\n , patients_with_frailty.exclusion_reason\r\n || ' with '\r\n || medication_exclusions.concept_name\r\n as exclusion_reason\r\n from patients_with_frailty\r\n inner join medication_exclusions\r\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\r\n where medication_exclusions.dispensing_date\r\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"patients_with_frailty.performance_period_begin\") }}\r\n and patients_with_frailty.performance_period_end\r\n\r\n)\r\n\r\nselect\r\n patient_id\r\n , exclusion_date\r\n , exclusion_reason\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom frailty_with_dementia", "language": "sql", "refs": [["quality_measures__int_nqf0059__frailty"], ["quality_measures__value_sets"], ["quality_measures__stg_core__medication"], ["quality_measures__stg_pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0059__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/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_dementia.sql", "compiled": true, "compiled_code": "\n\n/*\n patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period and a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-21 19:58:21.989699+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 , paid_date\n , '2024-02-21 19:58:21.989699+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 , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0059__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\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n where (\n pharmacy_claim_exclusions.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or pharmacy_claim_exclusions.paid_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\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\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n where medication_exclusions.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-21 19:58:21.989699+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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-21 19:58:21.989699+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 , paid_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}]}, "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_exclude_hospice_palliative", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_hospice_palliative.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_hospice_palliative.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_exclude_hospice_palliative"], "alias": "_int_nqf0059_exclude_hospice_palliative", "checksum": {"name": "sha256", "checksum": "318f2e91ebd5c67da90bb256267a025d7e345d57c7a8e4b5a9f3f890d6a451da"}, "config": {"enabled": true, "alias": "_int_nqf0059_exclude_hospice_palliative", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Exclusion logic for patients using hospice and palliative services 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, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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_exclude_hospice_palliative", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false}, "created_at": 1708545507.035617, "relation_name": "dev_sarah.quality_measures._int_nqf0059_exclude_hospice_palliative", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , 'palliative care encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n , 'palliative care diagnosis'\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 inner join {{ref('quality_measures__int_nqf0059__performance_period')}} as pp\n on recorded_date between pp.performance_period_begin and pp.performance_period_end\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 inner join {{ref('quality_measures__int_nqf0059__performance_period')}} as pp on 1=1\n where exclusion_codes.code_system = 'hcpcs'\n and claim_start_date between pp.performance_period_begin and pp.performance_period_end\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 inner join {{ref('quality_measures__int_nqf0059__performance_period')}} as pp on 1=1\n where observation_date between pp.performance_period_begin and pp.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 inner join {{ref('quality_measures__int_nqf0059__performance_period')}} as pp on 1=1\n where procedure_date between pp.performance_period_begin and pp.performance_period_end\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 , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom patients_with_exclusions", "language": "sql", "refs": [["quality_measures__value_sets"], ["quality_measures__stg_core__condition"], ["quality_measures__stg_medical_claim"], ["quality_measures__stg_core__observation"], ["quality_measures__stg_core__procedure"], ["quality_measures__int_nqf0059__performance_period"], ["quality_measures__int_nqf0059__performance_period"], ["quality_measures__int_nqf0059__performance_period"], ["quality_measures__int_nqf0059__performance_period"]], "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", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclude_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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , 'palliative care encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n , 'palliative care diagnosis'\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 inner join dev_sarah.quality_measures._int_nqf0059__performance_period as pp\n on recorded_date between pp.performance_period_begin and pp.performance_period_end\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 inner join dev_sarah.quality_measures._int_nqf0059__performance_period as pp on 1=1\n where exclusion_codes.code_system = 'hcpcs'\n and claim_start_date between pp.performance_period_begin and pp.performance_period_end\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 inner join dev_sarah.quality_measures._int_nqf0059__performance_period as pp on 1=1\n where observation_date between pp.performance_period_begin and pp.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 inner join dev_sarah.quality_measures._int_nqf0059__performance_period as pp on 1=1\n where procedure_date between pp.performance_period_begin and pp.performance_period_end\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 , '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "ae7ac148ae1f91be3e61cfbd37d128eb0e0159a50eb0afdfde11c5ed4b09d6c7"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["ccsr"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["ccsr"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.192982, "relation_name": null, "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}\nwhere normalized_code_type = 'icd-10-cm'", "language": "sql", "refs": [["core__condition"]], "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 *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere normalized_code_type = 'icd-10-cm'", "extra_ctes_injected": true, "extra_ctes": []}, "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": "4f867df3d4e43f41e54d7afa4c185d9ba187be688de1272437ae2d5ce81fddf2"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["ccsr"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["ccsr"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.195057, "relation_name": null, "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__procedure') }}", "language": "sql", "refs": [["core__procedure"]], "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 *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure", "extra_ctes_injected": true, "extra_ctes": []}, "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": "08f710d6b4eef478aa581e199ed0a7f78744f26bb88f18b74cca4bb3ab129898"}, "config": {"enabled": true, "alias": "singular_condition_category", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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`).", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for an encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique claim_id for each claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "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`.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "parent_category_description": {"name": "parent_category_description", "description": "A description of the parent category.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "The human readable description of the `ccsr_category`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dxccsr_version": {"name": "dxccsr_version", "description": "The version number of the CCSR program from which the dbt model was derived.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.13235, "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))))\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 = true\n and condition_rank = 1", "language": "sql", "refs": [["ccsr__long_condition_category"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.ccsr.long_condition_category\nwhere \n is_ip_default_category = true\n and condition_rank = 1", "extra_ctes_injected": true, "extra_ctes": []}, "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": "172bfed9c6b34fdc92ff43062fbc87059d0dc224d46912270bc37481e63111f6"}, "config": {"enabled": true, "alias": "long_condition_category", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each the encounter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "condition_rank": {"name": "condition_rank", "description": "The numerical ranking of a diagnosis code in a claim.", "meta": {}, "data_type": "integer", "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`.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "parent_category_description": {"name": "parent_category_description", "description": "A description of the parent category.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "The description of the CCSR category as provided in the CCSR seed file.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dxccsr_version": {"name": "dxccsr_version", "description": "The version number of the CCSR program from which the dbt model was derived.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.127976, "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))))\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 using(ccsr_parent_category)", "language": "sql", "refs": [["ccsr__dx_vertical_pivot"], ["ccsr__stg_core__condition"], ["ccsr__dxccsr_v2023_1_body_systems"]], "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 *, '2024-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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 using(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 *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere normalized_code_type = 'icd-10-cm'\n)"}]}, "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": "dbba55d2513c9c38777a479b9fad26a8d61fc7609f779c518b13bdfe8bed9bdb"}, "config": {"enabled": true, "alias": "long_procedure_category", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The encounter_id for the encounter where this procedure was performed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The ICD-10-PCS code description provided in the CCSR CSV seed file.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "A description of the clinical domain.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "The CCSR category mapped to the ICD-10-PCS code.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "prccsr_version": {"name": "prccsr_version", "description": "The version number of the CCSR program from which the dbt model was derived.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.190088, "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))))\n )\n}}\n\nwith procedure as (\n \n select * from {{ ref('ccsr__stg_core__procedure') }}\n\n), ccsr__procedure_category_map as (\n\n select * from {{ ref ('ccsr__procedure_category_map') }}\n\n)\n\nselect distinct\n procedure.encounter_id,\n procedure.patient_id,\n procedure.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 procedure\nleft join ccsr__procedure_category_map\n on procedure.normalized_code = ccsr__procedure_category_map.code", "language": "sql", "refs": [["ccsr__stg_core__procedure"], ["ccsr__procedure_category_map"]], "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 *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n),procedure as (\n \n select * from __dbt__cte__ccsr__stg_core__procedure\n\n), ccsr__procedure_category_map as (\n\n select * from dev_sarah.ccsr.procedure_category_map\n\n)\n\nselect distinct\n procedure.encounter_id,\n procedure.patient_id,\n procedure.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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom procedure\nleft join ccsr__procedure_category_map\n on procedure.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 *, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "3e3719d1c3ca45862fb5fcad7a2d75993abc41c0c3d1b57f013d335ed5ab8e6c"}, "config": {"enabled": true, "alias": "dx_vertical_pivot", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["ccsr"], "description": "This is an intermediate model that pivots the DXCCSR's wide-format mapping CSV\ninto a long format table. While the seed uses 6 columns to represent the 6 CCSR codes that\nmay be present, this generates one row for each CCSR category per ICD code, so up to\n6 rows per code. \n\nThis model includes details and descriptions of the CCSR parent category and body systems that are inherited by the final models.\n\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, "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The description of the ICD-10-CM code included in the seed file.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "The human readable description of the `ccsr_category`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The CCSR parent category - the three letter prefix for each alphanumeric category.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.118626, "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))))\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 left(ccsr_category_{{ i }}, 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 (ccsr_category_{{ i }} = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_{{ i }} = default_ccsr_category_op) 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": [["ccsr__dxccsr_v2023_1_cleaned_map"]], "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 left(ccsr_category_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 (ccsr_category_1 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_1 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_2, 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 (ccsr_category_2 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_2 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_3, 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 (ccsr_category_3 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_3 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_4, 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 (ccsr_category_4 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_4 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_5, 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 (ccsr_category_5 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_5 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_6, 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 (ccsr_category_6 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_6 = default_ccsr_category_op) as is_op_default_category\n from codes \n \n\n)\n\nselect distinct\n *,\n '2024-02-21 19:58:21.989699+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": []}, "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": "9de066ce4bc064a683d44abe2552b778ec8ea2caa7aa7b62dfae61136ceaeb6d"}, "config": {"enabled": true, "alias": "procedure_category_map", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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.", "columns": {"code": {"name": "code", "description": "The ICD-10-PCS code", "meta": {}, "data_type": null, "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The description of the ICD-10-PCS code included in the seed file.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "The CCSR category to which the ICD-10 code is mapped.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "A description of the CCSR category.", "meta": {}, "data_type": null, "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.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The CCSR parent category - the three letter prefix for each alphanumeric category.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.12235, "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))))\n )\n}}\n\nselect \n icd_10_pcs as code,\n icd_10_pcs_description as code_description,\n prccsr as ccsr_category,\n left(prccsr, 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": [["ccsr__prccsr_v2023_1_cleaned_map"]], "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 left(prccsr, 3) as ccsr_parent_category,\n prccsr_description as ccsr_category_description,\n clinical_domain,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.ccsr._value_set_prccsr_v2023_1_cleaned_map", "extra_ctes_injected": true, "extra_ctes": []}, "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": "a45c2fe0a0454895c148d91b4fdf40dc2865f267b4a259252d6fbc200ccfcbf2"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.26124, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect\n patient_id\n, enrollment_start_date\n, enrollment_end_date\n, payer\n, plan\n, data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__eligibility') }}", "language": "sql", "refs": [["core__eligibility"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility", "extra_ctes_injected": true, "extra_ctes": []}, "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": "f1dce1c43ad38cefb74a3ecfe96f3f74d2715bcb29c6bb1a6dbe3dd8fa318793"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.262618, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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, plan\n, data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}", "language": "sql", "refs": [["core__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim", "extra_ctes_injected": true, "extra_ctes": []}, "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": "cffd881a875dd7c499c0498fdf37b17a0fc623018b0b73fb175b2d9c3e3edd36"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.2641852, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\n\nSELECT\n patient_id\n, dispensing_date\n, paid_amount\n, allowed_amount\n, payer\n, plan\n, data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__pharmacy_claim') }}", "language": "sql", "refs": [["core__pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "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_amount\n, allowed_amount\n, payer\n, plan\n, data_source\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": []}, "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": "9b6818647e1d4ce7de181d8ba5762a54d82c9ea3e73a372e81afd58f79929df8"}, "config": {"enabled": true, "alias": "pmpm_payer", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "member_months": {"name": "member_months", "description": "The sum of member months.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_paid": {"name": "total_paid", "description": "Total paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "medical_paid": {"name": "medical_paid", "description": "Total medical paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "inpatient_paid": {"name": "inpatient_paid", "description": "Total inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "outpatient_paid": {"name": "outpatient_paid", "description": "Total outpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ancillary_paid": {"name": "ancillary_paid", "description": "Total ancillary paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pharmacy_paid": {"name": "pharmacy_paid", "description": "Total pharmacy paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "other_paid": {"name": "other_paid", "description": "Total other paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ambulance_paid": {"name": "ambulance_paid", "description": "Total ambulance paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "dialysis_paid": {"name": "dialysis_paid", "description": "Total dialysis paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "hospice_paid": {"name": "hospice_paid", "description": "Total hospice paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "lab_paid": {"name": "lab_paid", "description": "Total lab paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "total_allowed": {"name": "total_allowed", "description": "Total allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "medical_allowed": {"name": "medical_allowed", "description": "Total medical allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "inpatient_allowed": {"name": "inpatient_allowed", "description": "Total inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "outpatient_allowed": {"name": "outpatient_allowed", "description": "Total outpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ancillary_allowed": {"name": "ancillary_allowed", "description": "Total ancillary allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pharmacy_allowed": {"name": "pharmacy_allowed", "description": "Total pharmacy allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "other_allowed": {"name": "other_allowed", "description": "Total other allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ambulance_allowed": {"name": "ambulance_allowed", "description": "Total ambulance allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "dialysis_allowed": {"name": "dialysis_allowed", "description": "Total dialysis allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "hospice_allowed": {"name": "hospice_allowed", "description": "Total hospice allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "lab_allowed": {"name": "lab_allowed", "description": "Total lab allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.24495, "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)))\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_visit_paid) / COUNT(1) AS office_visit_paid,\n SUM(ancillary_paid) / COUNT(1) AS ancillary_paid,\n SUM(pharmacy_paid) / COUNT(1) AS pharmacy_paid,\n SUM(other_paid) / COUNT(1) AS other_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_paid) / COUNT(1) AS ambulatory_surgery_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(hospice_paid) / COUNT(1) AS 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(office_visit_paid_2) / COUNT(1) AS office_visit_paid_2,\n SUM(outpatient_hospital_or_clinic_paid) / COUNT(1) AS outpatient_hospital_or_clinic_paid,\n SUM(outpatient_psychiatric_paid) / COUNT(1) AS outpatient_psychiatric_paid,\n SUM(outpatient_rehabilitation_paid) / COUNT(1) AS outpatient_rehabilitation_paid,\n SUM(skilled_nursing_paid) / COUNT(1) AS skilled_nursing_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_visit_allowed) / COUNT(1) AS office_visit_allowed,\n SUM(ancillary_allowed) / COUNT(1) AS ancillary_allowed,\n SUM(pharmacy_allowed) / COUNT(1) AS pharmacy_allowed,\n SUM(other_allowed) / COUNT(1) AS other_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_allowed) / COUNT(1) AS ambulatory_surgery_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(hospice_allowed) / COUNT(1) AS 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(office_visit_allowed_2) / COUNT(1) AS office_visit_allowed_2,\n SUM(outpatient_hospital_or_clinic_allowed) / COUNT(1) AS outpatient_hospital_or_clinic_allowed,\n SUM(outpatient_psychiatric_allowed) / COUNT(1) AS outpatient_psychiatric_allowed,\n SUM(outpatient_rehabilitation_allowed) / COUNT(1) AS outpatient_rehabilitation_allowed,\n SUM(skilled_nursing_allowed) / COUNT(1) AS skilled_nursing_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 1,2,3", "language": "sql", "refs": [["financial_pmpm__pmpm_prep"]], "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_visit_paid) / COUNT(1) AS office_visit_paid,\n SUM(ancillary_paid) / COUNT(1) AS ancillary_paid,\n SUM(pharmacy_paid) / COUNT(1) AS pharmacy_paid,\n SUM(other_paid) / COUNT(1) AS other_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_paid) / COUNT(1) AS ambulatory_surgery_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(hospice_paid) / COUNT(1) AS 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(office_visit_paid_2) / COUNT(1) AS office_visit_paid_2,\n SUM(outpatient_hospital_or_clinic_paid) / COUNT(1) AS outpatient_hospital_or_clinic_paid,\n SUM(outpatient_psychiatric_paid) / COUNT(1) AS outpatient_psychiatric_paid,\n SUM(outpatient_rehabilitation_paid) / COUNT(1) AS outpatient_rehabilitation_paid,\n SUM(skilled_nursing_paid) / COUNT(1) AS skilled_nursing_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_visit_allowed) / COUNT(1) AS office_visit_allowed,\n SUM(ancillary_allowed) / COUNT(1) AS ancillary_allowed,\n SUM(pharmacy_allowed) / COUNT(1) AS pharmacy_allowed,\n SUM(other_allowed) / COUNT(1) AS other_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_allowed) / COUNT(1) AS ambulatory_surgery_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(hospice_allowed) / COUNT(1) AS 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(office_visit_allowed_2) / COUNT(1) AS office_visit_allowed_2,\n SUM(outpatient_hospital_or_clinic_allowed) / COUNT(1) AS outpatient_hospital_or_clinic_allowed,\n SUM(outpatient_psychiatric_allowed) / COUNT(1) AS outpatient_psychiatric_allowed,\n SUM(outpatient_rehabilitation_allowed) / COUNT(1) AS outpatient_rehabilitation_allowed,\n SUM(skilled_nursing_allowed) / COUNT(1) AS skilled_nursing_allowed,\n SUM(urgent_care_allowed) / COUNT(1) AS urgent_care_allowed,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nFROM dev_sarah.financial_pmpm.pmpm_prep a\nGROUP BY 1,2,3", "extra_ctes_injected": true, "extra_ctes": []}, "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": "04f4a81f4ccd3261af1b60263f314ecb6ef920c7ce85e9ec5a12e969410967b4"}, "config": {"enabled": true, "alias": "pmpm_prep", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "inpatient_paid": {"name": "inpatient_paid", "description": "Total inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "outpatient_paid": {"name": "outpatient_paid", "description": "Total outpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ancillary_paid": {"name": "ancillary_paid", "description": "Total ancillary paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pharmacy_paid": {"name": "pharmacy_paid", "description": "Total pharmacy paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "other_paid": {"name": "other_paid", "description": "Total other paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ambulance_paid": {"name": "ambulance_paid", "description": "Total ambulance paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "dialysis_paid": {"name": "dialysis_paid", "description": "Total dialysis paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "hospice_paid": {"name": "hospice_paid", "description": "Total hospice paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "lab_paid": {"name": "lab_paid", "description": "Total lab paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "inpatient_allowed": {"name": "inpatient_allowed", "description": "Total inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "outpatient_allowed": {"name": "outpatient_allowed", "description": "Total outpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ancillary_allowed": {"name": "ancillary_allowed", "description": "Total ancillary allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pharmacy_allowed": {"name": "pharmacy_allowed", "description": "Total pharmacy allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "other_allowed": {"name": "other_allowed", "description": "Total other allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ambulance_allowed": {"name": "ambulance_allowed", "description": "Total ambulance allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "dialysis_allowed": {"name": "dialysis_allowed", "description": "Total dialysis allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "hospice_allowed": {"name": "hospice_allowed", "description": "Total hospice allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "lab_allowed": {"name": "lab_allowed", "description": "Total lab allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "total_paid": {"name": "total_paid", "description": "Total paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "medical_paid": {"name": "medical_paid", "description": "Total medical paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_allowed": {"name": "total_allowed", "description": "Total allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "medical_allowed": {"name": "medical_allowed", "description": "Total medical allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.218051, "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)))\n )\n}}\n\nwith combine as (\nSELECT\n a.patient_id,\n a.year_month,\n a.payer,\n a.plan, \n a.data_source,\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_visit_paid, 0) AS office_visit_paid,\n COALESCE(b.ancillary_paid, 0) AS ancillary_paid,\n COALESCE(b.pharmacy_paid, 0) AS pharmacy_paid,\n COALESCE(b.other_paid, 0) AS other_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_paid, 0) AS ambulatory_surgery_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.hospice_paid, 0) AS 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.office_visit_paid, 0) AS office_visit_paid_2,\n COALESCE(c.outpatient_hospital_or_clinic_paid, 0) AS outpatient_hospital_or_clinic_paid,\n COALESCE(c.outpatient_psychiatric_paid, 0) AS outpatient_psychiatric_paid,\n COALESCE(c.outpatient_rehabilitation_paid, 0) AS outpatient_rehabilitation_paid,\n COALESCE(c.skilled_nursing_paid, 0) AS skilled_nursing_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_visit_allowed, 0) AS office_visit_allowed,\n COALESCE(d.ancillary_allowed, 0) AS ancillary_allowed,\n COALESCE(d.pharmacy_allowed, 0) AS pharmacy_allowed,\n COALESCE(d.other_allowed, 0) AS other_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_allowed, 0) AS ambulatory_surgery_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.hospice_allowed, 0) AS 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.office_visit_allowed, 0) AS office_visit_allowed_2,\n COALESCE(e.outpatient_hospital_or_clinic_allowed, 0) AS outpatient_hospital_or_clinic_allowed,\n COALESCE(e.outpatient_psychiatric_allowed, 0) AS outpatient_psychiatric_allowed,\n COALESCE(e.outpatient_rehabilitation_allowed, 0) AS outpatient_rehabilitation_allowed,\n COALESCE(e.skilled_nursing_allowed, 0) AS skilled_nursing_allowed,\n COALESCE(e.urgent_care_allowed, 0) AS urgent_care_allowed\nFROM {{ ref('financial_pmpm__member_months') }} a\nleft join {{ ref('financial_pmpm__service_category_1_paid_pivot') }} 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\nleft join {{ ref('financial_pmpm__service_category_2_paid_pivot') }} 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\nleft join {{ ref('financial_pmpm__service_category_1_allowed_pivot') }} 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\nleft join {{ ref('financial_pmpm__service_category_2_allowed_pivot') }} 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, inpatient_paid + outpatient_paid + office_visit_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n, inpatient_paid + outpatient_paid + office_visit_paid + ancillary_paid + other_paid as medical_paid\n, inpatient_allowed + outpatient_allowed + office_visit_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n, inpatient_allowed + outpatient_allowed + office_visit_allowed + ancillary_allowed + other_allowed as medical_allowed\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom combine", "language": "sql", "refs": [["financial_pmpm__member_months"], ["financial_pmpm__service_category_1_paid_pivot"], ["financial_pmpm__service_category_2_paid_pivot"], ["financial_pmpm__service_category_1_allowed_pivot"], ["financial_pmpm__service_category_2_allowed_pivot"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.financial_pmpm__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 (\nSELECT\n a.patient_id,\n a.year_month,\n a.payer,\n a.plan, \n a.data_source,\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_visit_paid, 0) AS office_visit_paid,\n COALESCE(b.ancillary_paid, 0) AS ancillary_paid,\n COALESCE(b.pharmacy_paid, 0) AS pharmacy_paid,\n COALESCE(b.other_paid, 0) AS other_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_paid, 0) AS ambulatory_surgery_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.hospice_paid, 0) AS 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.office_visit_paid, 0) AS office_visit_paid_2,\n COALESCE(c.outpatient_hospital_or_clinic_paid, 0) AS outpatient_hospital_or_clinic_paid,\n COALESCE(c.outpatient_psychiatric_paid, 0) AS outpatient_psychiatric_paid,\n COALESCE(c.outpatient_rehabilitation_paid, 0) AS outpatient_rehabilitation_paid,\n COALESCE(c.skilled_nursing_paid, 0) AS skilled_nursing_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_visit_allowed, 0) AS office_visit_allowed,\n COALESCE(d.ancillary_allowed, 0) AS ancillary_allowed,\n COALESCE(d.pharmacy_allowed, 0) AS pharmacy_allowed,\n COALESCE(d.other_allowed, 0) AS other_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_allowed, 0) AS ambulatory_surgery_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.hospice_allowed, 0) AS 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.office_visit_allowed, 0) AS office_visit_allowed_2,\n COALESCE(e.outpatient_hospital_or_clinic_allowed, 0) AS outpatient_hospital_or_clinic_allowed,\n COALESCE(e.outpatient_psychiatric_allowed, 0) AS outpatient_psychiatric_allowed,\n COALESCE(e.outpatient_rehabilitation_allowed, 0) AS outpatient_rehabilitation_allowed,\n COALESCE(e.skilled_nursing_allowed, 0) AS skilled_nursing_allowed,\n COALESCE(e.urgent_care_allowed, 0) AS urgent_care_allowed\nFROM dev_sarah.financial_pmpm.member_months a\nleft join dev_sarah.financial_pmpm._int_service_category_1_paid_pivot 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\nleft join dev_sarah.financial_pmpm._int_service_category_2_paid_pivot 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\nleft join dev_sarah.financial_pmpm._int_service_category_1_allowed_pivot 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\nleft join dev_sarah.financial_pmpm._int_service_category_2_allowed_pivot 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, inpatient_paid + outpatient_paid + office_visit_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n, inpatient_paid + outpatient_paid + office_visit_paid + ancillary_paid + other_paid as medical_paid\n, inpatient_allowed + outpatient_allowed + office_visit_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n, inpatient_allowed + outpatient_allowed + office_visit_allowed + ancillary_allowed + other_allowed as medical_allowed\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom combine", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.financial_pmpm__member_months": {"database": "dev_sarah", "schema": "financial_pmpm", "name": "financial_pmpm__member_months", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/final/financial_pmpm__member_months.sql", "original_file_path": "models/financial_pmpm/final/financial_pmpm__member_months.sql", "unique_id": "model.the_tuva_project.financial_pmpm__member_months", "fqn": ["the_tuva_project", "financial_pmpm", "final", "financial_pmpm__member_months"], "alias": "member_months", "checksum": {"name": "sha256", "checksum": "640a656029af8d65a24b31b9e64142f01e19b092f84abed92d2ed9907bba748d"}, "config": {"enabled": true, "alias": "member_months", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["financial_pmpm"], "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, "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "financial_pmpm", "alias": "member_months", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#abab26"}}, "created_at": 1708545507.202515, "relation_name": "dev_sarah.financial_pmpm.member_months", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nwith month_start_and_end_dates as (\nselect \n concat(cast(year as {{ dbt.type_string() }} ),lpad(cast(month as {{ dbt.type_string() }}),2,'0')) as year_month\n, min(full_date) as month_start_date\n, max(full_date) as month_end_date\nfrom {{ ref('terminology__calendar')}}\ngroup by 1\n)\n\nselect distinct\n a.patient_id\n, year_month\n, a.payer\n, a.plan\n, data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('financial_pmpm__stg_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": [["terminology__calendar"], ["financial_pmpm__stg_eligibility"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.terminology__calendar", "model.the_tuva_project.financial_pmpm__stg_eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/final/financial_pmpm__member_months.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__financial_pmpm__stg_eligibility as (\n\n\nselect\n patient_id\n, enrollment_start_date\n, enrollment_end_date\n, payer\n, plan\n, data_source\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility\n),month_start_and_end_dates as (\nselect \n concat(cast(year as TEXT ),lpad(cast(month as TEXT),2,'0')) as year_month\n, min(full_date) as month_start_date\n, max(full_date) as month_end_date\nfrom dev_sarah.terminology.calendar\ngroup by 1\n)\n\nselect distinct\n a.patient_id\n, year_month\n, a.payer\n, a.plan\n, data_source\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__financial_pmpm__stg_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": [{"id": "model.the_tuva_project.financial_pmpm__stg_eligibility", "sql": " __dbt__cte__financial_pmpm__stg_eligibility as (\n\n\nselect\n patient_id\n, enrollment_start_date\n, enrollment_end_date\n, payer\n, plan\n, data_source\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility\n)"}]}, "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": "e456c62e3b8953eb085ab347d7d540717b0e067f9bc004998c1e5e29f05a998d"}, "config": {"enabled": true, "alias": "pmpm_payer_plan", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "member_months": {"name": "member_months", "description": "The sum of member months.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_paid": {"name": "total_paid", "description": "Total paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "medical_paid": {"name": "medical_paid", "description": "Total medical paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "inpatient_paid": {"name": "inpatient_paid", "description": "Total inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "outpatient_paid": {"name": "outpatient_paid", "description": "Total outpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ancillary_paid": {"name": "ancillary_paid", "description": "Total ancillary paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pharmacy_paid": {"name": "pharmacy_paid", "description": "Total pharmacy paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "other_paid": {"name": "other_paid", "description": "Total other paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ambulance_paid": {"name": "ambulance_paid", "description": "Total ambulance paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "dialysis_paid": {"name": "dialysis_paid", "description": "Total dialysis paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "hospice_paid": {"name": "hospice_paid", "description": "Total hospice paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "lab_paid": {"name": "lab_paid", "description": "Total lab paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}, "total_allowed": {"name": "total_allowed", "description": "Total allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "medical_allowed": {"name": "medical_allowed", "description": "Total medical allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "inpatient_allowed": {"name": "inpatient_allowed", "description": "Total inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "outpatient_allowed": {"name": "outpatient_allowed", "description": "Total outpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ancillary_allowed": {"name": "ancillary_allowed", "description": "Total ancillary allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pharmacy_allowed": {"name": "pharmacy_allowed", "description": "Total pharmacy allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "other_allowed": {"name": "other_allowed", "description": "Total other allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "ambulance_allowed": {"name": "ambulance_allowed", "description": "Total ambulance allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "dialysis_allowed": {"name": "dialysis_allowed", "description": "Total dialysis allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "hospice_allowed": {"name": "hospice_allowed", "description": "Total hospice allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "lab_allowed": {"name": "lab_allowed", "description": "Total lab allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.2314281, "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)))\n)}}\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_visit_paid) / COUNT(1) AS office_visit_paid,\n SUM(ancillary_paid) / COUNT(1) AS ancillary_paid,\n SUM(pharmacy_paid) / COUNT(1) AS pharmacy_paid,\n SUM(other_paid) / COUNT(1) AS other_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_paid) / COUNT(1) AS ambulatory_surgery_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(hospice_paid) / COUNT(1) AS 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(office_visit_paid_2) / COUNT(1) AS office_visit_paid_2,\n SUM(outpatient_hospital_or_clinic_paid) / COUNT(1) AS outpatient_hospital_or_clinic_paid,\n SUM(outpatient_psychiatric_paid) / COUNT(1) AS outpatient_psychiatric_paid,\n SUM(outpatient_rehabilitation_paid) / COUNT(1) AS outpatient_rehabilitation_paid,\n SUM(skilled_nursing_paid) / COUNT(1) AS skilled_nursing_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_visit_allowed) / COUNT(1) AS office_visit_allowed,\n SUM(ancillary_allowed) / COUNT(1) AS ancillary_allowed,\n SUM(pharmacy_allowed) / COUNT(1) AS pharmacy_allowed,\n SUM(other_allowed) / COUNT(1) AS other_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_allowed) / COUNT(1) AS ambulatory_surgery_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(hospice_allowed) / COUNT(1) AS 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(office_visit_allowed_2) / COUNT(1) AS office_visit_allowed_2,\n SUM(outpatient_hospital_or_clinic_allowed) / COUNT(1) AS outpatient_hospital_or_clinic_allowed,\n SUM(outpatient_psychiatric_allowed) / COUNT(1) AS outpatient_psychiatric_allowed,\n SUM(outpatient_rehabilitation_allowed) / COUNT(1) AS outpatient_rehabilitation_allowed,\n SUM(skilled_nursing_allowed) / COUNT(1) AS skilled_nursing_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 1,2,3,4", "language": "sql", "refs": [["financial_pmpm__pmpm_prep"]], "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_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_visit_paid) / COUNT(1) AS office_visit_paid,\n SUM(ancillary_paid) / COUNT(1) AS ancillary_paid,\n SUM(pharmacy_paid) / COUNT(1) AS pharmacy_paid,\n SUM(other_paid) / COUNT(1) AS other_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_paid) / COUNT(1) AS ambulatory_surgery_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(hospice_paid) / COUNT(1) AS 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(office_visit_paid_2) / COUNT(1) AS office_visit_paid_2,\n SUM(outpatient_hospital_or_clinic_paid) / COUNT(1) AS outpatient_hospital_or_clinic_paid,\n SUM(outpatient_psychiatric_paid) / COUNT(1) AS outpatient_psychiatric_paid,\n SUM(outpatient_rehabilitation_paid) / COUNT(1) AS outpatient_rehabilitation_paid,\n SUM(skilled_nursing_paid) / COUNT(1) AS skilled_nursing_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_visit_allowed) / COUNT(1) AS office_visit_allowed,\n SUM(ancillary_allowed) / COUNT(1) AS ancillary_allowed,\n SUM(pharmacy_allowed) / COUNT(1) AS pharmacy_allowed,\n SUM(other_allowed) / COUNT(1) AS other_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_allowed) / COUNT(1) AS ambulatory_surgery_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(hospice_allowed) / COUNT(1) AS 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(office_visit_allowed_2) / COUNT(1) AS office_visit_allowed_2,\n SUM(outpatient_hospital_or_clinic_allowed) / COUNT(1) AS outpatient_hospital_or_clinic_allowed,\n SUM(outpatient_psychiatric_allowed) / COUNT(1) AS outpatient_psychiatric_allowed,\n SUM(outpatient_rehabilitation_allowed) / COUNT(1) AS outpatient_rehabilitation_allowed,\n SUM(skilled_nursing_allowed) / COUNT(1) AS skilled_nursing_allowed,\n SUM(urgent_care_allowed) / COUNT(1) AS urgent_care_allowed,\n '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nFROM dev_sarah.financial_pmpm.pmpm_prep a\nGROUP BY 1,2,3,4", "extra_ctes_injected": true, "extra_ctes": []}, "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": "5c83171e5342693b8305b79a63726b663389895e0288bd93840c7aaf19a37399"}, "config": {"enabled": true, "alias": "_int_service_category_1_paid_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["financial_pmpm"], "description": "Pivots out paid amounts into columns by service category level 1.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.257154, "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)))\n )\n}}\n\nwith service_cat_1 as (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_1\n, data_source\n, sum(total_paid) as total_paid\nfrom {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\ngroup by 1,2,3,4,5,6\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_1'\n , values=('Inpatient','Outpatient','Office Visit','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 1,2,3,4,5", "language": "sql", "refs": [["financial_pmpm__patient_spend_with_service_categories"]], "sources": [], "metrics": [], "depends_on": {"macros": ["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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_1\n, data_source\n, sum(total_paid) as total_paid\nfrom dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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 Visit'\n then total_paid\n else 0\n end\n )\n \n \n as office_visit_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by 1,2,3,4,5", "extra_ctes_injected": true, "extra_ctes": []}, "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": "0f3b24231c00e77f69ad45cc88394eb6e5f7de10dc760507883630d4541dae30"}, "config": {"enabled": true, "alias": "_int_service_category_2_paid_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["financial_pmpm"], "description": "Pivots out paid amounts into columns by service category level 2.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.259746, "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)))\n )\n}}\n\nwith service_cat_2 as (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_2\n, data_source\n, sum(total_paid) as total_paid\nfrom {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\ngroup by 1,2,3,4,5,6\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_2'\n , values=('Acute Inpatient',\n 'Ambulance',\n 'Ambulatory Surgery',\n 'Dialysis',\n 'Durable Medical Equipment',\n 'Emergency Department',\n 'Home Health',\n 'Hospice',\n 'Inpatient Psychiatric',\n 'Inpatient Rehabilitation',\n 'Lab',\n 'Office Visit',\n 'Outpatient Hospital or Clinic',\n 'Outpatient Psychiatric',\n 'Outpatient Rehabilitation',\n 'Skilled Nursing',\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 1,2,3,4,5", "language": "sql", "refs": [["financial_pmpm__patient_spend_with_service_categories"]], "sources": [], "metrics": [], "depends_on": {"macros": ["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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_2\n, data_source\n, sum(total_paid) as total_paid\nfrom dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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'\n then total_paid\n else 0\n end\n )\n \n \n as ambulatory_surgery_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 = 'Hospice'\n then total_paid\n else 0\n end\n )\n \n \n as 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 = 'Office Visit'\n then total_paid\n else 0\n end\n )\n \n \n as office_visit_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 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 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 = '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 = '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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by 1,2,3,4,5", "extra_ctes_injected": true, "extra_ctes": []}, "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": "9edc612350f50178fffa597eaf30f96d41df1a22f2d9ec577b83d63f77c8c72a"}, "config": {"enabled": true, "alias": "_int_patient_spend_with_service_categories", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["financial_pmpm"], "description": "Adds service categories to claims and sums paid and allowed amounts to the year-month level.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.248215, "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)))\n )\n}}\n\nwith claims_with_service_categories as (\n select\n a.patient_id\n , a.payer\n , a.plan\n , a.service_category_1\n , a.service_category_2\n , coalesce(a.claim_start_date,a.claim_end_date) as claim_date\n , a.paid_amount\n , a.allowed_amount\n , data_source\n from {{ ref('financial_pmpm__stg_medical_claim') }} a\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 , cast({{ date_part(\"year\", \"claim_date\" ) }} as {{ dbt.type_string() }} ) || lpad(cast({{ date_part(\"month\", \"claim_date\" ) }} as {{ dbt.type_string() }} ),2,'0') 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 {{ dbt.type_string() }}) as service_category_2\n , {{try_to_cast_date('dispensing_date','YYYMMDD') }} 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 , plan\n , service_category_1\n , service_category_2\n , cast({{ date_part(\"year\", \"claim_date\" ) }} as {{ dbt.type_string() }} ) || lpad(cast({{ date_part(\"month\", \"claim_date\" ) }} as {{ dbt.type_string() }} ),2,'0') 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 , '{{ var('tuva_last_run')}}' as tuva_last_run\n from combine_medical_and_rx\ngroup by 1,2,3,4,5,6,9", "language": "sql", "refs": [["financial_pmpm__stg_medical_claim"], ["financial_pmpm__stg_pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date"], "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-02-21 19:58:21.989699+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_amount\n, allowed_amount\n, payer\n, plan\n, data_source\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n),claims_with_service_categories as (\n select\n a.patient_id\n , a.payer\n , a.plan\n , a.service_category_1\n , a.service_category_2\n , coalesce(a.claim_start_date,a.claim_end_date) as claim_date\n , a.paid_amount\n , a.allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_medical_claim a\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 , cast(date_part('year', claim_date) as TEXT ) || lpad(cast(date_part('month', claim_date) as TEXT ),2,'0') 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 , try_cast( dispensing_date as 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 , cast(date_part('year', claim_date) as TEXT ) || lpad(cast(date_part('month', claim_date) as TEXT ),2,'0') 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-02-21 19:58:21.989699+00:00' as tuva_last_run\n from combine_medical_and_rx\ngroup by 1,2,3,4,5,6,9", "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-02-21 19:58:21.989699+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_amount\n, allowed_amount\n, payer\n, plan\n, data_source\n, '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n)"}]}, "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": "a32238dd008b18a73a454870086c4b6e4e7f2628d8a010e374f4ac0df2a35390"}, "config": {"enabled": true, "alias": "_int_service_category_1_allowed_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["financial_pmpm"], "description": "Pivots out allowed amounts into columns by service category level 1.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.251552, "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)))\n )\n}}\n\nwith service_cat_1 as (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_1\n, data_source\n, sum(total_allowed) as total_allowed\nfrom {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\ngroup by 1,2,3,4,5,6\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_1'\n , values=('Inpatient','Outpatient','Office Visit','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 1,2,3,4,5", "language": "sql", "refs": [["financial_pmpm__patient_spend_with_service_categories"]], "sources": [], "metrics": [], "depends_on": {"macros": ["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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_1\n, data_source\n, sum(total_allowed) as total_allowed\nfrom dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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 Visit'\n then total_allowed\n else 0\n end\n )\n \n \n as office_visit_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by 1,2,3,4,5", "extra_ctes_injected": true, "extra_ctes": []}, "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": "ad30c2f5dedc08e138b411667752bb70744c4445a2713c81b1341cc65dfdc18a"}, "config": {"enabled": true, "alias": "_int_service_category_2_allowed_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#abab26"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["financial_pmpm"], "description": "Pivots out allowed amounts into columns by service category level 2.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#abab26"}, "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": "#abab26"}}, "created_at": 1708545507.254389, "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)))\n )\n}}\n\nwith service_cat_2 as (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_2\n, data_source\n, sum(total_allowed) as total_allowed\nfrom {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\ngroup by 1,2,3,4,5,6\n)\n\nselect\n patient_id \n, year_month \n, payer\n, plan\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_2'\n , values=('Acute Inpatient',\n 'Ambulance',\n 'Ambulatory Surgery',\n 'Dialysis',\n 'Durable Medical Equipment',\n 'Emergency Department',\n 'Home Health',\n 'Hospice',\n 'Inpatient Psychiatric',\n 'Inpatient Rehabilitation',\n 'Lab',\n 'Office Visit',\n 'Outpatient Hospital or Clinic',\n 'Outpatient Psychiatric',\n 'Outpatient Rehabilitation',\n 'Skilled Nursing',\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 1,2,3,4,5", "language": "sql", "refs": [["financial_pmpm__patient_spend_with_service_categories"]], "sources": [], "metrics": [], "depends_on": {"macros": ["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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_2\n, data_source\n, sum(total_allowed) as total_allowed\nfrom dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulatory_surgery_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 = 'Hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as 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 = 'Office Visit'\n then total_allowed\n else 0\n end\n )\n \n \n as office_visit_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 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 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 = '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 = '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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by 1,2,3,4,5", "extra_ctes_injected": true, "extra_ctes": []}, "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": "ead2f58476166732f909a5b0151c640d991fab09874636cff0587738db9c2109"}, "config": {"enabled": true, "alias": "_stg_condition", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["hcc_suspecting"], "description": "Staging conditions from core.", "columns": {"claim_id": {"name": "claim_id", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "code": {"name": "code", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.290071, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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 , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}", "language": "sql", "refs": [["core__condition"]], "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 , normalized_code_type as code_type\n , normalized_code as code\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": []}, "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": "3df32901fdf9ccc3a67180594f433bbf361840f918d0af8d7039d5721d3bb382"}, "config": {"enabled": true, "alias": "_stg_patient", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["hcc_suspecting"], "description": "Staging patients from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sex": {"name": "sex", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.29383, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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": [["core__patient"]], "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\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": []}, "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": "55a8de28f326836864a43cd3d0f19f53b8787e2d004c1c4c6d1bcd44219bc8aa"}, "config": {"enabled": true, "alias": "list", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["hcc_suspecting"], "description": "This final model displays the list of suspecting conditions per patient with the reason and contributing factors.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.26926, "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))))\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 , 'Prior coding history' as reason\n , icd_10_cm_code\n || case\n when last_billed is not null then ' last billed on ' || last_billed\n when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded\n else ' (missing recorded and billing dates) '\n end as contributing_factor\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n where current_year_billed = false\n\n)\n\n, unioned as (\n\n select * from hcc_history_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 from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [["hcc_suspecting__int_patient_hcc_history"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"]}, "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 , 'Prior coding history' as reason\n , icd_10_cm_code\n || case\n when last_billed is not null then ' last billed on ' || last_billed\n when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded\n else ' (missing recorded and billing dates) '\n end as contributing_factor\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n where current_year_billed = false\n\n)\n\n, unioned as (\n\n select * from hcc_history_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 from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "d62db6b78453d02113d73c2691fff7ec8e2b6cd95532dbc8da294ffc2c354005"}, "config": {"enabled": true, "alias": "summary", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "quote": null, "tags": []}, "patient_birth_date": {"name": "patient_birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "patient_age": {"name": "patient_age", "description": "The patient's current age.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "suspecting_gaps": {"name": "suspecting_gaps", "description": "Count of suspecting conditions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.273071, "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))))\n )\n}}\n\nwith patients as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor({{ datediff('birth_date', 'current_date', 'hour') }} / 8766.0) as age\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": [["hcc_suspecting__stg_core__patient"], ["hcc_suspecting__list"]], "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\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n),patients as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8766.0) as age\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-02-21 19:58:21.989699+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\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}]}, "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": "0cc66c836a8f9e2c37fc9ea1e1b5cc4b57c2e61f6c922c0bf91d92ad583c10a2"}, "config": {"enabled": true, "alias": "_int_patient_hcc_history", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "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, "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the ICD-10-CM condition was recorded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "first_recorded": {"name": "first_recorded", "description": "Date the HCC was first recorded in the patient's record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_recorded": {"name": "last_recorded", "description": "Date the HCC was last recorded in the patient's record.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the ICD-10-CM code mapped to the HCC was billed during the payment year.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.282134, "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))))\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 extract(year from hcc_billed.last_billed) = extract(year from {{ dbt.current_timestamp() }} )\n then 1\n else 0\n end as current_year_billed\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 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_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 , cast(current_year_billed as boolean) as current_year_billed\n from all_conditions_with_flag\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 , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [["hcc_suspecting__int_all_conditions"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "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 extract(year from hcc_billed.last_billed) = extract(year from convert_timezone('UTC', current_timestamp()) )\n then 1\n else 0\n end as current_year_billed\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 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_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 , cast(current_year_billed as boolean) as current_year_billed\n from all_conditions_with_flag\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 , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "8b5cd13c15dc1f928b9fffdfaba29d03bcc079c10cc741eeff6fff51dc6c089f"}, "config": {"enabled": true, "alias": "_int_all_conditions", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the condition was recorded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "icd_10_cm_code": {"name": "icd_10_cm_code", "description": "The ICD-10-CM condition code.", "meta": {}, "data_type": null, "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, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.277157, "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))))\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": [["hcc_suspecting__int_prep_conditions"], ["hcc_suspecting__icd_10_cm_mappings"], ["hcc_suspecting__hcc_descriptions"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": []}, "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": "550c5a5256a27b2e204c09905add90a037a852bf967ee626d1ff53d4f0486667"}, "config": {"enabled": true, "alias": "_int_prep_conditions", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the condition was recorded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545507.285901, "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))))\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": [["hcc_suspecting__stg_core__condition"], ["terminology__snomed_icd_10_map"]], "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 , normalized_code_type as code_type\n , normalized_code as code\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\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-02-21 19:58:21.989699+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 , normalized_code_type as code_type\n , normalized_code as code\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}]}, "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "cms_chronic_conditions__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_pharmacy_claim.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_pharmacy_claim"], "alias": "cms_chronic_conditions__stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "c6fe56463f4b344bf02158e45e7a72b2d6ab6c0a76ba098090302bf04fb6acb0"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.353021, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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('pharmacy_claim') }}", "language": "sql", "refs": [["pharmacy_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": []}, "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": "052d4e09d81b4d13b6e6e574982ac9530f20a832c69ed9ee201dfac4739a30ec"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["tuva_chronic_conditions"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["tuva_chronic_conditions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.422154, "relation_name": null, "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n )\n}}\n\nselect \n patient_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [["core__patient"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": []}, "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": "bd66a457c679034c78d2096d5f11fa56ee836c475deb61f5799031d50ae88a8d"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.3489192, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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') }}", "language": "sql", "refs": [["core__procedure"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure", "extra_ctes_injected": true, "extra_ctes": []}, "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": "fc63071aa65724d7ccfce9f7c7807511c9d21eefa4c401a5ef1df54e3a329f6e"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["tuva_chronic_conditions"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["tuva_chronic_conditions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.4183528, "relation_name": null, "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\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": [["core__condition"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": []}, "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": "f42e0eb8c7fd94e710385294473ff4cbb48b9efa056e20015005b21a20e56ed0"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.347407, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n )\n}}\n\nselect \n patient_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [["core__patient"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": []}, "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "cms_chronic_conditions__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_medical_claim.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_medical_claim"], "alias": "cms_chronic_conditions__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "0217a4751ee97a1188a358e17dffcbb600d006dd50effdd5c3597cfef4a5de7a"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.3507829, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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('medical_claim') }}", "language": "sql", "refs": [["medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim", "extra_ctes_injected": true, "extra_ctes": []}, "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": "af31a34e0ee8accd286630da04ee6154aac827c689e518e66eca2e696eaaafa7"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.345647, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\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') }}", "language": "sql", "refs": [["core__condition"]], "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": []}, "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": "a9f319a429001c1a239554868a1c13bb2b61199699162591772b1bb9cc8f0579"}, "config": {"enabled": true, "alias": "tuva_chronic_conditions_long", "schema": "chronic_conditions", "database": null, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "condition_family": {"name": "condition_family", "description": "A higher level rollup grouping of conditions from the condition column\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, "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.389903, "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))))\n )\n}}\n\nwith condition_row_number as (\n\n select \n patient_id\n , normalized_code\n , recorded_date\n , row_number() over(\n partition by\n patient_id\n , normalized_code\n order by recorded_date asc\n ) as rn_asc\n , row_number() over(\n partition by\n patient_id\n , normalized_code\n order by recorded_date desc\n ) as rn_desc\n from {{ ref('tuva_chronic_conditions__stg_core__condition') }}\n\n)\n\n, patient_conditions as (\n\n select \n patient_id\n , normalized_code as icd_10_cm\n , max(\n case\n when rn_asc = 1\n then recorded_date\n end\n ) as first_diagnosis_date\n , max(\n case\n when rn_desc = 1\n then recorded_date\n end\n ) as last_diagnosis_date\n from condition_row_number\n group by \n patient_id\n , normalized_code\n\n)\n\nselect \n pc.patient_id\n , h.condition_family\n , h.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 {{ ref('chronic_conditions__tuva_chronic_conditions_hierarchy') }} h\n inner join patient_conditions pc\n on h.icd_10_cm_code = pc.icd_10_cm\ngroup by \n pc.patient_id\n , h.condition_family\n , h.condition", "language": "sql", "refs": [["tuva_chronic_conditions__stg_core__condition"], ["chronic_conditions__tuva_chronic_conditions_hierarchy"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.tuva_chronic_conditions__stg_core__condition", "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy"]}, "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n),condition_row_number as (\n\n select \n patient_id\n , normalized_code\n , recorded_date\n , row_number() over(\n partition by\n patient_id\n , normalized_code\n order by recorded_date asc\n ) as rn_asc\n , row_number() over(\n partition by\n patient_id\n , normalized_code\n order by recorded_date desc\n ) as rn_desc\n from __dbt__cte__tuva_chronic_conditions__stg_core__condition\n\n)\n\n, patient_conditions as (\n\n select \n patient_id\n , normalized_code as icd_10_cm\n , max(\n case\n when rn_asc = 1\n then recorded_date\n end\n ) as first_diagnosis_date\n , max(\n case\n when rn_desc = 1\n then recorded_date\n end\n ) as last_diagnosis_date\n from condition_row_number\n group by \n patient_id\n , normalized_code\n\n)\n\nselect \n pc.patient_id\n , h.condition_family\n , h.condition\n , min(first_diagnosis_date) as first_diagnosis_date\n , max(last_diagnosis_date) as last_diagnosis_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.chronic_conditions._value_set_tuva_chronic_conditions_hierarchy h\n inner join patient_conditions pc\n on h.icd_10_cm_code = pc.icd_10_cm\ngroup by \n pc.patient_id\n , h.condition_family\n , h.condition", "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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}]}, "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": "1a4a6540512db0e049723d6afdeaa6cf95638321608170855f18964c9fbae4ad"}, "config": {"enabled": true, "alias": "cms_chronic_conditions_wide", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "acute_myocardial_infarction": {"name": "acute_myocardial_infarction", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "alcohol_use_disorders": {"name": "alcohol_use_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "alzheimers_disease": {"name": "alzheimers_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "anemia": {"name": "anemia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "anxiety_disorders": {"name": "anxiety_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "asthma": {"name": "asthma", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "atrial_fibrillation_and_flutter": {"name": "atrial_fibrillation_and_flutter", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "autism_spectrum_disorders": {"name": "autism_spectrum_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "benign_prostatic_hyperplasia": {"name": "benign_prostatic_hyperplasia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "bipolar_disorder": {"name": "bipolar_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "cancer_breast": {"name": "cancer_breast", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "cancer_colorectal": {"name": "cancer_colorectal", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "cancer_endometrial": {"name": "cancer_endometrial", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "cancer_lung": {"name": "cancer_lung", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "cancer_prostate": {"name": "cancer_prostate", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "cataract": {"name": "cataract", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "cerebral_palsy": {"name": "cerebral_palsy", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "chronic_kidney_disease": {"name": "chronic_kidney_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "chronic_obstructive_pulmonary_disease": {"name": "chronic_obstructive_pulmonary_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "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", "quote": null, "tags": []}, "depressive_disorders": {"name": "depressive_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "diabetes": {"name": "diabetes", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "drug_use_disorders": {"name": "drug_use_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "epilepsy": {"name": "epilepsy", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "glaucoma": {"name": "glaucoma", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "hepatitis_a": {"name": "hepatitis_a", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "hepatitis_b_chronic": {"name": "hepatitis_b_chronic", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "hepatitis_c_acute": {"name": "hepatitis_c_acute", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "hepatitis_c_chronic": {"name": "hepatitis_c_chronic", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "hepatitis_c_unspecified": {"name": "hepatitis_c_unspecified", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "hepatitis_d": {"name": "hepatitis_d", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "hepatitis_e": {"name": "hepatitis_e", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "hip_pelvic_fracture": {"name": "hip_pelvic_fracture", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "hyperlipidemia": {"name": "hyperlipidemia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "hypertension": {"name": "hypertension", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "hypothyroidism": {"name": "hypothyroidism", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "ischemic_heart_disease": {"name": "ischemic_heart_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "learning_disabilities": {"name": "learning_disabilities", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "leukemias_and_lymphomas": {"name": "leukemias_and_lymphomas", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "migraine_and_chronic_headache": {"name": "migraine_and_chronic_headache", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "mobility_impairments": {"name": "mobility_impairments", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "muscular_dystrophy": {"name": "muscular_dystrophy", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "non_alzheimers_dementia": {"name": "non_alzheimers_dementia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "obesity": {"name": "obesity", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "opioid_use_disorder_oud": {"name": "opioid_use_disorder_oud", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "other_developmental_delays": {"name": "other_developmental_delays", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "peripheral_vascular_disease_pvd": {"name": "peripheral_vascular_disease_pvd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "personality_disorders": {"name": "personality_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "pneumonia_all_cause": {"name": "pneumonia_all_cause", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "pressure_and_chronic_ulcers": {"name": "pressure_and_chronic_ulcers", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "rheumatoid_arthritis_osteoarthritis": {"name": "rheumatoid_arthritis_osteoarthritis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "schizophrenia": {"name": "schizophrenia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "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", "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", "quote": null, "tags": []}, "sickle_cell_disease": {"name": "sickle_cell_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "spinal_cord_injury": {"name": "spinal_cord_injury", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "stroke_transient_ischemic_attack": {"name": "stroke_transient_ischemic_attack", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "tobacco_use": {"name": "tobacco_use", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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", "quote": null, "tags": []}, "viral_hepatitis_general": {"name": "viral_hepatitis_general", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.3256261, "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)))\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": [["chronic_conditions__cms_chronic_conditions_hierarchy"], ["chronic_conditions__cms_chronic_conditions_long"], ["chronic_conditions__cms_chronic_conditions_hierarchy"], ["cms_chronic_conditions__stg_core__patient"]], "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", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}]}, "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": "fd544808dd511e5b9ad485a51b7a5a6dcc399cf116583db8c5b89c71878ae284"}, "config": {"enabled": true, "alias": "tuva_chronic_conditions_wide", "schema": "chronic_conditions", "database": null, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "acute_myocardial_infarction": {"name": "acute_myocardial_infarction", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "alcohol": {"name": "alcohol", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "alzheimers_disease": {"name": "alzheimers_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "amyotrophic_lateral_sclerosis": {"name": "amyotrophic_lateral_sclerosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "anxiety": {"name": "anxiety", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "asthma": {"name": "asthma", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "atherosclerosis": {"name": "atherosclerosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "atrial_fibrillation": {"name": "atrial_fibrillation", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "attention_deficit_hyperactivity_disorder": {"name": "attention_deficit_hyperactivity_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "bipolar": {"name": "bipolar", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "breast_cancer": {"name": "breast_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "chronic_kidney_disease": {"name": "chronic_kidney_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "chronic_obstructive_pulmonary_disease": {"name": "chronic_obstructive_pulmonary_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "cocaine": {"name": "cocaine", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "colorectal_cancer": {"name": "colorectal_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "crohns_disease": {"name": "crohns_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "cystic_fibrosis": {"name": "cystic_fibrosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "dementia": {"name": "dementia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "depression": {"name": "depression", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "heart_failure": {"name": "heart_failure", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "hyperlipidemia": {"name": "hyperlipidemia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "hypertension": {"name": "hypertension", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "lung_cancer": {"name": "lung_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "lupus": {"name": "lupus", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "metabolic_syndrome": {"name": "metabolic_syndrome", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "multiple_sclerosis": {"name": "multiple_sclerosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "muscular_dystrophy": {"name": "muscular_dystrophy", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "obesity": {"name": "obesity", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "obsessive_compulsive_disorder": {"name": "obsessive_compulsive_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "opioid": {"name": "opioid", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "parkinsons_disease": {"name": "parkinsons_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "personality_disorder": {"name": "personality_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "post_traumatic_stress_disorder": {"name": "post_traumatic_stress_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "rheumatoid_arthritis": {"name": "rheumatoid_arthritis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "schizophrenia": {"name": "schizophrenia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "stroke": {"name": "stroke", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "tobacco": {"name": "tobacco", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "type_1_diabetes": {"name": "type_1_diabetes", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "type_2_diabetes": {"name": "type_2_diabetes", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "quote": null, "tags": []}, "ulcerative_colitis": {"name": "ulcerative_colitis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.4156, "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))))\n )\n}}\n\nwith condition_columns as (\n\n select distinct\n condition\n , condition_column_name\n from {{ ref('chronic_conditions__tuva_chronic_conditions_hierarchy') }}\n\n)\n\nselect\n p.patient_id\n , {{ dbt_utils.pivot(\n column='cc.condition_column_name'\n , values=dbt_utils.get_column_values(\n ref('chronic_conditions__tuva_chronic_conditions_hierarchy')\n , 'condition_column_name'\n ,'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('tuva_chronic_conditions__stg_core__patient') }} p\n left join {{ ref('chronic_conditions__tuva_chronic_conditions_long') }} l\n on p.patient_id = l.patient_id\n left join condition_columns cc\n on l.condition = cc.condition\ngroup by\n p.patient_id", "language": "sql", "refs": [["chronic_conditions__tuva_chronic_conditions_hierarchy"], ["chronic_conditions__tuva_chronic_conditions_hierarchy"], ["tuva_chronic_conditions__stg_core__patient"], ["chronic_conditions__tuva_chronic_conditions_long"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.get_column_values", "macro.dbt_utils.pivot"], "nodes": ["seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy", "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy", "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient", "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 __dbt__cte__tuva_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n),condition_columns as (\n\n select distinct\n condition\n , condition_column_name\n from dev_sarah.chronic_conditions._value_set_tuva_chronic_conditions_hierarchy\n\n)\n\nselect\n p.patient_id\n , \n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'ALCOHOL'\n then 1\n else 0\n end\n )\n \n \n as alcohol\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'AMYOTROPHIC_LATERAL_SCLEROSIS'\n then 1\n else 0\n end\n )\n \n \n as amyotrophic_lateral_sclerosis\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ANXIETY'\n then 1\n else 0\n end\n )\n \n \n as anxiety\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'ATHEROSCLEROSIS'\n then 1\n else 0\n end\n )\n \n \n as atherosclerosis\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ATRIAL_FIBRILLATION'\n then 1\n else 0\n end\n )\n \n \n as atrial_fibrillation\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ATTENTION_DEFICIT_HYPERACTIVITY_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as attention_deficit_hyperactivity_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'BIPOLAR'\n then 1\n else 0\n end\n )\n \n \n as bipolar\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'BREAST_CANCER'\n then 1\n else 0\n end\n )\n \n \n as breast_cancer\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.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 cc.condition_column_name = 'COCAINE'\n then 1\n else 0\n end\n )\n \n \n as cocaine\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'COLORECTAL_CANCER'\n then 1\n else 0\n end\n )\n \n \n as colorectal_cancer\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'CROHNS_DISEASE'\n then 1\n else 0\n end\n )\n \n \n as crohns_disease\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'CYSTIC_FIBROSIS'\n then 1\n else 0\n end\n )\n \n \n as cystic_fibrosis\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'DEMENTIA'\n then 1\n else 0\n end\n )\n \n \n as dementia\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'DEPRESSION'\n then 1\n else 0\n end\n )\n \n \n as depression\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'HEART_FAILURE'\n then 1\n else 0\n end\n )\n \n \n as heart_failure\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.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 cc.condition_column_name = 'LUNG_CANCER'\n then 1\n else 0\n end\n )\n \n \n as lung_cancer\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'LUPUS'\n then 1\n else 0\n end\n )\n \n \n as lupus\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'METABOLIC_SYNDROME'\n then 1\n else 0\n end\n )\n \n \n as metabolic_syndrome\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'MULTIPLE_SCLEROSIS'\n then 1\n else 0\n end\n )\n \n \n as multiple_sclerosis\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.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 cc.condition_column_name = 'OBSESSIVE_COMPULSIVE_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as obsessive_compulsive_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'OPIOID'\n then 1\n else 0\n end\n )\n \n \n as opioid\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'PARKINSONS_DISEASE'\n then 1\n else 0\n end\n )\n \n \n as parkinsons_disease\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'PERSONALITY_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as personality_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'POST_TRAUMATIC_STRESS_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as post_traumatic_stress_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'RHEUMATOID_ARTHRITIS'\n then 1\n else 0\n end\n )\n \n \n as rheumatoid_arthritis\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'STROKE'\n then 1\n else 0\n end\n )\n \n \n as stroke\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'TOBACCO'\n then 1\n else 0\n end\n )\n \n \n as tobacco\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'TYPE_1_DIABETES'\n then 1\n else 0\n end\n )\n \n \n as type_1_diabetes\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'TYPE_2_DIABETES'\n then 1\n else 0\n end\n )\n \n \n as type_2_diabetes\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ULCERATIVE_COLITIS'\n then 1\n else 0\n end\n )\n \n \n as ulcerative_colitis\n \n \n \n \n\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom __dbt__cte__tuva_chronic_conditions__stg_core__patient p\n left join dev_sarah.chronic_conditions.tuva_chronic_conditions_long l\n on p.patient_id = l.patient_id\n left join condition_columns cc\n on l.condition = cc.condition\ngroup by\n p.patient_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient", "sql": " __dbt__cte__tuva_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}]}, "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": "5480b81efb388b47f7d122d3916336072eb751447b8e5f72fb35dd5f3c50a9eb"}, "config": {"enabled": true, "alias": "cms_chronic_conditions_long", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "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, "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, "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, "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, "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, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.3310568, "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)))\n )\n}}\n\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\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": [["chronic_conditions__cms_chronic_conditions_all"], ["chronic_conditions__cms_chronic_conditions_hiv_aids"], ["chronic_conditions__cms_chronic_conditions_oud"]], "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\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\nselect\n patient_id\n , claim_id\n , start_date\n , chronic_condition_type\n , condition_category\n , condition\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom conditions_unioned", "extra_ctes_injected": true, "extra_ctes": []}, "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": "a3837d2c0d39ae64d0f7b672e04c21444e53d1c6eed81327169977b0f1ef3034"}, "config": {"enabled": true, "alias": "_int_cms_chronic_condition_hiv_aids", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Other).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.339585, "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)))\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_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, 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\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": [["chronic_conditions__cms_chronic_conditions_hierarchy"], ["cms_chronic_conditions__stg_core__condition"], ["cms_chronic_conditions__stg_medical_claim"]], "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_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__cms_chronic_conditions__stg_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom tuva.input_layer.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_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, 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\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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim\n)"}]}, "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": "ec9c2f386fb92e3792534e624e8ff4dfc5e241ad8dd409f6f685e0e193600352"}, "config": {"enabled": true, "alias": "_int_cms_chronic_condition_oud", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Substance Abuse).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.343758, "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)))\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_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, 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\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": [["chronic_conditions__cms_chronic_conditions_hierarchy"], ["cms_chronic_conditions__stg_core__condition"], ["cms_chronic_conditions__stg_pharmacy_claim"], ["cms_chronic_conditions__stg_core__procedure"], ["chronic_conditions__cms_chronic_conditions_all"]], "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_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__cms_chronic_conditions__stg_pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom tuva.input_layer.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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\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_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, 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\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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom tuva.input_layer.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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "6c143e25459a2df431c6c4fa586a685b63c26f6d6c08632bc1d75b6a7f089d10"}, "config": {"enabled": true, "alias": "_int_cms_chronic_condition_all", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#2e0e0e"}, "bind": false, "post-hook": [], "pre-hook": []}, "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, "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "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, "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, "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Cardiovascular Disease).\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {}, "data_type": null, "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, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#2e0e0e"}, "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": "#2e0e0e"}}, "created_at": 1708545507.335228, "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)))\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_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, 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\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": [["chronic_conditions__cms_chronic_conditions_hierarchy"], ["cms_chronic_conditions__stg_core__condition"], ["cms_chronic_conditions__stg_medical_claim"], ["cms_chronic_conditions__stg_core__procedure"]], "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_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__cms_chronic_conditions__stg_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom tuva.input_layer.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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\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_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, 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\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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom tuva.input_layer.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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}]}, "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": "fd67aa459041a8d1f8b8b8c6cf9bb041b9e5405c2c28c70b54eacbc01926508b"}, "config": {"enabled": true, "alias": "admit_type", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"admit_type_code": "varchar", "admit_type_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "admit_type", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"admit_type_code": "varchar", "admit_type_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.7481441, "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": []}}, "seed.the_tuva_project.terminology__ssa_fips_state": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__ssa_fips_state", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ssa_fips_state.csv", "original_file_path": "seeds/terminology/terminology__ssa_fips_state.csv", "unique_id": "seed.the_tuva_project.terminology__ssa_fips_state", "fqn": ["the_tuva_project", "terminology", "terminology__ssa_fips_state"], "alias": "ssa_fips_state", "checksum": {"name": "sha256", "checksum": "b7a044865449a537d2f4289133d1356d001cc5198de9051a5cc090052b42eed4"}, "config": {"enabled": true, "alias": "ssa_fips_state", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"ssa_fips_state_code": "varchar", "ssa_fips_state_name": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "ssa_fips_state", "tags": "terminology", "column_types": {"ssa_fips_state_code": "varchar", "ssa_fips_state_name": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.852756, "relation_name": "dev_sarah.terminology.ssa_fips_state", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "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": "ff425893ec0ec8d7e3eb1911d3c979540d02a8853efa2af0676ccd9c954a50f4"}, "config": {"enabled": true, "alias": "medicare_orec", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"original_reason_entitlement_code": "varchar", "original_reason_entitlement_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "medicare_orec", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"original_reason_entitlement_code": "varchar", "original_reason_entitlement_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.849972, "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": []}}, "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": "49caad564a6d46cabcbbaa25857984aa1f7d4426ed5927989cdeddc1539d6fb6"}, "config": {"enabled": true, "alias": "gender", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "gender", "tags": ["terminology", "data_profiling"], "column_types": {"description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.7929978, "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": []}}, "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": "d23c1e3d7417d569bbb1e11cd0a493cfd60f60e231756adb2f7b6160ca2f93e6"}, "config": {"enabled": true, "alias": "ethnicity", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"code": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "ethnicity", "tags": "terminology", "column_types": {"code": "varchar", "description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.783819, "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": []}}, "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": "4f604ede8b4f04891a180b2a28d0591dd19c6f2213f31771cb12651b833bb587"}, "config": {"enabled": true, "alias": "ms_drg", "schema": "terminology", "database": null, "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"ms_drg_code": "varchar", "mdc_code": "varchar", "medical_surgical": "varchar", "ms_drg_description": "varchar", "deprecated": "integer", "deprecated_date": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "ms_drg", "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "column_types": {"ms_drg_code": "varchar", "mdc_code": "varchar", "medical_surgical": "varchar", "ms_drg_description": "varchar", "deprecated": "integer", "deprecated_date": "date"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.8607402, "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": []}}, "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": "6d630994900478a2efc0f63fa4045b387bd020cb519fac04ba16b32fb11a1647"}, "config": {"enabled": true, "alias": "revenue_center", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"revenue_center_code": "varchar", "revenue_center_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "revenue_center", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"revenue_center_code": "varchar", "revenue_center_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.892503, "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": []}}, "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": "path", "checksum": "seeds/terminology/terminology__icd_9_cm.csv"}, "config": {"enabled": true, "alias": "icd_9_cm", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_9_cm": "varchar", "long_description": "varchar", "short_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "icd_9_cm", "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "column_types": {"icd_9_cm": "varchar", "long_description": "varchar", "short_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.811894, "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": []}}, "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": "b4c3900253da42bc9d2a2333c8d774e3c0aa2402af6a4493c268d551779e1daa"}, "config": {"enabled": true, "alias": "race", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"race_code": "varchar", "race_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "race", "tags": ["terminology", "data_profiling"], "column_types": {"race_code": "varchar", "race_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.889339, "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": []}}, "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": "0c22d1d9c1cb2f26fb0a1f860a412abbc5a6f6946c473083651f4bf38bac73ca"}, "config": {"enabled": true, "alias": "rxnorm_to_atc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"rxcui": "varchar", "rxnorm_description": "varchar(3000)", "atc_1_name": "varchar", "atc_2_name": "varchar", "atc_3_name": "varchar", "atc_4_name": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/terminology','rxnorm_to_atc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "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": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','rxnorm_to_atc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "rxnorm_to_atc", "tags": ["terminology"], "column_types": {"rxcui": "varchar", "rxnorm_description": "varchar(3000)", "atc_1_name": "varchar", "atc_2_name": "varchar", "atc_3_name": "varchar", "atc_4_name": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.760074, "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": "2bd1a8a081fceb69bf91287c8a56c370ea1544a1fbbe12829566955012c04c97"}, "config": {"enabled": true, "alias": "medicare_status", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"medicare_status_code": "varchar", "medicare_status_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "medicare_status", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"medicare_status_code": "varchar", "medicare_status_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.856272, "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": []}}, "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": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"loinc": "varchar", "map_to": "varchar", "comment": "varchar", "final_map_to": "varchar", "all_comments": "varchar", "depth": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "columns": [{"name": "loinc", "description": "The deprecated term to which the replacement term(s) apply."}, {"name": "map_to", "description": "A replacement term that is to be used in place of the deprecated or discouraged term."}, {"name": "comment", "description": "Narrative text that explains the rational for using the recommended replacement term."}, {"name": "final_map_to", "description": "If there are multiple steps of deprecated codes, this is the final (active) code"}, {"name": "all_comments", "description": "An aggregation of comments for any mapping steps between the deprecated code and the active code"}, {"name": "depth", "description": "How many steps this mapping is to the active code"}], "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/terminology','loinc_deprecated_mapping.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','loinc_deprecated_mapping.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "loinc_deprecated_mapping", "tags": ["terminology"], "columns": [{"name": "loinc", "description": "The deprecated term to which the replacement term(s) apply."}, {"name": "map_to", "description": "A replacement term that is to be used in place of the deprecated or discouraged term."}, {"name": "comment", "description": "Narrative text that explains the rational for using the recommended replacement term."}, {"name": "final_map_to", "description": "If there are multiple steps of deprecated codes, this is the final (active) code"}, {"name": "all_comments", "description": "An aggregation of comments for any mapping steps between the deprecated code and the active code"}, {"name": "depth", "description": "How many steps this mapping is to the active code"}], "column_types": {"loinc": "varchar", "map_to": "varchar", "comment": "varchar", "final_map_to": "varchar", "all_comments": "varchar", "depth": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.840014, "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": "760955a3ad21bd2c8f4257881e8f713276eda10623bb05f373634ff186ea8592"}, "config": {"enabled": true, "alias": "place_of_service", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"place_of_service_code": "varchar", "place_of_service_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "place_of_service", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"place_of_service_code": "varchar", "place_of_service_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.8722088, "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": []}}, "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": "15c1af0306238509e41a88152b1ac9dc683776d790531da941c9cac40430ce05"}, "config": {"enabled": true, "alias": "discharge_disposition", "schema": "terminology", "database": null, "tags": [], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"discharge_disposition_code": "varchar", "discharge_disposition_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "discharge_disposition", "column_types": {"discharge_disposition_code": "varchar", "discharge_disposition_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.778369, "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": []}}, "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": "dc97df38ffbff5dddcd6e0160d41f76c3d29b7d740b583faaac1a5de86698fab"}, "config": {"enabled": true, "alias": "icd_9_pcs", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_9_pcs": "varchar", "long_description": "varchar", "short_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "icd_9_pcs", "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "column_types": {"icd_9_pcs": "varchar", "long_description": "varchar", "short_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.815557, "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": []}}, "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": "4a0669b7aed638378b8cde6a1e4d0202071923c695ecba93cf266d7c1b206d8e"}, "config": {"enabled": true, "alias": "present_on_admission", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"present_on_admit_code": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "present_on_admission", "tags": ["terminology", "data_profiling", "claims_preprocessing"], "column_types": {"present_on_admit_code": "varchar", "description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.875222, "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": []}}, "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": "b19311ec103fd48ea11a228d065b646f52fde1292a42ca3feb6fb2884eb00522"}, "config": {"enabled": true, "alias": "mdc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"mdc_code": "varchar", "mcd_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "mdc", "tags": "terminology", "column_types": {"mdc_code": "varchar", "mcd_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.843542, "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": []}}, "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": "392e0c1935973dbea2e96030db856a8ccfa660cbd51f45c92d51d121aa432a8b"}, "config": {"enabled": true, "alias": "admit_source", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"admit_source_code": "varchar", "admit_source_description": "varchar", "newborn_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "admit_source", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"admit_source_code": "varchar", "admit_source_description": "varchar", "newborn_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.745013, "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": []}}, "seed.the_tuva_project.terminology__calendar": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__calendar", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__calendar.csv", "original_file_path": "seeds/terminology/terminology__calendar.csv", "unique_id": "seed.the_tuva_project.terminology__calendar", "fqn": ["the_tuva_project", "terminology", "terminology__calendar"], "alias": "calendar", "checksum": {"name": "sha256", "checksum": "c81e72363dd6699bc5bf3f6b3699e3613992b33cea3b02dc292033740f03b697"}, "config": {"enabled": true, "alias": "calendar", "schema": "terminology", "database": null, "tags": ["terminology", "pmpm"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"full_date": "date", "year": "integer", "month": "integer", "day": "integer", "month_name": "varchar", "day_of_week_number": "integer", "day_of_week_name": "varchar", "week_of_year": "integer", "day_of_year": "integer", "year_month": "varchar", "first_day_of_month": "date", "last_day_of_month": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/terminology','calendar.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["terminology", "pmpm"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','calendar.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "calendar", "tags": ["terminology", "pmpm"], "column_types": {"full_date": "date", "year": "integer", "month": "integer", "day": "integer", "month_name": "varchar", "day_of_week_number": "integer", "day_of_week_name": "varchar", "week_of_year": "integer", "day_of_year": "integer", "year_month": "varchar", "first_day_of_month": "date", "last_day_of_month": "date"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.770166, "relation_name": "dev_sarah.terminology.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.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": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "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", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/provider_data','other_provider_taxonomy.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/provider_data','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": "#460d4f"}}, "created_at": 1708545505.866681, "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": "08903dd5b951cfdd2dc1e2d92406571ab08c2fa401c2f951a6190b38af1dbf61"}, "config": {"enabled": true, "alias": "icd_10_cm", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_10_cm": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/terminology','icd_10_cm.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','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", "description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.8027039, "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": "da35be4c432144ba8003d5ef8f2d815d8afce6ed215d6aa065e305ad11f7552c"}, "config": {"enabled": true, "alias": "claim_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"claim_type_code": "varchar", "claim_type_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "claim_type", "tags": ["terminology", "data_profiling"], "column_types": {"claim_type_code": "varchar", "claim_type_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.7732391, "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": []}}, "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": "path", "checksum": "seeds/terminology/terminology__hcpcs_level_2.csv"}, "config": {"enabled": true, "alias": "hcpcs_level_2", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"hcpcs": "varchar", "seqnum": "varchar", "recid": "varchar", "long_description": "varchar(2000)", "short_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "hcpcs_level_2", "tags": "terminology", "column_types": {"hcpcs": "varchar", "seqnum": "varchar", "recid": "varchar", "long_description": "varchar(2000)", "short_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.797179, "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": []}}, "seed.the_tuva_project.terminology__fips_county": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__fips_county", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__fips_county.csv", "original_file_path": "seeds/terminology/terminology__fips_county.csv", "unique_id": "seed.the_tuva_project.terminology__fips_county", "fqn": ["the_tuva_project", "terminology", "terminology__fips_county"], "alias": "fips_county", "checksum": {"name": "sha256", "checksum": "51c80da82ec1f20665fbd65379796c53f724781fa3833396cba093c89004bfb5"}, "config": {"enabled": true, "alias": "fips_county", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"fips_code": "varchar", "county": "varchar", "state": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "fips_county", "tags": "terminology", "column_types": {"fips_code": "varchar", "county": "varchar", "state": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.787192, "relation_name": "dev_sarah.terminology.fips_county", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "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": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"ndc": "varchar", "rxcui": "varchar", "rxnorm_description": "varchar(3000)", "fda_description": "varchar(3000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/terminology','ndc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "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": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','ndc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ndc", "tags": ["terminology"], "column_types": {"ndc": "varchar", "rxcui": "varchar", "rxnorm_description": "varchar(3000)", "fda_description": "varchar(3000)"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.753643, "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__ansi_fips_state": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__ansi_fips_state", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ansi_fips_state.csv", "original_file_path": "seeds/terminology/terminology__ansi_fips_state.csv", "unique_id": "seed.the_tuva_project.terminology__ansi_fips_state", "fqn": ["the_tuva_project", "terminology", "terminology__ansi_fips_state"], "alias": "ansi_fips_state", "checksum": {"name": "sha256", "checksum": "188188b26f055c7e4d3a36d9d6b4bf1673842a691ba07cf1cfa9cacb0507b7de"}, "config": {"enabled": true, "alias": "ansi_fips_state", "schema": "terminology", "database": null, "tags": ["terminology", "medicare_cclf_connector"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"ansi_fips_state_code": "varchar", "ansi_fips_state_abbreviation": "varchar", "ansi_fips_state_name": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "medicare_cclf_connector"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "ansi_fips_state", "tags": ["terminology", "medicare_cclf_connector"], "column_types": {"ansi_fips_state_code": "varchar", "ansi_fips_state_abbreviation": "varchar", "ansi_fips_state_name": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.790611, "relation_name": "dev_sarah.terminology.ansi_fips_state", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "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": "d75ee477d89a9d8d679a9fcc64ce29975b9fe6eea1ad094d2e60d62e5b011c3c"}, "config": {"enabled": true, "alias": "encounter_type", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "encounter_type", "tags": ["terminology", "claims_preprocessing"], "column_types": {"description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.7808309, "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": []}}, "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": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "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", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/provider_data','provider.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/provider_data','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": "#460d4f"}}, "created_at": 1708545505.886231, "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": "74352b381c969e38fbc490a236b9bc0c1568e2eea0aefc3c0cd16e910afde78b"}, "config": {"enabled": true, "alias": "payer_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"payer_type": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "payer_type", "tags": ["terminology", "data_profiling"], "column_types": {"payer_type": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.869146, "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": []}}, "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": "4458f5fe5df95b8291d6a0ccc4023cd7e567cca527aa56c7fb1b62c3a88d6c23"}, "config": {"enabled": true, "alias": "apr_drg", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"apr_drg_code": "varchar", "severity": "varchar", "apr_drg_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "apr_drg", "tags": ["terminology", "data_profiling"], "column_types": {"apr_drg_code": "varchar", "severity": "varchar", "apr_drg_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.895881, "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": []}}, "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": "a9b6e92f3a466f9a20d9fc7bc43bcec893a6f5139d9c8a93f7d4c40ffb48f289"}, "config": {"enabled": true, "alias": "icd_10_pcs", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_10_pcs": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/terminology','icd_10_pcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','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", "description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.8076532, "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__code_type": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__code_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__code_type.csv", "original_file_path": "seeds/terminology/terminology__code_type.csv", "unique_id": "seed.the_tuva_project.terminology__code_type", "fqn": ["the_tuva_project", "terminology", "terminology__code_type"], "alias": "code_type", "checksum": {"name": "sha256", "checksum": "5fe9aa562e036ca6f98866fe29d85c1f2351f53d00fdde631ad8dce183ce5788"}, "config": {"enabled": true, "alias": "code_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "code_type", "tags": ["terminology", "data_profiling"], "column_types": {"description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.775689, "relation_name": "dev_sarah.terminology.code_type", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "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": "e7fbf770fe2201cc1c256fa1dfd04d9edb053a34a9409293a0e76f0efcadbe97"}, "config": {"enabled": true, "alias": "medicare_dual_eligibility", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"dual_status_code": "varchar", "dual_status_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "medicare_dual_eligibility", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"dual_status_code": "varchar", "dual_status_description": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.846663, "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": []}}, "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": "8b363106ed8e54488d71b8f4ccfca6e371692e836ef77b335621df6bf63b9a8a"}, "config": {"enabled": true, "alias": "bill_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"bill_type_code": "varchar", "bill_type_description": "varchar", "deprecated": "integer", "deprecated_date": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["terminology", "data_profiling"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "terminology", "alias": "bill_type", "tags": ["terminology", "data_profiling"], "column_types": {"bill_type_code": "varchar", "bill_type_description": "varchar", "deprecated": "integer", "deprecated_date": "date"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.7634418, "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": []}}, "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": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"loinc": "varchar", "short_name": "varchar", "long_common_name": "varchar", "component": "varchar", "property": "varchar", "time_aspect": "varchar", "system": "varchar", "scale_type": "varchar", "method_type": "varchar", "class_code": "varchar", "class_description": "varchar", "class_type_code": "varchar", "class_type_description": "varchar", "external_copyright_notice": "varchar(3000)", "status": "varchar", "version_first_released": "varchar", "version_last_changed": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "columns": [{"name": "loinc", "description": "The LOINC code"}, {"name": "short_name", "description": "If exists, the short human readable version of the LOINC description"}, {"name": "long_common_name", "description": "Clinician-friendly full loinc description"}, {"name": "component", "description": "The substance or entity being measured or observed. Also called the Analyte. The first of six loinc parts."}, {"name": "property", "description": "The characteristic or attribute of the analyte. The second of six loinc parts."}, {"name": "time_aspect", "description": "The interval of time over which an observation was made. The third of six loinc parts."}, {"name": "system", "description": "The thing upon which the observation was made. Also called specimen for laboratory tests. The fourth of six loinc parts."}, {"name": "scale_type", "description": "How the observation value is quantified or expressed (e.g. quantitative, ordinal, nominal, etc). The fifth of six loinc parts."}, {"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."}, {"name": "class_code", "description": "A code representing the general category of the loinc term"}, {"name": "class_description", "description": "The general category of the LOINC term"}, {"name": "class_type_code", "description": "A code representing the top level category for the test"}, {"name": "class_type_description", "description": "The top level category for the test; Laboratory, Clincal, Claims attachments, or Surveys"}, {"name": "external_copyright_notice", "description": "External copyright holders copyright notice for this LOINC code"}, {"name": "status", "description": "The status of the LOINC code concept. Active, Trial (experimental), Discouraged (not recommended), or Deprecated (should not be used)"}, {"name": "version_first_released", "description": "The first release version of LOINC that included this code"}, {"name": "version_last_changed", "description": "The last LOINC version in which this record was changed"}], "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/terminology','loinc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','loinc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "loinc", "tags": ["terminology"], "columns": [{"name": "loinc", "description": "The LOINC code"}, {"name": "short_name", "description": "If exists, the short human readable version of the LOINC description"}, {"name": "long_common_name", "description": "Clinician-friendly full loinc description"}, {"name": "component", "description": "The substance or entity being measured or observed. Also called the Analyte. The first of six loinc parts."}, {"name": "property", "description": "The characteristic or attribute of the analyte. The second of six loinc parts."}, {"name": "time_aspect", "description": "The interval of time over which an observation was made. The third of six loinc parts."}, {"name": "system", "description": "The thing upon which the observation was made. Also called specimen for laboratory tests. The fourth of six loinc parts."}, {"name": "scale_type", "description": "How the observation value is quantified or expressed (e.g. quantitative, ordinal, nominal, etc). The fifth of six loinc parts."}, {"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."}, {"name": "class_code", "description": "A code representing the general category of the loinc term"}, {"name": "class_description", "description": "The general category of the LOINC term"}, {"name": "class_type_code", "description": "A code representing the top level category for the test"}, {"name": "class_type_description", "description": "The top level category for the test; Laboratory, Clincal, Claims attachments, or Surveys"}, {"name": "external_copyright_notice", "description": "External copyright holders copyright notice for this LOINC code"}, {"name": "status", "description": "The status of the LOINC code concept. Active, Trial (experimental), Discouraged (not recommended), or Deprecated (should not be used)"}, {"name": "version_first_released", "description": "The first release version of LOINC that included this code"}, {"name": "version_last_changed", "description": "The last LOINC version in which this record was changed"}], "column_types": {"loinc": "varchar", "short_name": "varchar", "long_common_name": "varchar", "component": "varchar", "property": "varchar", "time_aspect": "varchar", "system": "varchar", "scale_type": "varchar", "method_type": "varchar", "class_code": "varchar", "class_description": "varchar", "class_type_code": "varchar", "class_type_description": "varchar", "external_copyright_notice": "varchar(3000)", "status": "varchar", "version_first_released": "varchar", "version_last_changed": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.831852, "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": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"id": "varchar", "effective_time": "varchar", "active": "varchar", "module_id": "varchar", "ref_set_id": "varchar", "referenced_component_id": "varchar", "referenced_component_name": "varchar", "map_group": "varchar", "map_priority": "varchar", "map_rule": "varchar(500)", "map_advice": "varchar(500)", "map_target": "varchar", "map_target_name": "varchar", "correlation_id": "varchar", "map_category_id": "varchar", "map_category_name": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#460d4f"}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/terminology','snomed_icd_10_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["terminology", "hcc_suspecting"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#460d4f"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/terminology','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", "effective_time": "varchar", "active": "varchar", "module_id": "varchar", "ref_set_id": "varchar", "referenced_component_id": "varchar", "referenced_component_name": "varchar", "map_group": "varchar", "map_priority": "varchar", "map_rule": "varchar(500)", "map_advice": "varchar(500)", "map_target": "varchar", "map_target_name": "varchar", "correlation_id": "varchar", "map_category_id": "varchar", "map_category_name": "varchar"}, "docs": {"node_color": "#460d4f"}}, "created_at": 1708545505.90691, "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.data_quality__test_catalog": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__test_catalog", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__test_catalog.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__test_catalog.csv", "unique_id": "seed.the_tuva_project.data_quality__test_catalog", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__test_catalog"], "alias": "_value_set_test_catalog", "checksum": {"name": "sha256", "checksum": "63c9ad90d1b51717e4fc9693198e43228e6e950c7a89097fa57c6d88c9818662"}, "config": {"enabled": true, "alias": "_value_set_test_catalog", "schema": "data_quality", "database": null, "tags": ["data_quality", "claims_preprocessing"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"source_table": "varchar", "test_category": "varchar", "test_name": "varchar", "test_field": "varchar", "claim_type": "varchar", "pipeline_test": "integer"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#141161"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["data_quality", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#141161"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "_value_set_test_catalog", "tags": ["data_quality", "claims_preprocessing"], "enabled": true, "column_types": {"source_table": "varchar", "test_category": "varchar", "test_name": "varchar", "test_field": "varchar", "claim_type": "varchar", "pipeline_test": "integer"}, "docs": {"node_color": "#141161"}}, "created_at": 1708545505.91178, "relation_name": "dev_sarah.data_quality._value_set_test_catalog", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "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": "_value_set_service_categories", "checksum": {"name": "sha256", "checksum": "8e26537c0e32a9a8dc6e9ed587f9fde623955d8c981a6c832527ae3988587143"}, "config": {"enabled": true, "alias": "_value_set_service_categories", "schema": "claims_preprocessing", "database": null, "tags": ["service_category", "claims_preprocessing"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["service_category", "claims_preprocessing"], "description": "List of service categories and sub-categories", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/service_categories/service_categories_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_value_set_service_categories", "tags": ["service_category", "claims_preprocessing"], "enabled": true}, "created_at": 1708545505.9144151, "relation_name": "dev_sarah.claims_preprocessing._value_set_service_categories", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "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": "761355cb2e9e5ced2d46e98ff354ba8e0f93efa08ed67fc366ac1078368d4da7"}, "config": {"enabled": true, "alias": "_value_set_johnston_icd9", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd9": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["ed_classification"], "description": "A probabilistic mapping of icd9 codes to ed classification categories", "columns": {"icd9": {"name": "icd9", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "edcnnpa": {"name": "edcnnpa", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "edcnpa": {"name": "edcnpa", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "epct": {"name": "epct", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "noner": {"name": "noner", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "injury": {"name": "injury", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "psych": {"name": "psych", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "alcohol": {"name": "alcohol", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "drug": {"name": "drug", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "alias": "_value_set_johnston_icd9", "tags": "ed_classification", "enabled": true, "column_types": {"icd9": "varchar"}}, "created_at": 1708545505.9289029, "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": []}}, "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": "2179b7310d7d12968dab5eed9efabf25e3a272c2e444e772e6c225b520c24236"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_to_ccs", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_10_cm": "varchar", "description": "varchar", "ccs_diagnosis_category": "varchar", "ccs_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/value-sets','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["ed_classification"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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/value-sets','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", "column_types": {"icd_10_cm": "varchar", "description": "varchar", "ccs_diagnosis_category": "varchar", "ccs_description": "varchar"}, "enabled": true}, "created_at": 1708545505.924285, "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": "path", "checksum": "seeds/value_sets/ed_classification/ed_classification__johnston_icd10.csv"}, "config": {"enabled": true, "alias": "_value_set_johnston_icd10", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd10": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["ed_classification"], "description": "A probabilistic mapping of icd9 codes to ed classification categories", "columns": {"icd10": {"name": "icd10", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "edcnnpa": {"name": "edcnnpa", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "edcnpa": {"name": "edcnpa", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "epct": {"name": "epct", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "noner": {"name": "noner", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "injury": {"name": "injury", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "psych": {"name": "psych", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "alcohol": {"name": "alcohol", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "drug": {"name": "drug", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "alias": "_value_set_johnston_icd10", "tags": "ed_classification", "enabled": true, "column_types": {"icd10": "varchar"}}, "created_at": 1708545505.9333482, "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": []}}, "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": "c66c612a2c9e77348a2ed2d58ec2271fe106ac932f6ae8b3fe918720c03b2795"}, "config": {"enabled": true, "alias": "_value_set_categories", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["ed_classification"], "description": "A mapping of ED Classifications to human readable names", "columns": {"classification": {"name": "classification", "description": "code for classification", "meta": {}, "data_type": null, "quote": null, "tags": []}, "classification_name": {"name": "classification_name", "description": "human readable name for classification", "meta": {}, "data_type": null, "quote": null, "tags": []}, "classification_order": {"name": "classification_order", "description": "Sortable column that organizes the ED classes", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "alias": "_value_set_categories", "tags": "ed_classification", "enabled": true}, "created_at": 1708545505.91797, "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": []}}, "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": "7b9db975327ccef9eb004256f6dac2d16248422f0c189d1c79b19826f793afd5"}, "config": {"enabled": true, "alias": "_value_set_potentially_planned_ccs_procedure_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"ccs_procedure_category": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_potentially_planned_ccs_procedure_category", "tags": "readmissions", "column_types": {"ccs_procedure_category": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.983982, "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": []}}, "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": "4f60ea7457c3c868df672eed94da01a1ca7d25d551f230734a44dea070b258fe"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_to_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_10_cm": "varchar", "description": "varchar", "ccs_diagnosis_category": "varchar", "ccs_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/value-sets','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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/value-sets','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_icd_10_cm_to_ccs", "tags": "readmissions", "column_types": {"icd_10_cm": "varchar", "description": "varchar", "ccs_diagnosis_category": "varchar", "ccs_description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.9738991, "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": "d3b577c57486f9fa6d12cd8b7da4c54d8f2f6996d19d35ca169e5861f12c031f"}, "config": {"enabled": true, "alias": "_value_set_potentially_planned_icd_10_pcs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_10_pcs": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_potentially_planned_icd_10_pcs", "tags": "readmissions", "column_types": {"icd_10_pcs": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.9872608, "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": []}}, "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": "654779d4a8e08465f9037d8e544b7a4c96053a6daefaa6d7fe56496b31ef25e4"}, "config": {"enabled": true, "alias": "_value_set_acute_diagnosis_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_acute_diagnosis_ccs", "tags": "readmissions", "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.948916, "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": []}}, "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": "f4c090fe63477ea354c6a36dd54816fe76cdead723bbb39aeeba640a319c6d8d"}, "config": {"enabled": true, "alias": "_value_set_specialty_cohort", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"ccs": "varchar", "description": "varchar", "specialty_cohort": "varchar", "procedure_or_diagnosis": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_specialty_cohort", "tags": "readmissions", "column_types": {"ccs": "varchar", "description": "varchar", "specialty_cohort": "varchar", "procedure_or_diagnosis": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.99141, "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": []}}, "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": "4bacd904ef0767100c7371e367970c9b25139aae994d3b020ceee61a7aa1e0a7"}, "config": {"enabled": true, "alias": "_value_set_exclusion_ccs_diagnosis_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar", "exclusion_category": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_exclusion_ccs_diagnosis_category", "tags": "readmissions", "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar", "exclusion_category": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.967339, "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": []}}, "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": "path", "checksum": "seeds/value_sets/readmissions/readmissions__acute_diagnosis_icd_10_cm.csv"}, "config": {"enabled": true, "alias": "_value_set_acute_diagnosis_icd_10_cm", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_10_cm": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_acute_diagnosis_icd_10_cm", "tags": "readmissions", "column_types": {"icd_10_cm": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.952228, "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": []}}, "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": "aebcfa4c5a82d3af091d8d223b26ca9349da581228f32f0d59a7754343199a58"}, "config": {"enabled": true, "alias": "_value_set_surgery_gynecology_cohort", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_10_pcs": "varchar", "description": "varchar", "ccs_code_and_description": "varchar", "specialty_cohort": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_surgery_gynecology_cohort", "tags": "readmissions", "column_types": {"icd_10_pcs": "varchar", "description": "varchar", "ccs_code_and_description": "varchar", "specialty_cohort": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.995469, "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": []}}, "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": "af9918830532c9dd37924853c29502d8c9f14bbb1a380de74cfcc740b0ba48b7"}, "config": {"enabled": true, "alias": "_value_set_always_planned_ccs_procedure_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"ccs_procedure_category": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_always_planned_ccs_procedure_category", "tags": "readmissions", "column_types": {"ccs_procedure_category": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.9611368, "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": []}}, "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": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_10_pcs": "varchar", "description": "varchar", "ccs_procedure_category": "varchar", "ccs_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/value-sets','icd_10_pcs_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "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/value-sets','icd_10_pcs_to_ccs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_icd_10_pcs_to_ccs", "tags": "readmissions", "column_types": {"icd_10_pcs": "varchar", "description": "varchar", "ccs_procedure_category": "varchar", "ccs_description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.980423, "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": "3ec5bc59c274f64708e2b16e9eff3db72230522289dd3f21567956d2070b3be2"}, "config": {"enabled": true, "alias": "_value_set_always_planned_ccs_diagnosis_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#161a7d"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#161a7d"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_value_set_always_planned_ccs_diagnosis_category", "tags": "readmissions", "column_types": {"ccs_diagnosis_category": "varchar", "description": "varchar"}, "enabled": true, "docs": {"node_color": "#161a7d"}}, "created_at": 1708545505.9556952, "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": []}}, "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": "f1fa62cd3a233f13f980da6bb35cb01a0bc20dcd817c0c7cbb600cb3ca6f21df"}, "config": {"enabled": true, "alias": "_value_set_disabled_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"hcc_code": "varchar", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "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": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_disabled_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"hcc_code": "varchar", "coefficient": "float"}}, "created_at": 1708545506.0075462, "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": []}}, "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": "aa684c0c1fd853f779a92c34557bb314cbca812b39bb80d9f0844244cf2d3cdb"}, "config": {"enabled": true, "alias": "_value_set_disease_hierarchy", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"hcc_code": "varchar", "hccs_to_exclude": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["cms_hcc"], "description": "Disease hierarchies by model version. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_disease_hierarchy", "tags": "cms_hcc", "enabled": true, "column_types": {"hcc_code": "varchar", "hccs_to_exclude": "varchar"}}, "created_at": 1708545506.01388, "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": []}}, "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": "path", "checksum": "seeds/value_sets/cms_hcc/cms_hcc__icd_10_cm_mappings.csv"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_mappings", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"payment_year": "integer", "diagnosis_code": "varchar", "cms_hcc_v24": "varchar", "cms_hcc_v24_flag": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "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": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_icd_10_cm_mappings", "tags": "cms_hcc", "enabled": true, "column_types": {"payment_year": "integer", "diagnosis_code": "varchar", "cms_hcc_v24": "varchar", "cms_hcc_v24_flag": "varchar"}}, "created_at": 1708545506.0234501, "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": []}}, "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": "86f87019959c2d247a4332b5322dade51fbf4dba566afdd05113f419e2530a1e"}, "config": {"enabled": true, "alias": "_value_set_disease_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"hcc_code": "varchar", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["cms_hcc"], "description": "Disease factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_disease_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"hcc_code": "varchar", "coefficient": "float"}}, "created_at": 1708545506.0105999, "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": []}}, "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": "39f200d1fb78e90a00c40d0648550ebf8ff39226ea4fc49466c7fef5906957e0"}, "config": {"enabled": true, "alias": "_value_set_disease_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"hcc_code_1": "varchar", "hcc_code_2": "varchar", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["cms_hcc"], "description": "Disease interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_disease_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"hcc_code_1": "varchar", "hcc_code_2": "varchar", "coefficient": "float"}}, "created_at": 1708545506.0170932, "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": []}}, "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": "8bfc9383a75a38f1fc1ce3b9090eb17f32a2189ef0e758d8bd4e9efe4b527a65"}, "config": {"enabled": true, "alias": "_value_set_cpt_hcpcs", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"payment_year": "integer", "hcpcs_cpt_code": "varchar", "included_flag": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "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": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_cpt_hcpcs", "tags": "cms_hcc", "enabled": true, "column_types": {"payment_year": "integer", "hcpcs_cpt_code": "varchar", "included_flag": "varchar"}}, "created_at": 1708545506.001987, "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": []}}, "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": "b04e9b46c651f17c76c76a61ae62c2502fd13bc48bc3841e64f1b42f53c98369"}, "config": {"enabled": true, "alias": "_value_set_adjustment_rates", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["cms_hcc"], "description": "Adjustment rates by payment year. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_adjustment_rates", "tags": "cms_hcc", "enabled": true, "column_types": {"coefficient": "float"}}, "created_at": 1708545505.9984949, "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": []}}, "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": "65cdffd158fbb68d3f5660c1d04fcc178210ad4ae7d481d407bce8eda245c9e6"}, "config": {"enabled": true, "alias": "_value_set_enrollment_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["cms_hcc"], "description": "Enrollment interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_enrollment_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"coefficient": "float"}}, "created_at": 1708545506.019671, "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": []}}, "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": "ea1080598a705aeaeb5d2dec5dfb70915b9e890b169847cfd3e7a04d53a8391a"}, "config": {"enabled": true, "alias": "_value_set_payment_hcc_count_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["cms_hcc"], "description": "Payment HCC count factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_payment_hcc_count_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"coefficient": "float"}}, "created_at": 1708545506.02645, "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": []}}, "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": "0548d96979eb37e9677eaf24e02fada20ac6e65f1cbf7b57e216eb2a018eaaec"}, "config": {"enabled": true, "alias": "_value_set_demographic_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["cms_hcc"], "description": "Demographic factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_value_set_demographic_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"coefficient": "float"}}, "created_at": 1708545506.004479, "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": []}}, "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": "886cc094211d3f1d3d4b6ff54c59248a752e3e310d17601020472c96931d2047"}, "config": {"enabled": true, "alias": "_value_set_codes", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"code": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Concepts to value sets crosswalk. List of codes in each concept.", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_value_set_codes", "tags": "quality_measures", "enabled": true, "column_types": {"code": "varchar"}}, "created_at": 1708545506.03393, "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": []}}, "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": "a32fa4f488413f8e559133169f40590e9c05a09e5938dc6cd1d0616ac3b369ed"}, "config": {"enabled": true, "alias": "_value_set_measures", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Overview of reporting measures.", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_value_set_measures", "tags": "quality_measures", "enabled": true}, "created_at": 1708545506.028775, "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": []}}, "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": "904e6b8ba350df271b016029b8678642ce6bbfa9604dfc70c2dfdeae50f4e12e"}, "config": {"enabled": true, "alias": "_value_set_concepts", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "Measures to concepts crosswalk. List of concepts used in each reporting measure.", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_value_set_concepts", "tags": "quality_measures", "enabled": true}, "created_at": 1708545506.031105, "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": []}}, "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": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_10_cm_code": "varchar", "icd_10_cm_code_description": "varchar", "default_ccsr_category_ip": "varchar", "default_ccsr_category_description_ip": "varchar", "default_ccsr_category_op": "varchar", "default_ccsr_category_description_op": "varchar", "ccsr_category_1": "varchar", "ccsr_category_1_description": "varchar", "ccsr_category_2": "varchar", "ccsr_category_2_description": "varchar", "ccsr_category_3": "varchar", "ccsr_category_3_description": "varchar", "ccsr_category_4": "varchar", "ccsr_category_4_description": "varchar", "ccsr_category_5": "varchar", "ccsr_category_5_description": "varchar", "ccsr_category_6": "varchar", "ccsr_category_6_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/value-sets','dxccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["ccsr"], "description": "A table containing the CSV mapping file included with the DXCCSR SAS program. The original CSV was not natively seedable, and the file was transformed with the coded included in the README. For each ICD-10-CM code, the table contains up to six CCSR category codes and a default CCSR category code.", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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/value-sets','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", "icd_10_cm_code_description": "varchar", "default_ccsr_category_ip": "varchar", "default_ccsr_category_description_ip": "varchar", "default_ccsr_category_op": "varchar", "default_ccsr_category_description_op": "varchar", "ccsr_category_1": "varchar", "ccsr_category_1_description": "varchar", "ccsr_category_2": "varchar", "ccsr_category_2_description": "varchar", "ccsr_category_3": "varchar", "ccsr_category_3_description": "varchar", "ccsr_category_4": "varchar", "ccsr_category_4_description": "varchar", "ccsr_category_5": "varchar", "ccsr_category_5_description": "varchar", "ccsr_category_6": "varchar", "ccsr_category_6_description": "varchar"}}, "created_at": 1708545506.046025, "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": "88f9e9588fa30ba312478b9dc9fab7c5e3530525e083539a604d559acd800dae"}, "config": {"enabled": true, "alias": "_value_set_prccsr_v2023_1_cleaned_map", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"icd_10_pcs": "varchar", "icd_10_pcs_description": "varchar", "prccsr": "varchar", "prccsr_description": "varchar", "clinical_domain": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/value-sets','prccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": []}, "tags": ["ccsr"], "description": "A table containing the CSV mapping file included with the PRCCSR SAS program. The original CSV was not natively seedable, and the file was transformed with the coded included in the README.", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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/value-sets','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", "icd_10_pcs_description": "varchar", "prccsr": "varchar", "prccsr_description": "varchar", "clinical_domain": "varchar"}}, "created_at": 1708545506.052483, "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": "dd8b64d00c38d7a99174fa8d2b6b82f2eae2b039e7ef0cd00da36d3233d6b326"}, "config": {"enabled": true, "alias": "_value_set_dxccsr_v2023_1_body_systems", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["ccsr"], "description": "A table containing descriptions of the top level categories used in the CCSR condition mapper.\nThis was manually exctracted from the User Guide PDF included with the DXCCSR SAS program.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/ccsr/ccsr_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ccsr", "alias": "_value_set_dxccsr_v2023_1_body_systems", "tags": ["ccsr"], "enabled": true}, "created_at": 1708545506.054952, "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": []}}, "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": "a1437c89f125f1d1ce46b34463c680ffd0b115f825920fa48af0001777d7bcbb"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_mappings", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"diagnosis_code": "varchar", "cms_hcc_esrd_v21": "varchar", "cms_hcc_esrd_v24": "varchar", "cms_hcc_v22": "varchar", "cms_hcc_v24": "varchar", "cms_hcc_v28": "varchar", "rx_hcc_v05": "varchar", "rx_hcc_v08": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "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": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/hcc_suspecting/hcc_suspecting_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_value_set_icd_10_cm_mappings", "tags": "hcc_suspecting", "enabled": true, "column_types": {"diagnosis_code": "varchar", "cms_hcc_esrd_v21": "varchar", "cms_hcc_esrd_v24": "varchar", "cms_hcc_v22": "varchar", "cms_hcc_v24": "varchar", "cms_hcc_v28": "varchar", "rx_hcc_v05": "varchar", "rx_hcc_v08": "varchar"}}, "created_at": 1708545506.0646, "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": []}}, "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": "97e91a43a05c049e748292586795c3f7fbd85d070125e7d3bbd895b58774d42f"}, "config": {"enabled": true, "alias": "_value_set_hcc_descriptions", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {"hcc_code": "varchar", "hcc_description": "varchar"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["hcc_suspecting"], "description": "Disease factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": "the_tuva_project://seeds/value_sets/hcc_suspecting/hcc_suspecting_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_value_set_hcc_descriptions", "tags": "hcc_suspecting", "enabled": true, "column_types": {"hcc_code": "varchar", "hcc_description": "varchar"}}, "created_at": 1708545506.05848, "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": []}}, "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": "15ce75a34050c084ac8f8cfa265f100db069114a3dd0f9a55c8db01150733453"}, "config": {"enabled": true, "alias": "_value_set_tuva_chronic_conditions_hierarchy", "schema": "chronic_conditions", "database": null, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#804912"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "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": "A higher level rollup grouping of conditions from the condition column", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the condition that each diagnosis code rolls up into", "meta": {}, "data_type": null, "quote": null, "tags": []}, "icd_10_cm_code": {"name": "icd_10_cm_code", "description": "The icd10 code", "meta": {}, "data_type": null, "quote": null, "tags": []}, "icd_10_cm_description": {"name": "icd_10_cm_description", "description": "The description for the icd10 code", "meta": {}, "data_type": null, "quote": null, "tags": []}, "condition_column_name": {"name": "condition_column_name", "description": "The name of the column as it will appear in chronic_conditions_wide", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true, "node_color": "#804912"}, "patch_path": "the_tuva_project://seeds/value_sets/chronic_conditions/tuva_chronic_conditions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "_value_set_tuva_chronic_conditions_hierarchy", "tags": ["tuva_chronic_conditions", "chronic_conditions"], "enabled": true, "docs": {"node_color": "#804912"}}, "created_at": 1708545506.068307, "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": []}}, "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": "path", "checksum": "seeds/value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv"}, "config": {"enabled": true, "alias": "_value_set_cms_chronic_conditions_hierarchy", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#804912"}, "quote_columns": null, "post-hook": [], "pre-hook": []}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "CMS generated grouping of ICD 10 codes into chronic conditions groups", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": "#804912"}, "patch_path": "the_tuva_project://seeds/value_sets/chronic_conditions/cms_chronic_conditions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "_value_set_cms_chronic_conditions_hierarchy", "tags": ["cms_chronic_conditions", "chronic_conditions"], "enabled": true, "docs": {"node_color": "#804912"}}, "created_at": 1708545506.0708039, "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": []}}, "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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545505.941681, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["ed_classification__johnston_icd9"]], "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": [], "column_name": "icd9", "file_key_name": "seeds.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545505.942726, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["ed_classification__johnston_icd9"]], "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": [], "column_name": "icd9", "file_key_name": "seeds.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545505.943831, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["ed_classification__johnston_icd10"]], "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": [], "column_name": "icd10", "file_key_name": "seeds.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545505.944869, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["ed_classification__johnston_icd10"]], "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": [], "column_name": "icd10", "file_key_name": "seeds.ed_classification__johnston_icd10"}, "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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545506.2622578, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["core__condition"]], "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": [], "column_name": "condition_id", "file_key_name": "models.core__condition"}, "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(claim_id||'-'||claim_line_number)", "model": "{{ get_where_subquery(ref('core__medical_claim')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__medical_claim__claim_id_claim_line_number_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__medical_claim__claim_id_claim_line_number_.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0", "fqn": ["the_tuva_project", "core", "unique_core__medical_claim__claim_id_claim_line_number_"], "alias": "unique_core__medical_claim__claim_id_claim_line_number_", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545506.263499, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["core__medical_claim"]], "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__claim_id_claim_line_number_.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (claim_id||'-'||claim_line_number) as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.medical_claim\nwhere (claim_id||'-'||claim_line_number) is not null\ngroup by (claim_id||'-'||claim_line_number)\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": null, "file_key_name": "models.core__medical_claim"}, "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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545506.264523, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["core__procedure"]], "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": [], "column_name": "procedure_id", "file_key_name": "models.core__procedure"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "source_table", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_summary')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_summary_source_table", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_summary_source_table"], "alias": "not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10"}, "created_at": 1708545506.404823, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10\") }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_summary"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__f679bb8922eec2815a77cfff081e9e10.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom dev_sarah.data_quality.claims_preprocessing_summary\nwhere source_table is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "source_table", "file_key_name": "models.data_quality__claims_preprocessing_summary"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_category", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_summary')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_summary_test_category", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_summary_test_category"], "alias": "not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477"}, "created_at": 1708545506.406189, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477\") }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_summary"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__336abc6fa3e364c103685e2faae83477.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_category\nfrom dev_sarah.data_quality.claims_preprocessing_summary\nwhere test_category is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "test_category", "file_key_name": "models.data_quality__claims_preprocessing_summary"}, "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468": {"test_metadata": {"name": "claims_preprocessing_pipeline_checks", "kwargs": {"model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_summary')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_", "resource_type": "test", "package_name": "the_tuva_project", "path": "claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468", "fqn": ["the_tuva_project", "data_quality", "claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_"], "alias": "claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "warn", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "warn", "alias": "claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c"}, "created_at": 1708545506.407574, "relation_name": null, "raw_code": "{{ test_claims_preprocessing_pipeline_checks(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",alias=\"claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c\") }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_summary"], ["data_quality__claims_preprocessing_test_detail"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.test_claims_preprocessing_pipeline_checks", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/claims_preprocessing_pipeline__d4efae38f014be38415215d3c15b873c.sql", "compiled": true, "compiled_code": "\n\n select *\n from dev_sarah.data_quality.claims_preprocessing_test_detail\n where pipeline_test = 1\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": null, "file_key_name": "models.data_quality__claims_preprocessing_summary"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "source_table", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_detail')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_detail_source_table", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_detail_source_table"], "alias": "not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08"}, "created_at": 1708545506.4127302, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08\") }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_detail"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__5898c059411e7fc10ba8219c734e6e08.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom dev_sarah.data_quality.claims_preprocessing_test_detail\nwhere source_table is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "source_table", "file_key_name": "models.data_quality__claims_preprocessing_test_detail"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_category", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_detail')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_detail_test_category", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_detail_test_category"], "alias": "not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80"}, "created_at": 1708545506.4138398, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80\") }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_detail"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__56459226ea7065b8eb9a80d40b78ff80.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_category\nfrom dev_sarah.data_quality.claims_preprocessing_test_detail\nwhere test_category is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "test_category", "file_key_name": "models.data_quality__claims_preprocessing_test_detail"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_name", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_detail')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_detail_test_name", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_detail_test_name"], "alias": "not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049"}, "created_at": 1708545506.41486, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049\") }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_detail"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__f05207c475588fc8a73c0e2b3a575049.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_name\nfrom dev_sarah.data_quality.claims_preprocessing_test_detail\nwhere test_name is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "test_name", "file_key_name": "models.data_quality__claims_preprocessing_test_detail"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "source_table", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_result')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_result_source_table", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__412833294baa145f20c48137d8814886.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_result_source_table"], "alias": "not_null_data_quality__claims__412833294baa145f20c48137d8814886", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__412833294baa145f20c48137d8814886", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__claims__412833294baa145f20c48137d8814886"}, "created_at": 1708545506.415999, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__412833294baa145f20c48137d8814886\") }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_result"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__412833294baa145f20c48137d8814886.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom dev_sarah.data_quality.claims_preprocessing_test_result\nwhere source_table is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "source_table", "file_key_name": "models.data_quality__claims_preprocessing_test_result"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_category", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_result')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_result_test_category", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_result_test_category"], "alias": "not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367"}, "created_at": 1708545506.416982, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367\") }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_result"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__b2af6c316533f702a46cd6223fa65367.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_category\nfrom dev_sarah.data_quality.claims_preprocessing_test_result\nwhere test_category is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "test_category", "file_key_name": "models.data_quality__claims_preprocessing_test_result"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_name", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_test_result')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_test_result_test_name", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_test_result_test_name"], "alias": "not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49"}, "created_at": 1708545506.417946, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49\") }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_test_result"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__9b4fbcc2957c4f9bd554a6666f91ad49.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_name\nfrom dev_sarah.data_quality.claims_preprocessing_test_result\nwhere test_name is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "test_name", "file_key_name": "models.data_quality__claims_preprocessing_test_result"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "use_case", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_use_case')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_use_case_use_case", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims_preprocessing_use_case_use_case.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_use_case_use_case"], "alias": "not_null_data_quality__claims_preprocessing_use_case_use_case", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545506.419539, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_use_case"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_use_case"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims_preprocessing_use_case_use_case.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect use_case\nfrom dev_sarah.data_quality.claims_preprocessing_use_case\nwhere use_case is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "use_case", "file_key_name": "models.data_quality__claims_preprocessing_use_case"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "source_table", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_use_case')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_use_case_source_table", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_use_case_source_table"], "alias": "not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37"}, "created_at": 1708545506.4208, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37\") }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_use_case"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_use_case"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims__e20e4fef5e6980ffb07c442849539e37.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom dev_sarah.data_quality.claims_preprocessing_use_case\nwhere source_table is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "source_table", "file_key_name": "models.data_quality__claims_preprocessing_use_case"}, "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "test_name", "model": "{{ get_where_subquery(ref('data_quality__claims_preprocessing_use_case')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__claims_preprocessing_use_case_test_name", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__claims_preprocessing_use_case_test_name.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__claims_preprocessing_use_case_test_name"], "alias": "not_null_data_quality__claims_preprocessing_use_case_test_name", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545506.422134, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["data_quality__claims_preprocessing_use_case"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__claims_preprocessing_use_case"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__claims_preprocessing_use_case_test_name.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_name\nfrom dev_sarah.data_quality.claims_preprocessing_use_case\nwhere test_name is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "test_name", "file_key_name": "models.data_quality__claims_preprocessing_use_case"}, "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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545506.572546, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["cms_hcc__patient_risk_scores"]], "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": [], "column_name": "patient_id", "file_key_name": "models.cms_hcc__patient_risk_scores"}, "test.the_tuva_project.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(patient_id||'-'||model_version)", "model": "{{ get_where_subquery(ref('cms_hcc__int_demographic_factors')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_cms_hcc__int_demographic_factors__patient_id_model_version_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400", "fqn": ["the_tuva_project", "cms_hcc", "unique_cms_hcc__int_demographic_factors__patient_id_model_version_"], "alias": "unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87"}, "created_at": 1708545506.574722, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87\") }}", "language": "sql", "refs": [["cms_hcc__int_demographic_factors"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "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/unique_cms_hcc__int_demographi_537430abb11ae183012a8a0db61e9c87.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id||'-'||model_version) as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.cms_hcc._int_demographic_factors\nwhere (patient_id||'-'||model_version) is not null\ngroup by (patient_id||'-'||model_version)\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": null, "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545506.578711, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["cms_hcc__int_eligible_conditions"]], "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": [], "column_name": "condition_code", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545506.579982, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["cms_hcc__int_members"]], "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": [], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1708545506.581465, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [["cms_hcc__int_members"]], "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": [], "column_name": "patient_id", "file_key_name": "models.cms_hcc__int_members"}, "test.the_tuva_project.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(claim_id||'-'||claim_line_number)", "model": "{{ get_where_subquery(ref('normalized_input__medical_claim')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_normalized_input__medical_claim__claim_id_claim_line_number_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46.sql", "original_file_path": "models/claims_preprocessing/claims_preprocessing_models.yml", "unique_id": "test.the_tuva_project.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f", "fqn": ["the_tuva_project", "claims_preprocessing", "unique_normalized_input__medical_claim__claim_id_claim_line_number_"], "alias": "unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46"}, "created_at": 1708545506.85437, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46\") }}", "language": "sql", "refs": [["normalized_input__medical_claim"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "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/unique_normalized_input__medic_bbd2054a58f89fc572df7bb74dd9ab46.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (claim_id||'-'||claim_line_number) as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere (claim_id||'-'||claim_line_number) is not null\ngroup by (claim_id||'-'||claim_line_number)\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": null, "file_key_name": "models.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": {}, "materialized": "test", "severity": "WARN", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1708545507.097945, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [["quality_measures__stg_core__condition"]], "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "WARN", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1708545507.0993862, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [["quality_measures__stg_core__encounter"]], "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 , encounter_start_date\n , encounter_end_date\n , '2024-02-21 19:58:21.989699+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 , encounter_start_date\n , encounter_end_date\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "WARN", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1708545507.10147, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [["quality_measures__stg_core__medication"]], "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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-21 19:58:21.989699+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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n)"}], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "WARN", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1708545507.1029708, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [["quality_measures__stg_core__observation"]], "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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n)"}], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "WARN", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1708545507.104196, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [["quality_measures__stg_core__patient"]], "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "WARN", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1708545507.105555, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [["quality_measures__stg_core__patient"]], "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "column_name": "sex", "file_key_name": "models.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": {}, "materialized": "test", "severity": "warn", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.1067572, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",alias=\"accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae\") }}", "language": "sql", "refs": [["quality_measures__stg_core__patient"]], "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "column_name": "sex", "file_key_name": "models.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": {}, "materialized": "test", "severity": "WARN", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1708545507.112651, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [["quality_measures__stg_core__patient"]], "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-02-21 19:58:21.989699+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-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "column_name": "birth_date", "file_key_name": "models.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": {}, "materialized": "test", "severity": "WARN", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1708545507.1139011, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [["quality_measures__stg_core__procedure"]], "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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-21 19:58:21.989699+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__procedure"}, "test.the_tuva_project.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('ccsr__singular_condition_category')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_ccsr__singular_condition_category_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_ccsr__singular_condition_category_claim_id.sql", "original_file_path": "models/ccsr/ccsr_models.yml", "unique_id": "test.the_tuva_project.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8", "fqn": ["the_tuva_project", "ccsr", "not_null_ccsr__singular_condition_category_claim_id"], "alias": "not_null_ccsr__singular_condition_category_claim_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "WARN", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1708545507.195997, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [["ccsr__singular_condition_category"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.ccsr__singular_condition_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/ccsr_models.yml/not_null_ccsr__singular_condition_category_claim_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_sarah.ccsr.singular_condition_category\nwhere claim_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "claim_id", "file_key_name": "models.ccsr__singular_condition_category"}, "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('ccsr__singular_condition_category')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_ccsr__singular_condition_category_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_ccsr__singular_condition_category_claim_id.sql", "original_file_path": "models/ccsr/ccsr_models.yml", "unique_id": "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b", "fqn": ["the_tuva_project", "ccsr", "unique_ccsr__singular_condition_category_claim_id"], "alias": "unique_ccsr__singular_condition_category_claim_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "WARN", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1708545507.1977758, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [["ccsr__singular_condition_category"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.ccsr__singular_condition_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/ccsr_models.yml/unique_ccsr__singular_condition_category_claim_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n claim_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.ccsr.singular_condition_category\nwhere claim_id is not null\ngroup by claim_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": "claim_id", "file_key_name": "models.ccsr__singular_condition_category"}, "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(patient_id || '_' || year_month || '_' || plan)", "model": "{{ get_where_subquery(ref('financial_pmpm__pmpm_prep')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf.sql", "original_file_path": "models/financial_pmpm/financial_pmpm_models.yml", "unique_id": "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e", "fqn": ["the_tuva_project", "financial_pmpm", "unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_"], "alias": "unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf"}, "created_at": 1708545507.264813, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf\") }}", "language": "sql", "refs": [["financial_pmpm__pmpm_prep"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/financial_pmpm_models.yml/unique_financial_pmpm__pmpm_pr_c36fcd8dfb24026167eeab878c3dd5cf.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id || '_' || year_month || '_' || plan) as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.financial_pmpm.pmpm_prep\nwhere (patient_id || '_' || year_month || '_' || plan) is not null\ngroup by (patient_id || '_' || year_month || '_' || plan)\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": null, "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2"}, "created_at": 1708545507.3536158, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_wide"]], "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": [], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.3551722, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_wide"]], "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": [], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.356201, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_long"]], "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": [], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.357337, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_long"]], "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": [], "column_name": "claim_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.358294, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_long"]], "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": [], "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_long"}, "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(patient_id || claim_id || start_date || condition)", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_long')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320", "fqn": ["the_tuva_project", "chronic_conditions", "unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_"], "alias": "unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b"}, "created_at": 1708545507.3594072, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_long"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "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/unique_chronic_conditions__cms_a604d2d2a2cdd1e22a6855beff37d57b.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id || claim_id || start_date || condition) as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_long\nwhere (patient_id || claim_id || start_date || condition) is not null\ngroup by (patient_id || claim_id || start_date || condition)\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": null, "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.360368, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_all"]], "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": [], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.3613088, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_all"]], "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": [], "column_name": "claim_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.362356, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_all"]], "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": [], "column_name": "condition", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.36451, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_hiv_aids"]], "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": [], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.367519, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_hiv_aids"]], "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": [], "column_name": "claim_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.372478, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_hiv_aids"]], "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": [], "column_name": "condition", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f"}, "created_at": 1708545507.3740952, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_hiv_aids"]], "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": [], "column_name": "condition", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.377412, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_oud"]], "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": [], "column_name": "patient_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.3785841, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_oud"]], "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": [], "column_name": "claim_id", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.379602, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_oud"]], "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": [], "column_name": "condition", "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e"}, "created_at": 1708545507.380842, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e\") }}", "language": "sql", "refs": [["chronic_conditions__cms_chronic_conditions_oud"]], "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": [], "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_oud"}, "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "(patient_id || '_' || condition)", "model": "{{ get_where_subquery(ref('chronic_conditions__tuva_chronic_conditions_long')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423.sql", "original_file_path": "models/chronic_conditions/tuva_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f", "fqn": ["the_tuva_project", "chronic_conditions", "unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_"], "alias": "unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423"}, "created_at": 1708545507.425969, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423\") }}", "language": "sql", "refs": [["chronic_conditions__tuva_chronic_conditions_long"]], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "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/unique_chronic_conditions__tuv_5a5fdcf2a52369894b11527da0860423.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id || '_' || condition) as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere (patient_id || '_' || condition) is not null\ngroup by (patient_id || '_' || condition)\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "column_name": null, "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550"}, "created_at": 1708545507.433919, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550\") }}", "language": "sql", "refs": [["chronic_conditions__tuva_chronic_conditions_wide"]], "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": [], "column_name": null, "file_key_name": "models.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": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "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": 1708545507.4397519, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4\") }}", "language": "sql", "refs": [["chronic_conditions__tuva_chronic_conditions_wide"]], "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": [], "column_name": null, "file_key_name": "models.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": 1708545502.4581602, "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": 1708545502.458433, "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": 1708545502.458567, "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 {%- if date_format == 'YYYY-MM-DD' -%}\r\n case\r\n when {{ column_name }} similar to '[0-9]{4}-[0-9]{2}-[0-9]{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 '[0-9]{4}[0-9]{2}[0-9]{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 '[0-9]{2}/[0-9]{2}/[0-9]{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 '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{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": 1708545502.459129, "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": 1708545502.4596841, "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": 1708545502.4598138, "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": 1708545502.460381, "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 {% set query %}\n with tables as (\n\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n table_type 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\n from {{ information_schema }}.tables\n\n ),\n\n columns as (\n\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\n from {{ information_schema }}.columns\n )\n\n select *\n from tables\n join columns using (\"table_database\", \"table_schema\", \"table_name\")\n where (\n {%- for schema in schemas -%}\n upper(\"table_schema\") = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n order by \"column_index\"\n {%- endset -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.46149, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_table_as": {"name": "snowflake__create_table_as", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_table_as", "macro_sql": "{% macro snowflake__create_table_as(temporary, relation, compiled_code, language='sql') -%}\n {%- if language == 'sql' -%}\n {%- set transient = config.get('transient', default=true) -%}\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 {% if temporary -%}\n temporary\n {%- elif transient -%}\n transient\n {%- endif %} table {{ relation }} {% 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, temporary=temporary) }}\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_snowflake.py_write_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.478236, "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": 1708545502.4790661, "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": 1708545502.4793742, "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/adapters.sql", "original_file_path": "macros/adapters.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 {% 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"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.480258, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_view_as": {"name": "snowflake__create_view_as", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.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": 1708545502.48042, "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": 1708545502.48134, "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": 1708545502.482014, "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) %}\n {%- set sql -%}\n show terse objects in {{ schema_relation }}\n {%- endset -%}\n\n {%- set result = run_query(sql) -%}\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in schema {{ schema_relation }}! dbt can only get\n information about schemas with fewer than {{ maximum }} objects.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {%- do 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": 1708545502.482603, "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": 1708545502.482961, "supported_languages": null}, "macro.dbt_snowflake.snowflake__rename_relation": {"name": "snowflake__rename_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.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": 1708545502.483169, "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": 1708545502.483448, "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 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": 1708545502.483667, "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 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": 1708545502.484226, "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": 1708545502.484432, "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": 1708545502.4846132, "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": 1708545502.485131, "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": 1708545502.485321, "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": 1708545502.485829, "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 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": 1708545502.486727, "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": 1708545502.4870842, "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": 1708545502.487374, "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": 1708545502.487707, "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": 1708545502.487839, "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": 1708545502.488214, "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": 1708545502.489543, "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": 1708545502.489878, "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": 1708545502.490152, "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": 1708545502.492599, "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": 1708545502.492934, "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 = 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 return(to_return) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.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": 1708545502.493524, "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": 1708545502.496159, "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) %}\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 df.write.mode(\"overwrite\").save_as_table(\"{{ target_relation }}\", create_temp_table={{temporary}})\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": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.496413, "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": 1708545502.496522, "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": 1708545502.4993558, "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": 1708545502.504116, "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": 1708545502.504371, "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": 1708545502.50479, "supported_languages": ["sql"]}, "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": 1708545502.5051, "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": 1708545502.505292, "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": 1708545502.505405, "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": 1708545502.505514, "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": 1708545502.505652, "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": 1708545502.505853, "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": 1708545502.506101, "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": 1708545502.506271, "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": 1708545502.506405, "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": 1708545502.506588, "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": 1708545502.50777, "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": 1708545502.50798, "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": 1708545502.5081348, "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": 1708545502.5082822, "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": 1708545502.508428, "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": 1708545502.508815, "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": 1708545502.509166, "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": 1708545502.50959, "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": 1708545502.510057, "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": 1708545502.5103512, "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": 1708545502.514096, "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": 1708545502.514281, "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": 1708545502.514714, "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": 1708545502.515533, "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": 1708545502.51572, "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": 1708545502.515903, "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 select {{ check_cols_config | join(', ') }} from ({{ node['compiled_code'] }}) 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": 1708545502.517338, "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": 1708545502.518829, "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": 1708545502.5231218, "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": 1708545502.5234618, "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": 1708545502.5236511, "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": 1708545502.523742, "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": 1708545502.5238988, "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": 1708545502.524116, "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": 1708545502.524805, "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": 1708545502.5259361, "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": 1708545502.5261528, "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": 1708545502.5264168, "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": 1708545502.52687, "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": 1708545502.5337758, "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 {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type='table') -%} %}\n\n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n\n {% call statement(auto_begin=True) %}\n {{ create_table_as(False, 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.create_table_as", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.536095, "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": 1708545502.5365708, "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": 1708545502.5368881, "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": 1708545502.5372689, "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": 1708545502.5376608, "supported_languages": null}, "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": 1708545502.539337, "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": 1708545502.5399182, "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": 1708545502.540612, "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": 1708545502.540857, "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": 1708545502.5415978, "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": 1708545502.549382, "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": 1708545502.551263, "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": 1708545502.5515578, "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": 1708545502.552633, "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": 1708545502.55292, "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": 1708545502.553807, "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": 1708545502.5545092, "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.default__get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.555459, "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": 1708545502.5557098, "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": 1708545502.555904, "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": 1708545502.5562172, "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": 1708545502.556412, "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": 1708545502.5567172, "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": 1708545502.556916, "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": 1708545502.5571918, "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": 1708545502.5573828, "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": 1708545502.557537, "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": 1708545502.557835, "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": 1708545502.563106, "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": 1708545502.569076, "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": 1708545502.570372, "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": 1708545502.57166, "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": 1708545502.572553, "supported_languages": null}, "macro.dbt.materialization_table_default": {"name": "materialization_table_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table/table.sql", "original_file_path": "macros/materializations/models/table/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 {{ adapter.rename_relation(existing_relation, backup_relation) }}\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": 1708545502.57527, "supported_languages": ["sql"]}, "macro.dbt.get_create_table_as_sql": {"name": "get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.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": 1708545502.5758011, "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/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.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": 1708545502.575995, "supported_languages": null}, "macro.dbt.create_table_as": {"name": "create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.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": 1708545502.576443, "supported_languages": null}, "macro.dbt.default__create_table_as": {"name": "default__create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.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 as (\n {{ sql }}\n );\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.576885, "supported_languages": null}, "macro.dbt.materialization_view_default": {"name": "materialization_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view/view.sql", "original_file_path": "macros/materializations/models/view/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 {{ adapter.rename_relation(existing_relation, backup_relation) }}\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": 1708545502.579639, "supported_languages": ["sql"]}, "macro.dbt.handle_existing_table": {"name": "handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.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": 1708545502.5799701, "supported_languages": null}, "macro.dbt.default__handle_existing_table": {"name": "default__handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.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": 1708545502.580214, "supported_languages": null}, "macro.dbt.create_or_replace_view": {"name": "create_or_replace_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/models/view/create_or_replace_view.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=True) %}\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": 1708545502.5828211, "supported_languages": null}, "macro.dbt.get_create_view_as_sql": {"name": "get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.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": 1708545502.5832589, "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/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.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": 1708545502.5834408, "supported_languages": null}, "macro.dbt.create_view_as": {"name": "create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.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": 1708545502.583641, "supported_languages": null}, "macro.dbt.default__create_view_as": {"name": "default__create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.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 }} as (\n {{ sql }}\n );\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.583926, "supported_languages": null}, "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 comparision 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": 1708545502.587716, "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": 1708545502.59328, "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": 1708545502.594303, "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": 1708545502.594559, "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": 1708545502.595063, "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": 1708545502.59526, "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": 1708545502.595392, "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": 1708545502.5955331, "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": 1708545502.595649, "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": 1708545502.595814, "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": 1708545502.595934, "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": 1708545502.596443, "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": 1708545502.596645, "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": 1708545502.5980139, "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": 1708545502.598436, "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 is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_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": 1708545502.5986712, "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": 1708545502.599207, "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": 1708545502.599481, "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": 1708545502.5997849, "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": 1708545502.600199, "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": 1708545502.600458, "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": 1708545502.600818, "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": 1708545502.601121, "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": 1708545502.601372, "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": 1708545502.601957, "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": 1708545502.603683, "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": 1708545502.604373, "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": 1708545502.604692, "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": 1708545502.6066182, "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 Partiton 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": 1708545502.607954, "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": 1708545502.608945, "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": 1708545502.6092212, "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": 1708545502.609469, "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": 1708545502.60955, "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": 1708545502.609903, "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": 1708545502.610123, "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": 1708545502.610402, "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": 1708545502.610538, "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": 1708545502.610827, "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": 1708545502.610945, "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": 1708545502.6113439, "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": 1708545502.6115131, "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": 1708545502.6117592, "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": 1708545502.6118348, "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": 1708545502.6121228, "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": 1708545502.612272, "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": 1708545502.612582, "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": 1708545502.612732, "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": 1708545502.6134348, "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": 1708545502.614016, "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": 1708545502.614387, "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": 1708545502.6145642, "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": 1708545502.6148639, "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": 1708545502.615007, "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": 1708545502.615273, "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": 1708545502.6154408, "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": 1708545502.6156921, "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": 1708545502.6158552, "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": 1708545502.61611, "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": 1708545502.616215, "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": 1708545502.616516, "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": 1708545502.616659, "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": 1708545502.61691, "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": 1708545502.617014, "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": 1708545502.617991, "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": 1708545502.618149, "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": 1708545502.618318, "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": 1708545502.618477, "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": 1708545502.618643, "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": 1708545502.618865, "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": 1708545502.619034, "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": 1708545502.619253, "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": 1708545502.6194391, "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": 1708545502.619601, "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": 1708545502.619772, "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": 1708545502.619925, "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": 1708545502.620092, "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": 1708545502.6202428, "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": 1708545502.620532, "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": 1708545502.620671, "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": 1708545502.620925, "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": 1708545502.6210299, "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": 1708545502.6213892, "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": 1708545502.621671, "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": 1708545502.621829, "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": 1708545502.6235788, "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": 1708545502.624183, "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": 1708545502.624734, "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": 1708545502.6254988, "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": 1708545502.625649, "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": 1708545502.626066, "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": 1708545502.6264489, "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": 1708545502.62675, "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": 1708545502.626888, "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": 1708545502.627279, "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": 1708545502.6274781, "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": 1708545502.62765, "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": 1708545502.627845, "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": 1708545502.628353, "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": 1708545502.628514, "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": 1708545502.6286678, "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": 1708545502.628779, "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": 1708545502.6289558, "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": 1708545502.6290371, "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": 1708545502.629216, "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": 1708545502.6293929, "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": 1708545502.6298969, "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": 1708545502.63006, "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": 1708545502.6302269, "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": 1708545502.630656, "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": 1708545502.634283, "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": 1708545502.634683, "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": 1708545502.6349802, "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": 1708545502.635359, "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": 1708545502.635632, "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": 1708545502.635982, "supported_languages": null}, "macro.dbt.drop_relation": {"name": "drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.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": 1708545502.636179, "supported_languages": null}, "macro.dbt.default__drop_relation": {"name": "default__drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} 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": 1708545502.63641, "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": 1708545502.636605, "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": 1708545502.6367738, "supported_languages": null}, "macro.dbt.rename_relation": {"name": "rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.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": 1708545502.63699, "supported_languages": null}, "macro.dbt.default__rename_relation": {"name": "default__rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.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": 1708545502.6372962, "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": 1708545502.637568, "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": 1708545502.638162, "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": 1708545502.6384058, "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": 1708545502.63856, "supported_languages": null}, "macro.dbt.drop_relation_if_exists": {"name": "drop_relation_if_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.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": 1708545502.638765, "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": 1708545502.639251, "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').table) }}\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": 1708545502.6396868, "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": 1708545502.641463, "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": 1708545502.641589, "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": 1708545502.641763, "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": 1708545502.641876, "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": 1708545502.6423218, "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": 1708545502.64252, "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": 1708545502.642636, "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": 1708545502.6428869, "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": 1708545502.643106, "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": 1708545502.643352, "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": 1708545502.643548, "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": 1708545502.643796, "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": 1708545502.6446111, "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": 1708545502.644874, "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": 1708545502.645152, "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": 1708545502.645399, "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": 1708545502.646606, "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": 1708545502.64734, "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": 1708545502.6475148, "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": 1708545502.647724, "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": 1708545502.647989, "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": 1708545502.64835, "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": 1708545502.648892, "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": 1708545502.650451, "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": 1708545502.650816, "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": 1708545502.6510131, "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": 1708545502.651283, "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": 1708545502.651477, "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": 1708545502.651746, "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": 1708545502.651963, "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": 1708545502.652284, "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": 1708545502.65248, "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": 1708545502.652652, "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": 1708545502.65444, "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": 1708545502.654616, "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": 1708545502.654946, "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": 1708545502.655148, "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 select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.655505, "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": 1708545502.655742, "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": 1708545502.656545, "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": 1708545502.656856, "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": 1708545502.657702, "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": 1708545502.6591702, "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": 1708545502.6593301, "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 resolved = ref(*_ref) -%}\n {%- do ref_dict.update({_ref | join('.'): resolve_model_name(resolved)}) -%}\n {%- endfor -%}\n\ndef ref(*args,dbt_load_df_function):\n refs = {{ ref_dict | tojson }}\n key = '.'.join(args)\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": 1708545502.659754, "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": 1708545502.660267, "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": 1708545502.660876, "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: ref(*args, 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": 1708545502.661373, "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": 1708545502.6614459, "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": 1708545502.662146, "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": 1708545502.66241, "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": 1708545502.662721, "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": 1708545502.663031, "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": 1708545502.66343, "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": 1708545502.663958, "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": 1708545502.664469, "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": 1708545502.665177, "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": 1708545502.665544, "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": 1708545502.6658869, "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": 1708545502.667041, "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": 1708545502.668389, "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": 1708545502.66951, "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": 1708545502.670756, "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": 1708545502.671475, "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": 1708545502.671859, "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": 1708545502.6726332, "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": 1708545502.673752, "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": 1708545502.674238, "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": 1708545502.674749, "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": 1708545502.675385, "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": 1708545502.675887, "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": 1708545502.6764631, "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": 1708545502.676864, "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": 1708545502.6776042, "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 where {{ column_name }} is not null\n limit 1\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": 1708545502.678473, "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": 1708545502.679134, "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": 1708545502.679811, "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": 1708545502.680414, "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": 1708545502.680793, "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": 1708545502.68122, "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": 1708545502.681605, "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": 1708545502.682312, "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 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": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.683456, "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": 1708545502.684462, "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": 1708545502.685436, "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) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\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": 1708545502.686198, "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) %}\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-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\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.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.687138, "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": 1708545502.6877272, "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": 1708545502.688137, "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": 1708545502.692055, "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": 1708545502.693748, "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": 1708545502.694048, "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": 1708545502.694217, "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": 1708545502.694668, "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": 1708545502.694946, "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": 1708545502.6951418, "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": 1708545502.6953979, "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": 1708545502.6955898, "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{#- 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": 1708545502.696222, "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": 1708545502.6971142, "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": 1708545502.69783, "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": 1708545502.698733, "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": 1708545502.698973, "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": 1708545502.699369, "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": 1708545502.699877, "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": 1708545502.7006269, "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": 1708545502.7009642, "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": 1708545502.701325, "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": 1708545502.702546, "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": 1708545502.703564, "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": 1708545502.7044978, "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": 1708545502.704963, "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": 1708545502.70516, "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": 1708545502.705696, "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": 1708545502.7063959, "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": 1708545502.707297, "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": 1708545502.707726, "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": 1708545502.708058, "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": 1708545502.7093818, "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": 1708545502.710973, "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') -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.7124548, "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') -%}\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 select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ 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": 1708545502.714189, "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": 1708545502.7145002, "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": 1708545502.714638, "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": 1708545502.7183092, "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": 1708545502.722059, "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": 1708545502.7224052, "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": 1708545502.722671, "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": 1708545502.723798, "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": 1708545502.724038, "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 {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.724255, "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": 1708545502.724467, "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": 1708545502.7246459, "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": 1708545502.724832, "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": 1708545502.725286, "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": 1708545502.725536, "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": 1708545502.7260008, "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": 1708545502.7265851, "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": 1708545502.726955, "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": 1708545502.727526, "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": 1708545502.729308, "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": 1708545502.7297091, "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": 1708545502.730592, "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": 1708545502.731157, "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": 1708545502.732376, "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": 1708545502.733972, "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": 1708545502.735082, "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": 1708545502.735969, "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": 1708545502.736462, "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": 1708545502.737254, "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": 1708545502.738209, "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": 1708545502.738711, "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": 1708545502.738912, "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": 1708545502.7393448, "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": 1708545502.740012, "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": 1708545502.740494, "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": 1708545502.74115, "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": 1708545502.74172, "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": 1708545502.741893, "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": 1708545502.742052, "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": 1708545502.742197, "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": 1708545502.742861, "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": 1708545502.7437189, "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": 1708545502.7448268, "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": 1708545502.745121, "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": 1708545502.745715, "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": 1708545502.746753, "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": 1708545502.747416, "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": 1708545502.747575, "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": 1708545502.7477162, "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": 1708545502.747853, "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": 1708545502.7479858, "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 -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.7481139, "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": 1708545502.7502651, "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": 1708545502.750481, "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": 1708545502.750596, "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 {%- if date_format == 'YYYY-MM-DD' -%}\r\n case\r\n when {{ column_name }} similar to '[0-9]{4}-[0-9]{2}-[0-9]{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 '[0-9]{4}[0-9]{2}[0-9]{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 '[0-9]{2}/[0-9]{2}/[0-9]{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 '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{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": 1708545502.7510972, "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": 1708545502.751692, "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 -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1708545502.751828, "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": 1708545502.754657, "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 set s3_access_key_id='AKIA2EPVNTV4FLAEBFGE';\n set s3_secret_access_key='TARgblERrFP81Op+52KZW7HrP1Om6ObEDQAUVN2u';\n set s3_region='us-east-1';\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": 1708545502.75574, "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 %}\ncopy {{ this }}\n from 's3://{{ uri }}/{{ pattern }}'\n access_key_id 'AKIA2EPVNTV4FLAEBFGE'\n secret_access_key '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'\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": 1708545502.75651, "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": 1708545502.757361, "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 )\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": 1708545502.758687, "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') }}\",\n AWS_SECRET_KEY = \"{{ env_var('AWS_SECRET_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' = 'true',\n 'inferSchema' = 'false',\n 'sep' = ','\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": 1708545502.760947, "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": 1708545502.761219, "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": 1708545502.761565, "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": 1708545502.761716, "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": 1708545502.76185, "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": 1708545502.762207, "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": 1708545502.76279, "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": 1708545502.7632692, "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": 1708545502.7644649, "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": 1708545502.765654, "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": 1708545502.7660859, "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": 1708545502.7665741, "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": 1708545502.767127, "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('terminology__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": 1708545502.767788, "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": 1708545502.767978, "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"}}, "exposures": {}, "metrics": {}, "selectors": {}, "disabled": {"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": {}, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "patient_id||payment_year||tuva_last_run", "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "strategy": "timestamp", "target_schema": "cms_hcc", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null, "post-hook": [], "pre-hook": []}, "tags": ["cms_hcc"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545505.309126, "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": [["cms_hcc__patient_risk_scores"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": 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": {}, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "patient_id||model_version||payment_year||tuva_last_run", "on_schema_change": "ignore", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "strategy": "timestamp", "target_schema": "cms_hcc", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null, "post-hook": [], "pre-hook": []}, "tags": ["cms_hcc"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545505.317739, "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": [["cms_hcc__patient_risk_factors"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": 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": {}, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "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", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "strategy": "timestamp", "target_schema": "quality_measures", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545505.322955, "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": [["quality_measures__summary_long"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": 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": {}, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "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", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "strategy": "timestamp", "target_schema": "quality_measures", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null, "post-hook": [], "pre-hook": []}, "tags": ["quality_measures"], "description": "", "columns": {}, "meta": {}, "docs": {"show": true, "node_color": null}, "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}, "created_at": 1708545505.3282619, "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": [["quality_measures__summary_counts"]], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null}]}, "parent_map": {"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.lab_result_seed": [], "seed.input_layer.pharmacy_claim_seed": [], "model.the_tuva_project.insights__count_claim_by_claim_type": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.insights__count_claim_by_service_category": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.insights__trend_count_claim_by_claim_type": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.insights__trend_sum_amount_by_claim_type": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.insights__orphan_claim_by_claim_type": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.financial_pmpm__member_months", "model.the_tuva_project.financial_pmpm__member_months"], "model.the_tuva_project.insights__count_claim_by_date_column": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.financial_pmpm__member_months", "seed.the_tuva_project.terminology__calendar"], "model.the_tuva_project.insights__trend_sum_amount_by_service_category": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.insights__sum_amount_by_claim_type": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.insights__sum_amount_by_service_category": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.insights__trend_count_claim_by_service_category": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__medical_claim"], "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__summary", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.emergency_department__summary"], "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_medical_claim", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "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_medical_claim", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.core__stg_claims_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.core__stg_claims_medical_claim": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.emergency_department__int_encounter_id", "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.acute_inpatient__encounter_id", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "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.acute_inpatient__encounter_id", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "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.data_quality__claims_preprocessing_summary", "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.data_quality__claims_preprocessing_summary", "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"], "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"], "model.the_tuva_project.core__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"], "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__medication": ["model.the_tuva_project.core__stg_clinical_medication"], "model.the_tuva_project.core__observation": ["model.the_tuva_project.core__stg_clinical_observation"], "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.data_quality__claims_preprocessing_use_case": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__pharmacy_claim", "model.the_tuva_project.normalized_input__pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_summary": ["model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.normalized_input__pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "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__claim_type", "seed.the_tuva_project.terminology__code_type", "seed.the_tuva_project.terminology__code_type", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__present_on_admission", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators": ["model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar"], "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details"], "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values": ["model.the_tuva_project.normalized_input__pharmacy_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.data_quality__test_catalog"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values": ["model.the_tuva_project.normalized_input__eligibility", "seed.the_tuva_project.data_quality__test_catalog", "seed.the_tuva_project.terminology__gender", "seed.the_tuva_project.terminology__medicare_dual_eligibility", "seed.the_tuva_project.terminology__medicare_orec", "seed.the_tuva_project.terminology__medicare_status", "seed.the_tuva_project.terminology__payer_type", "seed.the_tuva_project.terminology__race"], "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__condition": ["model.the_tuva_project.core__condition"], "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__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_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__encounter"], "model.the_tuva_project.readmissions__planned_encounter": ["model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.readmissions__procedure_ccs", "model.the_tuva_project.readmissions__procedure_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__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.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__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_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", "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.emergency_department__stg_eligibility": ["model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.emergency_department__stg_medical_claim": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.emergency_department__stg_service_category": ["model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.emergency_department__summary": ["model.input_layer.eligibility", "model.input_layer.medical_claim", "model.input_layer.medical_claim", "model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "model.the_tuva_project.emergency_department__int_first_claim_values", "model.the_tuva_project.emergency_department__int_institutional_encounter_id", "model.the_tuva_project.emergency_department__int_last_claim_values", "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.emergency_department__int_encounter_id": ["model.the_tuva_project.emergency_department__int_institutional_encounter_id", "model.the_tuva_project.emergency_department__int_professional_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim"], "model.the_tuva_project.emergency_department__int_first_claim_values": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim"], "model.the_tuva_project.emergency_department__int_institutional_claims": ["model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.emergency_department__stg_service_category"], "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates": ["model.the_tuva_project.emergency_department__int_institutional_claims", "model.the_tuva_project.emergency_department__int_institutional_encounter_id"], "model.the_tuva_project.emergency_department__int_last_claim_values": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__stg_medical_claim"], "model.the_tuva_project.emergency_department__int_professional_encounter_id": ["model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.emergency_department__stg_service_category"], "model.the_tuva_project.emergency_department__int_institutional_encounter_id": ["model.the_tuva_project.emergency_department__int_institutional_claims"], "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"], "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.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__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_medical_claim_date_normalize"], "model.the_tuva_project.normalized_input__int_procedure_date_voting": ["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_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.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__calendar", "seed.the_tuva_project.terminology__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__int_diagnosis_code_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "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", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__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"], "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_present_on_admit_normalize"], "model.the_tuva_project.normalized_input__int_procedure_code_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "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", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__stg_medical_claim", "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", "seed.the_tuva_project.terminology__provider", "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.normalized_input__int_procedure_code_normalize"], "model.the_tuva_project.service_category__stg_medical_claim": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.service_category__dq_input_layer_results": ["model.the_tuva_project.service_category__dq_input_layer_tests"], "model.the_tuva_project.service_category__dq_multiple_service_categories_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__dq_multiple_service_categories_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "model.the_tuva_project.service_category__dq_input_layer_tests": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__claim_type", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.service_category__service_category_grouper": ["model.the_tuva_project.service_category__combined_institutional", "model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__hospice_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__ambulatory_surgery_professional": ["model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__home_health_professional": ["model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__urgent_care_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__duplicate_bill_types": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__dialysis_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__lab_institutional": ["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__dme_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "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__inpatient_psychiatric_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__skilled_nursing_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__hospice_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "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__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__lab_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__combined_institutional": ["model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__dialysis_institutional", "model.the_tuva_project.service_category__duplicate_bill_types", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__home_health_institutional", "model.the_tuva_project.service_category__hospice_institutional", "model.the_tuva_project.service_category__lab_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__skilled_nursing_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__emergency_department_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__acute_inpatient_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "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__office_visit_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "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__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__dme_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__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_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__skilled_nursing_professional", "model.the_tuva_project.service_category__urgent_care_professional"], "model.the_tuva_project.service_category__ambulance_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_psychiatric_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__emergency_department_institutional": ["model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": ["model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__urgent_care_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__acute_inpatient_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.acute_inpatient__stg_medical_claim": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.acute_inpatient__stg_service_category": ["model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.acute_inpatient__stg_eligibility": ["model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.acute_inpatient__summary": ["model.input_layer.medical_claim", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.the_tuva_project.acute_inpatient__first_claim_values", "model.the_tuva_project.acute_inpatient__institutional_encounter_id", "model.the_tuva_project.acute_inpatient__last_claim_values", "model.the_tuva_project.acute_inpatient__stg_eligibility", "model.the_tuva_project.acute_inpatient__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__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.acute_inpatient__professional_encounter_id": ["model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__stg_service_category"], "model.the_tuva_project.acute_inpatient__last_claim_values": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim"], "model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims": ["model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "model.the_tuva_project.acute_inpatient__professional_encounter_id"], "model.the_tuva_project.acute_inpatient__data_quality_summary": ["model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_claims"], "model.the_tuva_project.acute_inpatient__institutional_encounter_id": ["model.the_tuva_project.acute_inpatient__institutional_claims"], "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates": ["model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__institutional_encounter_id"], "model.the_tuva_project.acute_inpatient__claims_with_encounter_data": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.the_tuva_project.acute_inpatient__institutional_claims"], "model.the_tuva_project.acute_inpatient__first_claim_values": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim"], "model.the_tuva_project.acute_inpatient__encounter_id": ["model.the_tuva_project.acute_inpatient__institutional_encounter_id", "model.the_tuva_project.acute_inpatient__professional_encounter_id", "model.the_tuva_project.acute_inpatient__stg_medical_claim"], "model.the_tuva_project.acute_inpatient__institutional_claims": ["model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.acute_inpatient__stg_service_category"], "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_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0059_long", "model.the_tuva_project.quality_measures__int_nqf2372_long"], "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__frailty": ["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", "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_advanced_illness": ["model.the_tuva_project.quality_measures__int_nqf2372__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_nqf2372_exclude_institutional": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__stg_medical_claim"], "model.the_tuva_project.quality_measures__int_nqf2372__performance_period": ["seed.the_tuva_project.quality_measures__measures", "seed.the_tuva_project.quality_measures__measures", "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__stg_core__patient"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia": ["model.the_tuva_project.quality_measures__int_nqf2372__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_nqf2372_exclude_palliative": ["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_exclusions": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative"], "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_nqf2372_exclude_hospice": ["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_nqf0034_denominator": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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_exclude_dementia": ["model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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_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", "model.the_tuva_project.quality_measures__stg_core__patient", "seed.the_tuva_project.quality_measures__measures", "seed.the_tuva_project.quality_measures__measures", "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_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp"], "model.the_tuva_project.quality_measures__int_nqf0034__frailty": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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__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_exclude_hospice_palliative": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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_exclude_advanced_illness": ["model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "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", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp": ["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_medical_claim"], "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_nqf0059__frailty": ["model.the_tuva_project.quality_measures__int_nqf0059_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", "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_denominator": ["model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "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", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0059_exclude_institutional_snp": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__stg_medical_claim"], "model.the_tuva_project.quality_measures__int_nqf0059_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_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_exclude_advanced_illness": ["model.the_tuva_project.quality_measures__int_nqf0059__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_nqf0059__performance_period": ["seed.the_tuva_project.quality_measures__measures", "seed.the_tuva_project.quality_measures__measures", "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__stg_core__patient"], "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia": ["model.the_tuva_project.quality_measures__int_nqf0059__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_nqf0059_exclude_hospice_palliative": ["model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "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__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.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_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.financial_pmpm__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__member_months": ["model.the_tuva_project.financial_pmpm__stg_eligibility", "seed.the_tuva_project.terminology__calendar"], "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__condition": ["model.the_tuva_project.core__condition"], "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_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__int_patient_hcc_history": ["model.the_tuva_project.hcc_suspecting__int_all_conditions"], "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_prep_conditions": ["model.the_tuva_project.hcc_suspecting__stg_core__condition", "seed.the_tuva_project.terminology__snomed_icd_10_map"], "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim": ["model.input_layer.pharmacy_claim"], "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__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_medical_claim": ["model.input_layer.medical_claim"], "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.tuva_chronic_conditions__stg_core__condition", "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy"], "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", "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.tuva_chronic_conditions__stg_core__patient", "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy", "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy"], "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_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__procedure", "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim", "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__procedure", "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"], "seed.the_tuva_project.terminology__admit_type": [], "seed.the_tuva_project.terminology__ssa_fips_state": [], "seed.the_tuva_project.terminology__medicare_orec": [], "seed.the_tuva_project.terminology__gender": [], "seed.the_tuva_project.terminology__ethnicity": [], "seed.the_tuva_project.terminology__ms_drg": [], "seed.the_tuva_project.terminology__revenue_center": [], "seed.the_tuva_project.terminology__icd_9_cm": [], "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__calendar": [], "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__fips_county": [], "seed.the_tuva_project.terminology__ndc": [], "seed.the_tuva_project.terminology__ansi_fips_state": [], "seed.the_tuva_project.terminology__encounter_type": [], "seed.the_tuva_project.terminology__provider": [], "seed.the_tuva_project.terminology__payer_type": [], "seed.the_tuva_project.terminology__apr_drg": [], "seed.the_tuva_project.terminology__icd_10_pcs": [], "seed.the_tuva_project.terminology__code_type": [], "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.data_quality__test_catalog": [], "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.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__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": [], "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.unique_core__condition_condition_id.ef1067e2f0": ["model.the_tuva_project.core__condition"], "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0": ["model.the_tuva_project.core__medical_claim"], "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5": ["model.the_tuva_project.core__procedure"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930": ["model.the_tuva_project.data_quality__claims_preprocessing_summary"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15": ["model.the_tuva_project.data_quality__claims_preprocessing_summary"], "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d": ["model.the_tuva_project.data_quality__claims_preprocessing_use_case"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47": ["model.the_tuva_project.data_quality__claims_preprocessing_use_case"], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa": ["model.the_tuva_project.data_quality__claims_preprocessing_use_case"], "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.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400": ["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.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f": ["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.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8": ["model.the_tuva_project.ccsr__singular_condition_category"], "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b": ["model.the_tuva_project.ccsr__singular_condition_category"], "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e": ["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.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320": ["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.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f": ["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.procedure": ["model.the_tuva_project.core__stg_clinical_procedure"], "model.input_layer.practitioner": ["model.the_tuva_project.core__stg_clinical_practitioner"], "model.input_layer.encounter": ["model.the_tuva_project.core__stg_clinical_encounter"], "model.input_layer.eligibility": ["model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__stg_eligibility"], "model.input_layer.medical_claim": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.cms_chronic_conditions__stg_medical_claim", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.emergency_department__summary", "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.cms_chronic_conditions__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.input_layer.patient": ["model.the_tuva_project.core__stg_clinical_patient"], "model.input_layer.condition": ["model.the_tuva_project.core__stg_clinical_condition"], "model.input_layer.medication": ["model.the_tuva_project.core__stg_clinical_medication"], "model.input_layer.observation": ["model.the_tuva_project.core__stg_clinical_observation"], "model.input_layer.lab_result": ["model.the_tuva_project.core__stg_clinical_lab_result"], "seed.input_layer.eligibility_seed": ["model.input_layer.eligibility"], "seed.input_layer.medical_claim_seed": ["model.input_layer.medical_claim"], "seed.input_layer.lab_result_seed": [], "seed.input_layer.pharmacy_claim_seed": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.insights__count_claim_by_claim_type": [], "model.the_tuva_project.insights__count_claim_by_service_category": [], "model.the_tuva_project.insights__trend_count_claim_by_claim_type": [], "model.the_tuva_project.insights__trend_sum_amount_by_claim_type": [], "model.the_tuva_project.insights__orphan_claim_by_claim_type": [], "model.the_tuva_project.insights__count_claim_by_date_column": [], "model.the_tuva_project.insights__trend_sum_amount_by_service_category": [], "model.the_tuva_project.insights__sum_amount_by_claim_type": [], "model.the_tuva_project.insights__sum_amount_by_service_category": [], "model.the_tuva_project.insights__trend_count_claim_by_service_category": [], "model.the_tuva_project.medical_claim_expanded": [], "model.the_tuva_project.core__stg_claims_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_location", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.core__stg_claims_practitioner", "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_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.financial_pmpm__stg_pharmacy_claim", "model.the_tuva_project.insights__count_claim_by_claim_type", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__orphan_claim_by_claim_type", "model.the_tuva_project.insights__sum_amount_by_claim_type", "model.the_tuva_project.insights__trend_sum_amount_by_claim_type", "model.the_tuva_project.quality_measures__stg_pharmacy_claim"], "model.the_tuva_project.core__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.hcc_suspecting__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.readmissions__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.cms_chronic_conditions__stg_core__patient", "model.the_tuva_project.cms_hcc__stg_core__patient", "model.the_tuva_project.ed_classification__stg_patient", "model.the_tuva_project.hcc_suspecting__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient"], "model.the_tuva_project.core__lab_result": ["model.the_tuva_project.quality_measures__stg_core__lab_result"], "model.the_tuva_project.core__encounter": ["model.the_tuva_project.ed_classification__stg_encounter", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.readmissions__stg_core__encounter"], "model.the_tuva_project.core__eligibility": ["model.the_tuva_project.cms_hcc__stg_core__eligibility", "model.the_tuva_project.financial_pmpm__stg_eligibility"], "model.the_tuva_project.core__procedure": ["model.the_tuva_project.ccsr__stg_core__procedure", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "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_hcc__stg_core__medical_claim", "model.the_tuva_project.financial_pmpm__stg_medical_claim", "model.the_tuva_project.insights__count_claim_by_claim_type", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__count_claim_by_service_category", "model.the_tuva_project.insights__count_claim_by_service_category", "model.the_tuva_project.insights__orphan_claim_by_claim_type", "model.the_tuva_project.insights__sum_amount_by_claim_type", "model.the_tuva_project.insights__sum_amount_by_service_category", "model.the_tuva_project.insights__sum_amount_by_service_category", "model.the_tuva_project.insights__trend_count_claim_by_claim_type", "model.the_tuva_project.insights__trend_count_claim_by_service_category", "model.the_tuva_project.insights__trend_count_claim_by_service_category", "model.the_tuva_project.insights__trend_sum_amount_by_claim_type", "model.the_tuva_project.insights__trend_sum_amount_by_service_category", "model.the_tuva_project.insights__trend_sum_amount_by_service_category", "model.the_tuva_project.quality_measures__stg_medical_claim", "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0"], "model.the_tuva_project.core__location": [], "model.the_tuva_project.core__medication": ["model.the_tuva_project.quality_measures__stg_core__medication"], "model.the_tuva_project.core__observation": ["model.the_tuva_project.quality_measures__stg_core__observation"], "model.the_tuva_project.core__practitioner": [], "model.the_tuva_project.data_quality__claims_preprocessing_use_case": ["test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6"], "model.the_tuva_project.data_quality__claims_preprocessing_summary": ["model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_eligibility", "model.the_tuva_project.core__stg_claims_encounter", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_patient", "model.the_tuva_project.core__stg_claims_pharmacy_claim", "model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.core__stg_claims_procedure", "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result": ["test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27", "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"], "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"], "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_test_detail"], "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim": ["model.the_tuva_project.data_quality__claims_preprocessing_test_result"], "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values": ["model.the_tuva_project.data_quality__claims_preprocessing_summary", "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"], "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.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__condition": [], "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.readmissions__encounter_overlap": ["model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.readmissions__readmission_crude", "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_discharge_requirement", "model.the_tuva_project.readmissions__index_time_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__planned_encounter", "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__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__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.cms_hcc__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", "model.the_tuva_project.cms_hcc__patient_risk_factors", "test.the_tuva_project.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400"], "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.emergency_department__stg_eligibility": [], "model.the_tuva_project.emergency_department__stg_medical_claim": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_first_claim_values", "model.the_tuva_project.emergency_department__int_institutional_claims", "model.the_tuva_project.emergency_department__int_last_claim_values", "model.the_tuva_project.emergency_department__int_professional_encounter_id"], "model.the_tuva_project.emergency_department__stg_service_category": ["model.the_tuva_project.emergency_department__int_institutional_claims", "model.the_tuva_project.emergency_department__int_professional_encounter_id"], "model.the_tuva_project.emergency_department__summary": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.emergency_department__int_encounter_id": ["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.emergency_department__int_first_claim_values", "model.the_tuva_project.emergency_department__int_last_claim_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.emergency_department__summary"], "model.the_tuva_project.emergency_department__int_first_claim_values": ["model.the_tuva_project.emergency_department__summary"], "model.the_tuva_project.emergency_department__int_institutional_claims": ["model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "model.the_tuva_project.emergency_department__int_institutional_encounter_id"], "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates": ["model.the_tuva_project.emergency_department__int_professional_encounter_id", "model.the_tuva_project.emergency_department__summary"], "model.the_tuva_project.emergency_department__int_last_claim_values": ["model.the_tuva_project.emergency_department__summary"], "model.the_tuva_project.emergency_department__int_professional_encounter_id": ["model.the_tuva_project.emergency_department__int_encounter_id"], "model.the_tuva_project.emergency_department__int_institutional_encounter_id": ["model.the_tuva_project.emergency_department__int_encounter_id", "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "model.the_tuva_project.emergency_department__summary"], "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_diagnosis_code_normalize", "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__int_diagnosis_code_normalize", "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__int_diagnosis_code_normalize", "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__int_diagnosis_code_normalize", "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__int_diagnosis_code_normalize", "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__int_diagnosis_code_normalize", "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__int_diagnosis_code_normalize", "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__int_diagnosis_code_normalize", "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__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_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_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_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_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_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_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.acute_inpatient__stg_eligibility", "model.the_tuva_project.core__stg_claims_eligibility", "model.the_tuva_project.core__stg_claims_patient", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.emergency_department__stg_eligibility"], "model.the_tuva_project.normalized_input__pharmacy_claim": ["model.the_tuva_project.core__stg_claims_pharmacy_claim", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case"], "model.the_tuva_project.normalized_input__medical_claim": ["model.the_tuva_project.acute_inpatient__stg_medical_claim", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_condition", "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.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "model.the_tuva_project.emergency_department__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "test.the_tuva_project.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f"], "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__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_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_procedure_code_voting", "model.the_tuva_project.normalized_input__int_procedure_date_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_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.service_category__stg_medical_claim": ["model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__acute_inpatient_institutional", "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_institutional", "model.the_tuva_project.service_category__dialysis_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__dq_input_layer_tests", "model.the_tuva_project.service_category__duplicate_bill_types", "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__hospice_institutional", "model.the_tuva_project.service_category__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_institutional", "model.the_tuva_project.service_category__lab_professional", "model.the_tuva_project.service_category__office_visit_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_psychiatric_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "model.the_tuva_project.service_category__outpatient_rehab_professional", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.service_category__skilled_nursing_institutional", "model.the_tuva_project.service_category__skilled_nursing_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__dq_input_layer_results": [], "model.the_tuva_project.service_category__dq_multiple_service_categories_professional": [], "model.the_tuva_project.service_category__dq_multiple_service_categories_institutional": [], "model.the_tuva_project.service_category__dq_input_layer_tests": ["model.the_tuva_project.service_category__dq_input_layer_results"], "model.the_tuva_project.service_category__service_category_grouper": ["model.the_tuva_project.acute_inpatient__stg_service_category", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.emergency_department__stg_service_category"], "model.the_tuva_project.service_category__hospice_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__duplicate_bill_types": ["model.the_tuva_project.service_category__combined_institutional"], "model.the_tuva_project.service_category__dialysis_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__lab_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "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"], "model.the_tuva_project.service_category__dme_professional": ["model.the_tuva_project.service_category__ambulatory_surgery_professional", "model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__home_health_professional", "model.the_tuva_project.service_category__skilled_nursing_professional"], "model.the_tuva_project.service_category__home_health_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "model.the_tuva_project.service_category__emergency_department_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__skilled_nursing_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "model.the_tuva_project.service_category__hospice_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "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__skilled_nursing_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__lab_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__combined_institutional": ["model.the_tuva_project.service_category__dq_multiple_service_categories_institutional", "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", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional"], "model.the_tuva_project.service_category__acute_inpatient_institutional": ["model.the_tuva_project.service_category__combined_institutional", "model.the_tuva_project.service_category__emergency_department_institutional"], "model.the_tuva_project.service_category__office_visit_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__combined_professional": ["model.the_tuva_project.service_category__dq_multiple_service_categories_professional", "model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.service_category__ambulance_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_psychiatric_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__emergency_department_institutional": ["model.the_tuva_project.service_category__combined_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__urgent_care_institutional"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": ["model.the_tuva_project.service_category__combined_institutional"], "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"], "model.the_tuva_project.service_category__acute_inpatient_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.acute_inpatient__stg_medical_claim": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__first_claim_values", "model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__last_claim_values", "model.the_tuva_project.acute_inpatient__professional_encounter_id", "model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__stg_service_category": ["model.the_tuva_project.acute_inpatient__institutional_claims", "model.the_tuva_project.acute_inpatient__professional_encounter_id"], "model.the_tuva_project.acute_inpatient__stg_eligibility": ["model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__summary": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.acute_inpatient__professional_encounter_id": ["model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims", "model.the_tuva_project.acute_inpatient__encounter_id"], "model.the_tuva_project.acute_inpatient__last_claim_values": ["model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims": [], "model.the_tuva_project.acute_inpatient__data_quality_summary": [], "model.the_tuva_project.acute_inpatient__institutional_encounter_id": ["model.the_tuva_project.acute_inpatient__encounter_id", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates": ["model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "model.the_tuva_project.acute_inpatient__professional_encounter_id", "model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__claims_with_encounter_data": ["model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims"], "model.the_tuva_project.acute_inpatient__first_claim_values": ["model.the_tuva_project.acute_inpatient__summary"], "model.the_tuva_project.acute_inpatient__encounter_id": ["model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "model.the_tuva_project.acute_inpatient__first_claim_values", "model.the_tuva_project.acute_inpatient__last_claim_values", "model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.acute_inpatient__summary", "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.acute_inpatient__institutional_claims": ["model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__data_quality_summary", "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "model.the_tuva_project.acute_inpatient__institutional_encounter_id"], "model.the_tuva_project.quality_measures__stg_medical_claim": ["model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0059__frailty", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_institutional_snp", "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "model.the_tuva_project.quality_measures__int_nqf2372_numerator"], "model.the_tuva_project.quality_measures__stg_core__patient": ["model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_long", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_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_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0059__frailty", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "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_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_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_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0059__frailty", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "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_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_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia"], "model.the_tuva_project.quality_measures__stg_core__procedure": ["model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0059__frailty", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "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_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_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.quality_measures__summary_counts", "model.the_tuva_project.quality_measures__summary_wide"], "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__frailty": ["model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness": ["model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional": ["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_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_exclude_dementia": ["model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative": ["model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "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__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "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_nqf2372_exclude_hospice": ["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__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "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_exclude_dementia": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions"], "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__frailty", "model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "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__frailty": ["model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions"], "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_nqf0059__frailty": ["model.the_tuva_project.quality_measures__int_nqf0059_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia"], "model.the_tuva_project.quality_measures__int_nqf0059_denominator": ["model.the_tuva_project.quality_measures__int_nqf0059__frailty", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_institutional_snp", "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_exclude_institutional_snp": ["model.the_tuva_project.quality_measures__int_nqf0059_exclusions"], "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_exclude_advanced_illness": ["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_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative"], "model.the_tuva_project.quality_measures__int_nqf0059_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia": ["model.the_tuva_project.quality_measures__int_nqf0059_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative": ["model.the_tuva_project.quality_measures__int_nqf0059_exclusions"], "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": ["test.the_tuva_project.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8", "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b"], "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.ccsr__procedure_category_map": ["model.the_tuva_project.ccsr__long_procedure_category"], "model.the_tuva_project.financial_pmpm__stg_eligibility": ["model.the_tuva_project.financial_pmpm__member_months"], "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.financial_pmpm__pmpm_prep": ["model.the_tuva_project.financial_pmpm__pmpm_payer", "model.the_tuva_project.financial_pmpm__pmpm_payer_plan", "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e"], "model.the_tuva_project.financial_pmpm__member_months": ["model.the_tuva_project.financial_pmpm__pmpm_prep", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.insights__orphan_claim_by_claim_type", "model.the_tuva_project.insights__orphan_claim_by_claim_type"], "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__condition": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions"], "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__summary"], "model.the_tuva_project.hcc_suspecting__summary": [], "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history": ["model.the_tuva_project.hcc_suspecting__list"], "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_prep_conditions": ["model.the_tuva_project.hcc_suspecting__int_all_conditions"], "model.the_tuva_project.cms_chronic_conditions__stg_pharmacy_claim": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"], "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_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__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", "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f"], "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.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", "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320"], "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__summary", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_admit_type_voting"], "seed.the_tuva_project.terminology__ssa_fips_state": [], "seed.the_tuva_project.terminology__medicare_orec": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__gender": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__ethnicity": [], "seed.the_tuva_project.terminology__ms_drg": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_ms_drg_voting", "model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__revenue_center": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__icd_9_cm": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize"], "seed.the_tuva_project.terminology__race": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__rxnorm_to_atc": [], "seed.the_tuva_project.terminology__medicare_status": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__loinc_deprecated_mapping": [], "seed.the_tuva_project.terminology__place_of_service": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__discharge_disposition": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_discharge_disposition_voting", "model.the_tuva_project.readmissions__encounter_data_quality"], "seed.the_tuva_project.terminology__icd_9_pcs": ["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__claims_preprocessing_medical_claim_invalid_values", "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__summary", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_admit_source_voting"], "seed.the_tuva_project.terminology__calendar": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.financial_pmpm__member_months", "model.the_tuva_project.insights__count_claim_by_date_column", "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "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_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_medical_claim_date_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.terminology__other_provider_taxonomy": [], "seed.the_tuva_project.terminology__icd_10_cm": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "model.the_tuva_project.readmissions__encounter_with_ccs"], "seed.the_tuva_project.terminology__claim_type": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__hcpcs_level_2": ["model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__fips_county": [], "seed.the_tuva_project.terminology__ndc": [], "seed.the_tuva_project.terminology__ansi_fips_state": [], "seed.the_tuva_project.terminology__encounter_type": [], "seed.the_tuva_project.terminology__provider": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "model.the_tuva_project.ed_classification__summary", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "model.the_tuva_project.normalized_input__int_medical_npi_normalize"], "seed.the_tuva_project.terminology__payer_type": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__apr_drg": ["model.the_tuva_project.acute_inpatient__summary", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.emergency_department__summary", "model.the_tuva_project.normalized_input__int_apr_drg_voting", "model.the_tuva_project.service_category__acute_inpatient_institutional", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__icd_10_pcs": ["model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.readmissions__procedure_ccs"], "seed.the_tuva_project.terminology__code_type": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values"], "seed.the_tuva_project.terminology__medicare_dual_eligibility": ["model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"], "seed.the_tuva_project.terminology__bill_type": ["model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.normalized_input__int_bill_type_voting", "model.the_tuva_project.service_category__dq_input_layer_tests"], "seed.the_tuva_project.terminology__loinc": [], "seed.the_tuva_project.terminology__snomed_icd_10_map": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions"], "seed.the_tuva_project.data_quality__test_catalog": ["model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details", "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details"], "seed.the_tuva_project.service_category__service_categories": [], "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", "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_nqf0034__frailty", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0059__frailty", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0059_numerator", "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "model.the_tuva_project.quality_measures__int_nqf2372_numerator"], "seed.the_tuva_project.quality_measures__measures": ["model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "model.the_tuva_project.quality_measures__int_nqf2372__performance_period"], "seed.the_tuva_project.quality_measures__concepts": [], "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": ["model.the_tuva_project.ccsr__dx_vertical_pivot"], "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"], "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"], "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide", "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"], "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", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"], "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.unique_core__condition_condition_id.ef1067e2f0": [], "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0": [], "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15": [], "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47": [], "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa": [], "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126": [], "test.the_tuva_project.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400": [], "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.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f": [], "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.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8": [], "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b": [], "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e": [], "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.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320": [], "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.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f": [], "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": []}} \ No newline at end of file diff --git a/docs/run_results.json b/docs/run_results.json index 5994f5ba9..c6a11778f 100644 --- a/docs/run_results.json +++ b/docs/run_results.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v5.json", "dbt_version": "1.7.8", "generated_at": "2024-02-20T20:47:53.687235Z", "invocation_id": "de423a96-1d69-4b7f-8c18-885e2c4bbec4", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.876654Z", "completed_at": "2024-02-20T20:47:49.911076Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.912696Z", "completed_at": "2024-02-20T20:47:49.912706Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.03996586799621582, "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\nlimit 0", "relation_name": "tuva.input_layer.condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.888503Z", "completed_at": "2024-02-20T20:47:49.911356Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.913138Z", "completed_at": "2024-02-20T20:47:49.913141Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.04015994071960449, "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 facility_npi\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\nlimit 0", "relation_name": "tuva.input_layer.encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.897063Z", "completed_at": "2024-02-20T20:47:49.912004Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.914121Z", "completed_at": "2024-02-20T20:47:49.914124Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.040761709213256836, "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\nlimit 0", "relation_name": "tuva.input_layer.lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.904037Z", "completed_at": "2024-02-20T20:47:49.912443Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.914817Z", "completed_at": "2024-02-20T20:47:49.914820Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.041115760803222656, "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\nlimit 0", "relation_name": "tuva.input_layer.location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.919040Z", "completed_at": "2024-02-20T20:47:49.936705Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.938008Z", "completed_at": "2024-02-20T20:47:49.938015Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.022311925888061523, "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\nlimit 0", "relation_name": "tuva.input_layer.medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.925777Z", "completed_at": "2024-02-20T20:47:49.937031Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.938399Z", "completed_at": "2024-02-20T20:47:49.938401Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.02221393585205078, "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\nlimit 0", "relation_name": "tuva.input_layer.observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.930629Z", "completed_at": "2024-02-20T20:47:49.937469Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.939216Z", "completed_at": "2024-02-20T20:47:49.939218Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.022231101989746094, "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 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\nlimit 0", "relation_name": "tuva.input_layer.patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.934212Z", "completed_at": "2024-02-20T20:47:49.937809Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.939804Z", "completed_at": "2024-02-20T20:47:49.939807Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.022357940673828125, "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\nlimit 0", "relation_name": "tuva.input_layer.practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.956694Z", "completed_at": "2024-02-20T20:47:49.959832Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.963871Z", "completed_at": "2024-02-20T20:47:49.963876Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.02231621742248535, "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-02-20T20:47:49.943363Z", "completed_at": "2024-02-20T20:47:49.961035Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.964114Z", "completed_at": "2024-02-20T20:47:49.964116Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.023985862731933594, "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\nlimit 0", "relation_name": "tuva.input_layer.procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.961855Z", "completed_at": "2024-02-20T20:47:49.962749Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.964512Z", "completed_at": "2024-02-20T20:47:49.964514Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.022838115692138672, "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-02-20T20:47:49.947336Z", "completed_at": "2024-02-20T20:47:49.963467Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.965559Z", "completed_at": "2024-02-20T20:47:49.965561Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.024981021881103516, "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": "raw.quality_measures._int_nqf0034__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:49.969467Z", "completed_at": "2024-02-20T20:47:49.970123Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.973841Z", "completed_at": "2024-02-20T20:47:49.973845Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007481813430786133, "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-02-20T20:47:49.970427Z", "completed_at": "2024-02-20T20:47:49.970982Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.974054Z", "completed_at": "2024-02-20T20:47:49.974056Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007534027099609375, "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-02-20T20:47:49.971385Z", "completed_at": "2024-02-20T20:47:49.972018Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.974416Z", "completed_at": "2024-02-20T20:47:49.974418Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.007566213607788086, "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-02-20T20:47:49.972786Z", "completed_at": "2024-02-20T20:47:49.973450Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.975415Z", "completed_at": "2024-02-20T20:47:49.975417Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.0075800418853759766, "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-02-20T20:47:49.978943Z", "completed_at": "2024-02-20T20:47:49.979618Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.982835Z", "completed_at": "2024-02-20T20:47:49.982838Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.0065746307373046875, "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-02-20T20:47:49.979812Z", "completed_at": "2024-02-20T20:47:49.980398Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.983012Z", "completed_at": "2024-02-20T20:47:49.983014Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006619930267333984, "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-02-20T20:47:49.980808Z", "completed_at": "2024-02-20T20:47:49.981418Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.983355Z", "completed_at": "2024-02-20T20:47:49.983357Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.006620883941650391, "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-02-20T20:47:49.981942Z", "completed_at": "2024-02-20T20:47:49.982492Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.984223Z", "completed_at": "2024-02-20T20:47:49.984224Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006757259368896484, "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-02-20T20:47:49.987486Z", "completed_at": "2024-02-20T20:47:49.988950Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.992371Z", "completed_at": "2024-02-20T20:47:49.992375Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007634878158569336, "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-02-20T20:47:49.989199Z", "completed_at": "2024-02-20T20:47:49.989796Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.992573Z", "completed_at": "2024-02-20T20:47:49.992575Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007740020751953125, "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-02-20T20:47:49.990137Z", "completed_at": "2024-02-20T20:47:49.990778Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.992936Z", "completed_at": "2024-02-20T20:47:49.992938Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.007857084274291992, "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-02-20T20:47:49.991354Z", "completed_at": "2024-02-20T20:47:49.991990Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:49.993991Z", "completed_at": "2024-02-20T20:47:49.993993Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.008102178573608398, "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-02-20T20:47:49.997830Z", "completed_at": "2024-02-20T20:47:49.999504Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.003294Z", "completed_at": "2024-02-20T20:47:50.003299Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008603096008300781, "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-02-20T20:47:49.999885Z", "completed_at": "2024-02-20T20:47:50.000584Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.003500Z", "completed_at": "2024-02-20T20:47:50.003502Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.008747100830078125, "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-02-20T20:47:50.001048Z", "completed_at": "2024-02-20T20:47:50.001733Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.003848Z", "completed_at": "2024-02-20T20:47:50.003849Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.008810997009277344, "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-02-20T20:47:50.002336Z", "completed_at": "2024-02-20T20:47:50.002936Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.004946Z", "completed_at": "2024-02-20T20:47:50.004948Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.009082794189453125, "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-02-20T20:47:50.008594Z", "completed_at": "2024-02-20T20:47:50.009293Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.014337Z", "completed_at": "2024-02-20T20:47:50.014340Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.00857400894165039, "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-02-20T20:47:50.009568Z", "completed_at": "2024-02-20T20:47:50.010167Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.014523Z", "completed_at": "2024-02-20T20:47:50.014525Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.008593082427978516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__test_catalog", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.010546Z", "completed_at": "2024-02-20T20:47:50.011187Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.014856Z", "completed_at": "2024-02-20T20:47:50.014858Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.00858616828918457, "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-02-20T20:47:50.011983Z", "completed_at": "2024-02-20T20:47:50.013951Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.015755Z", "completed_at": "2024-02-20T20:47:50.015757Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.00869894027709961, "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-02-20T20:47:50.018949Z", "completed_at": "2024-02-20T20:47:50.019615Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.022771Z", "completed_at": "2024-02-20T20:47:50.022772Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.006340980529785156, "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-02-20T20:47:50.019800Z", "completed_at": "2024-02-20T20:47:50.020353Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.022950Z", "completed_at": "2024-02-20T20:47:50.022952Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0063931941986083984, "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-02-20T20:47:50.020741Z", "completed_at": "2024-02-20T20:47:50.021288Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.023289Z", "completed_at": "2024-02-20T20:47:50.023291Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.006464958190917969, "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-02-20T20:47:50.021781Z", "completed_at": "2024-02-20T20:47:50.022332Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.024147Z", "completed_at": "2024-02-20T20:47:50.024149Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006806850433349609, "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-02-20T20:47:50.029258Z", "completed_at": "2024-02-20T20:47:50.030026Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.033101Z", "completed_at": "2024-02-20T20:47:50.033104Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008044004440307617, "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-02-20T20:47:50.030239Z", "completed_at": "2024-02-20T20:47:50.030810Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.033288Z", "completed_at": "2024-02-20T20:47:50.033290Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007370948791503906, "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-02-20T20:47:50.031177Z", "completed_at": "2024-02-20T20:47:50.031715Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.033620Z", "completed_at": "2024-02-20T20:47:50.033622Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.0069730281829833984, "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-02-20T20:47:50.032229Z", "completed_at": "2024-02-20T20:47:50.032773Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.034637Z", "completed_at": "2024-02-20T20:47:50.034639Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007245063781738281, "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-02-20T20:47:50.038607Z", "completed_at": "2024-02-20T20:47:50.039247Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.043593Z", "completed_at": "2024-02-20T20:47:50.043596Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007882833480834961, "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-02-20T20:47:50.039449Z", "completed_at": "2024-02-20T20:47:50.040061Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.043779Z", "completed_at": "2024-02-20T20:47:50.043780Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.00794219970703125, "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-02-20T20:47:50.040429Z", "completed_at": "2024-02-20T20:47:50.041003Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.044133Z", "completed_at": "2024-02-20T20:47:50.044134Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.0080108642578125, "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-02-20T20:47:50.041525Z", "completed_at": "2024-02-20T20:47:50.043223Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.045096Z", "completed_at": "2024-02-20T20:47:50.045098Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.008157968521118164, "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-02-20T20:47:50.048533Z", "completed_at": "2024-02-20T20:47:50.049173Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.052380Z", "completed_at": "2024-02-20T20:47:50.052383Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.006625175476074219, "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-02-20T20:47:50.049370Z", "completed_at": "2024-02-20T20:47:50.049970Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.052583Z", "completed_at": "2024-02-20T20:47:50.052584Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006645917892456055, "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-02-20T20:47:50.050367Z", "completed_at": "2024-02-20T20:47:50.050991Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.052944Z", "completed_at": "2024-02-20T20:47:50.052945Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.0066089630126953125, "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-02-20T20:47:50.051493Z", "completed_at": "2024-02-20T20:47:50.052041Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.053804Z", "completed_at": "2024-02-20T20:47:50.053806Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006784915924072266, "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-02-20T20:47:50.057081Z", "completed_at": "2024-02-20T20:47:50.057689Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.062214Z", "completed_at": "2024-02-20T20:47:50.062224Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008826017379760742, "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-02-20T20:47:50.057876Z", "completed_at": "2024-02-20T20:47:50.058437Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.062985Z", "completed_at": "2024-02-20T20:47:50.062994Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.008941173553466797, "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-02-20T20:47:50.058809Z", "completed_at": "2024-02-20T20:47:50.059384Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.063785Z", "completed_at": "2024-02-20T20:47:50.063788Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.009055852890014648, "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-02-20T20:47:50.060007Z", "completed_at": "2024-02-20T20:47:50.060643Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.064836Z", "completed_at": "2024-02-20T20:47:50.064838Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.009263038635253906, "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-02-20T20:47:50.068117Z", "completed_at": "2024-02-20T20:47:50.068834Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.074039Z", "completed_at": "2024-02-20T20:47:50.074042Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008543014526367188, "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-02-20T20:47:50.069024Z", "completed_at": "2024-02-20T20:47:50.069600Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.074225Z", "completed_at": "2024-02-20T20:47:50.074227Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.008621931076049805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ansi_fips_state", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.069934Z", "completed_at": "2024-02-20T20:47:50.072364Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.074574Z", "completed_at": "2024-02-20T20:47:50.074576Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.008675098419189453, "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-02-20T20:47:50.073072Z", "completed_at": "2024-02-20T20:47:50.073704Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.075500Z", "completed_at": "2024-02-20T20:47:50.075502Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.008927106857299805, "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-02-20T20:47:50.078986Z", "completed_at": "2024-02-20T20:47:50.079635Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.083088Z", "completed_at": "2024-02-20T20:47:50.083091Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.0068209171295166016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__calendar", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.079855Z", "completed_at": "2024-02-20T20:47:50.080561Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.083267Z", "completed_at": "2024-02-20T20:47:50.083269Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0068547725677490234, "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-02-20T20:47:50.081013Z", "completed_at": "2024-02-20T20:47:50.081667Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.083589Z", "completed_at": "2024-02-20T20:47:50.083591Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.0068511962890625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__code_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.082220Z", "completed_at": "2024-02-20T20:47:50.082750Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.084506Z", "completed_at": "2024-02-20T20:47:50.084508Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006997108459472656, "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-02-20T20:47:50.087799Z", "completed_at": "2024-02-20T20:47:50.088423Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.091759Z", "completed_at": "2024-02-20T20:47:50.091762Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.006746768951416016, "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-02-20T20:47:50.088614Z", "completed_at": "2024-02-20T20:47:50.089167Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.091942Z", "completed_at": "2024-02-20T20:47:50.091944Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006853818893432617, "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-02-20T20:47:50.089531Z", "completed_at": "2024-02-20T20:47:50.090139Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.092315Z", "completed_at": "2024-02-20T20:47:50.092317Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.006938934326171875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__fips_county", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.090793Z", "completed_at": "2024-02-20T20:47:50.091406Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.093314Z", "completed_at": "2024-02-20T20:47:50.093316Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.009617090225219727, "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-02-20T20:47:50.098005Z", "completed_at": "2024-02-20T20:47:50.098737Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.102561Z", "completed_at": "2024-02-20T20:47:50.102563Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.009019851684570312, "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-02-20T20:47:50.099099Z", "completed_at": "2024-02-20T20:47:50.100857Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.102882Z", "completed_at": "2024-02-20T20:47:50.102884Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007877826690673828, "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-02-20T20:47:50.101458Z", "completed_at": "2024-02-20T20:47:50.102028Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.104097Z", "completed_at": "2024-02-20T20:47:50.104099Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.007723808288574219, "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-02-20T20:47:50.103053Z", "completed_at": "2024-02-20T20:47:50.103581Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.105525Z", "completed_at": "2024-02-20T20:47:50.105527Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.005517005920410156, "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-02-20T20:47:50.107523Z", "completed_at": "2024-02-20T20:47:50.108136Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.111553Z", "completed_at": "2024-02-20T20:47:50.111557Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007252931594848633, "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-02-20T20:47:50.108550Z", "completed_at": "2024-02-20T20:47:50.109430Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.111889Z", "completed_at": "2024-02-20T20:47:50.111890Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007359981536865234, "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-02-20T20:47:50.110230Z", "completed_at": "2024-02-20T20:47:50.110955Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.113217Z", "completed_at": "2024-02-20T20:47:50.113219Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.007360935211181641, "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-02-20T20:47:50.112061Z", "completed_at": "2024-02-20T20:47:50.112638Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.114717Z", "completed_at": "2024-02-20T20:47:50.114719Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006039142608642578, "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-02-20T20:47:50.116807Z", "completed_at": "2024-02-20T20:47:50.117478Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.120240Z", "completed_at": "2024-02-20T20:47:50.120242Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0068209171295166016, "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-02-20T20:47:50.117901Z", "completed_at": "2024-02-20T20:47:50.118562Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.120666Z", "completed_at": "2024-02-20T20:47:50.120668Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.00687408447265625, "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-02-20T20:47:50.119190Z", "completed_at": "2024-02-20T20:47:50.119752Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.121951Z", "completed_at": "2024-02-20T20:47:50.121953Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.006780147552490234, "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-02-20T20:47:50.120859Z", "completed_at": "2024-02-20T20:47:50.121417Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.123382Z", "completed_at": "2024-02-20T20:47:50.123383Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.005667209625244141, "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-02-20T20:47:50.125399Z", "completed_at": "2024-02-20T20:47:50.127087Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.129751Z", "completed_at": "2024-02-20T20:47:50.129753Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007603883743286133, "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-02-20T20:47:50.127507Z", "completed_at": "2024-02-20T20:47:50.128053Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.130077Z", "completed_at": "2024-02-20T20:47:50.130079Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007687091827392578, "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-02-20T20:47:50.128635Z", "completed_at": "2024-02-20T20:47:50.129175Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.131406Z", "completed_at": "2024-02-20T20:47:50.131408Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.007685184478759766, "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-02-20T20:47:50.130258Z", "completed_at": "2024-02-20T20:47:50.130851Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.132931Z", "completed_at": "2024-02-20T20:47:50.132933Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.005751132965087891, "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-02-20T20:47:50.135015Z", "completed_at": "2024-02-20T20:47:50.135648Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.138269Z", "completed_at": "2024-02-20T20:47:50.138271Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006529092788696289, "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-02-20T20:47:50.135993Z", "completed_at": "2024-02-20T20:47:50.136567Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.138612Z", "completed_at": "2024-02-20T20:47:50.138614Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.006571054458618164, "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-02-20T20:47:50.137198Z", "completed_at": "2024-02-20T20:47:50.137770Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.139880Z", "completed_at": "2024-02-20T20:47:50.139882Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.00654911994934082, "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-02-20T20:47:50.138790Z", "completed_at": "2024-02-20T20:47:50.139338Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.141328Z", "completed_at": "2024-02-20T20:47:50.141330Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.005600690841674805, "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-02-20T20:47:50.143328Z", "completed_at": "2024-02-20T20:47:50.143934Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.146550Z", "completed_at": "2024-02-20T20:47:50.146552Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.013455867767333984, "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-02-20T20:47:50.144283Z", "completed_at": "2024-02-20T20:47:50.144846Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.146900Z", "completed_at": "2024-02-20T20:47:50.146902Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.013543844223022461, "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-02-20T20:47:50.145499Z", "completed_at": "2024-02-20T20:47:50.146046Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.155214Z", "completed_at": "2024-02-20T20:47:50.155216Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.013412714004516602, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ssa_fips_state", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.147073Z", "completed_at": "2024-02-20T20:47:50.156581Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.158612Z", "completed_at": "2024-02-20T20:47:50.158616Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.027112960815429688, "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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.condition", "relation_name": "raw.core._stg_clinical_condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.158809Z", "completed_at": "2024-02-20T20:47:50.176526Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.178093Z", "completed_at": "2024-02-20T20:47:50.178095Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.02727794647216797, "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 , 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(facility_npi as TEXT ) as facility_npi\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(data_source as TEXT ) as data_source\n , cast('2024-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.encounter", "relation_name": "raw.core._stg_clinical_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.165217Z", "completed_at": "2024-02-20T20:47:50.176777Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.178279Z", "completed_at": "2024-02-20T20:47:50.178281Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.027015209197998047, "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 integer ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as integer ) 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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.lab_result", "relation_name": "raw.core._stg_clinical_lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.172468Z", "completed_at": "2024-02-20T20:47:50.177236Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.183752Z", "completed_at": "2024-02-20T20:47:50.183754Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.0267789363861084, "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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.location", "relation_name": "raw.core._stg_clinical_location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.178463Z", "completed_at": "2024-02-20T20:47:50.185441Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.187356Z", "completed_at": "2024-02-20T20:47:50.187358Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01694202423095703, "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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.medication", "relation_name": "raw.core._stg_clinical_medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.187900Z", "completed_at": "2024-02-20T20:47:50.204564Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.206440Z", "completed_at": "2024-02-20T20:47:50.206444Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.022556066513061523, "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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.observation", "relation_name": "raw.core._stg_clinical_observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.194178Z", "completed_at": "2024-02-20T20:47:50.205468Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.208270Z", "completed_at": "2024-02-20T20:47:50.208273Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.0226900577545166, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_patient", "compiled": true, "compiled_code": "\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(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('2024-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\n\nfrom tuva.input_layer.patient", "relation_name": "raw.core._stg_clinical_patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.199476Z", "completed_at": "2024-02-20T20:47:50.206090Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.208910Z", "completed_at": "2024-02-20T20:47:50.208912Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.02322697639465332, "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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.practitioner", "relation_name": "raw.core._stg_clinical_practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.206632Z", "completed_at": "2024-02-20T20:47:50.209769Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.211764Z", "completed_at": "2024-02-20T20:47:50.211766Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.012462139129638672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.eligibility", "compiled": true, "compiled_code": "select\n patient_id\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\nfrom raw._tuva_synthetic.eligibility_seed", "relation_name": "tuva.input_layer.eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.212440Z", "completed_at": "2024-02-20T20:47:50.221102Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.222568Z", "completed_at": "2024-02-20T20:47:50.222571Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.016349315643310547, "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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.procedure", "relation_name": "raw.core._stg_clinical_procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.217963Z", "completed_at": "2024-02-20T20:47:50.221978Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.227178Z", "completed_at": "2024-02-20T20:47:50.227181Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.016689300537109375, "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 , billing_npi\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 , data_source\nfrom raw._tuva_synthetic.medical_claim_seed", "relation_name": "tuva.input_layer.medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.219781Z", "completed_at": "2024-02-20T20:47:50.222355Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.227411Z", "completed_at": "2024-02-20T20:47:50.227413Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.016571044921875, "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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\nfrom raw._tuva_synthetic.pharmacy_claim_seed", "relation_name": "tuva.input_layer.pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.222967Z", "completed_at": "2024-02-20T20:47:50.228203Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.230469Z", "completed_at": "2024-02-20T20:47:50.230472Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.012442827224731445, "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 raw.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 left(ccsr_category_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 (ccsr_category_1 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_1 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_2, 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 (ccsr_category_2 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_2 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_3, 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 (ccsr_category_3 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_3 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_4, 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 (ccsr_category_4 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_4 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_5, 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 (ccsr_category_5 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_5 = default_ccsr_category_op) as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n left(ccsr_category_6, 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 (ccsr_category_6 = default_ccsr_category_ip) as is_ip_default_category,\n (ccsr_category_6 = default_ccsr_category_op) as is_op_default_category\n from codes \n \n\n)\n\nselect distinct\n *,\n '2024-02-20 20:47:44.615990+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": "raw.ccsr.dx_vertical_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.230996Z", "completed_at": "2024-02-20T20:47:50.244035Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.245678Z", "completed_at": "2024-02-20T20:47:50.245682Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.019427776336669922, "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 left(prccsr, 3) as ccsr_parent_category,\n prccsr_description as ccsr_category_description,\n clinical_domain,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.ccsr._value_set_prccsr_v2023_1_cleaned_map", "relation_name": "raw.ccsr.procedure_category_map"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.234323Z", "completed_at": "2024-02-20T20:47:50.244710Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.247860Z", "completed_at": "2024-02-20T20:47:50.247862Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.018758058547973633, "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 raw.ed_classification._value_set_johnston_icd10\nwhere icd10 is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.241125Z", "completed_at": "2024-02-20T20:47:50.245284Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.248517Z", "completed_at": "2024-02-20T20:47:50.248520Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.018980979919433594, "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 raw.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-02-20T20:47:50.245893Z", "completed_at": "2024-02-20T20:47:50.249130Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.251207Z", "completed_at": "2024-02-20T20:47:50.251209Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007967948913574219, "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 raw.ed_classification._value_set_johnston_icd9\nwhere icd9 is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.252533Z", "completed_at": "2024-02-20T20:47:50.262008Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.263155Z", "completed_at": "2024-02-20T20:47:50.263160Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.015280008316040039, "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 raw.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-02-20T20:47:50.254782Z", "completed_at": "2024-02-20T20:47:50.262787Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.266032Z", "completed_at": "2024-02-20T20:47:50.266035Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.016180038452148438, "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 raw.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_id\n , cast((select name\nfrom raw.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_name\n , cast((select version\nfrom raw.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": "raw.quality_measures._int_nqf2372__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.259342Z", "completed_at": "2024-02-20T20:47:50.263340Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.266541Z", "completed_at": "2024-02-20T20:47:50.266543Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.016086101531982422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__encounter", "compiled": true, "compiled_code": "\n\nselect * from raw.core._stg_clinical_encounter\n\n", "relation_name": "raw.core.encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.263671Z", "completed_at": "2024-02-20T20:47:50.266726Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.268768Z", "completed_at": "2024-02-20T20:47:50.268770Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.02056598663330078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__lab_result", "compiled": true, "compiled_code": "\n\nselect * from raw.core._stg_clinical_lab_result", "relation_name": "raw.core.lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.269268Z", "completed_at": "2024-02-20T20:47:50.283713Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.332905Z", "completed_at": "2024-02-20T20:47:50.332908Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.06827020645141602, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__medication", "compiled": true, "compiled_code": "\n\n\nselect * from raw.core._stg_clinical_medication", "relation_name": "raw.core.medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.283936Z", "completed_at": "2024-02-20T20:47:50.335082Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.336804Z", "completed_at": "2024-02-20T20:47:50.336806Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.06903386116027832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__observation", "compiled": true, "compiled_code": "\n\n\nselect * from raw.core._stg_clinical_observation", "relation_name": "raw.core.observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.339302Z", "completed_at": "2024-02-20T20:47:50.343625Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.347800Z", "completed_at": "2024-02-20T20:47:50.347803Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.011733293533325195, "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": "raw.claims_expanded.medical_claim_expanded"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.375195Z", "completed_at": "2024-02-20T20:47:50.391923Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.393954Z", "completed_at": "2024-02-20T20:47:50.393957Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.03183603286743164, "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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\nfrom tuva.input_layer.eligibility\n) select distinct\n elig.patient_id\n , elig.patient_id||elig.data_source||elig.payer||elig.plan||elig.enrollment_start_date||elig.enrollment_end_date 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join raw.terminology.calendar cal_dob\n on elig.birth_date = cal_dob.full_date\nleft join raw.terminology.calendar cal_death\n on elig.death_date = cal_death.full_date\nleft join raw.terminology.calendar cal_enroll_start\n on elig.enrollment_start_date = cal_enroll_start.full_date\nleft join raw.terminology.calendar cal_enroll_end\n on elig.enrollment_end_date = cal_enroll_end.full_date", "relation_name": "raw.claims_preprocessing._int_normalized_input_eligibility_dates_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.383954Z", "completed_at": "2024-02-20T20:47:50.392193Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.394166Z", "completed_at": "2024-02-20T20:47:50.394168Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.02795100212097168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_source_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.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 , count(*) as admit_source_occurrence_count\n from normalize\n where admit_source_code is not null\n group by \n claim_id\n , data_source\n , admit_source_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "raw.claims_preprocessing._int_normalized_input_admit_source_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.394376Z", "completed_at": "2024-02-20T20:47:50.403043Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.413962Z", "completed_at": "2024-02-20T20:47:50.413966Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.0534358024597168, "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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_type_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.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 , count(*) as admit_type_occurrence_count\n from normalize\n where admit_type_code is not null\n group by \n claim_id\n , data_source\n , admit_type_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "raw.claims_preprocessing._int_normalized_input_admit_type_normalize_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.403266Z", "completed_at": "2024-02-20T20:47:50.413736Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.446319Z", "completed_at": "2024-02-20T20:47:50.446331Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.046090126037597656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_voting", "compiled": true, "compiled_code": "\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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , apr.apr_drg_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.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 , count(*) as apr_drg_occurrence_count\n from normalize\n where apr_drg_code is not null\n group by \n claim_id\n , data_source\n , apr_drg_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "raw.claims_preprocessing._int_normalized_input_apr_drg_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.414175Z", "completed_at": "2024-02-20T20:47:50.446650Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.448613Z", "completed_at": "2024-02-20T20:47:50.448616Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.03718304634094238, "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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , bill.bill_type_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.terminology.bill_type bill\n on med.bill_type_code = 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 , count(*) as bill_type_occurrence_count\n from normalize\n where bill_type_code is not null\n group by \n claim_id\n , data_source\n , bill_type_code\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_occurrence_count as occurrence_count\n , coalesce(lead(bill_type_occurrence_count) \n over (partition by claim_id, data_source order by bill_type_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by bill_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "raw.claims_preprocessing._int_normalized_input_bill_type_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.420820Z", "completed_at": "2024-02-20T20:47:50.447806Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.449899Z", "completed_at": "2024-02-20T20:47:50.449901Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.04469895362854004, "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 , billing_npi\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 , 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pivot_diagnosis piv\nleft join raw.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 raw.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": "raw.claims_preprocessing._int_normalized_input_diagnosis_code_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.450114Z", "completed_at": "2024-02-20T20:47:50.464589Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.470635Z", "completed_at": "2024-02-20T20:47:50.470639Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.023410797119140625, "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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , disch.discharge_disposition_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.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 , count(*) as discharge_disposition_occurrence_count\n from normalize\n where discharge_disposition_code is not null\n group by \n claim_id\n , data_source\n , discharge_disposition_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "raw.claims_preprocessing._int_normalized_input_discharge_disposition_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.457846Z", "completed_at": "2024-02-20T20:47:50.465883Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.478323Z", "completed_at": "2024-02-20T20:47:50.478326Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.02999114990234375, "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 , billing_npi\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 , 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join raw.terminology.calendar cal_claim_start\n on med.claim_start_date = cal_claim_start.full_date\nleft join raw.terminology.calendar cal_claim_end\n on med.claim_end_Date = cal_claim_end.full_date\nleft join raw.terminology.calendar cal_claim_line_start\n on med.claim_line_start_date = cal_claim_line_start.full_date\nleft join raw.terminology.calendar cal_claim_line_end\n on med.claim_line_end_date = cal_claim_line_end.full_date\nleft join raw.terminology.calendar cal_admission\n on med.admission_date = cal_admission.full_date\nleft join raw.terminology.calendar cal_discharge\n on med.discharge_date = cal_discharge.full_date", "relation_name": "raw.claims_preprocessing._int_normalized_input_medical_claim_date_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.466098Z", "completed_at": "2024-02-20T20:47:50.478094Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.479942Z", "completed_at": "2024-02-20T20:47:50.479944Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.01676797866821289, "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 , billing_npi\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 , 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 , bill_prov.npi as normalized_billing_npi\n , fac_prov.npi as normalized_facility_npi\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join raw.terminology.provider rend_prov\n on med.rendering_npi = rend_prov.npi\n and rend_prov.entity_type_description = 'Individual'\nleft join raw.terminology.provider bill_prov\n on med.billing_npi = bill_prov.npi\nleft join raw.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": "raw.claims_preprocessing._int_normalized_input_medical_npi_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.471707Z", "completed_at": "2024-02-20T20:47:50.479745Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.484441Z", "completed_at": "2024-02-20T20:47:50.484444Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.01962113380432129, "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 , billing_npi\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 , data_source\nfrom tuva.input_layer.medical_claim\n), normalize as(\n select \n med.claim_id\n , med.data_source\n , ms.ms_drg_code\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join raw.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 , count(*) as ms_drg_occurrence_count\n from normalize\n where ms_drg_code is not null\n group by \n claim_id\n , data_source\n , ms_drg_code\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_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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "raw.claims_preprocessing._int_normalized_input_ms_drg_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.481432Z", "completed_at": "2024-02-20T20:47:50.492024Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.530742Z", "completed_at": "2024-02-20T20:47:50.530747Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.05550384521484375, "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 , billing_npi\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 , 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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join raw.terminology.place_of_service pos\n on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\nwhere claim_type = 'professional'", "relation_name": "raw.claims_preprocessing._int_normalized_input_place_of_service_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.485760Z", "completed_at": "2024-02-20T20:47:50.525042Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.556417Z", "completed_at": "2024-02-20T20:47:50.556460Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.07634091377258301, "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 , billing_npi\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 , 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pivot_poa piv\nleft join raw.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": "raw.claims_preprocessing._int_normalized_input_present_on_admit_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.507563Z", "completed_at": "2024-02-20T20:47:50.556751Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.558805Z", "completed_at": "2024-02-20T20:47:50.558807Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.07438492774963379, "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 , billing_npi\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 , 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_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_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join raw.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 raw.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": "raw.claims_preprocessing._int_normalized_input_procedure_code_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.535278Z", "completed_at": "2024-02-20T20:47:50.558318Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.564637Z", "completed_at": "2024-02-20T20:47:50.564640Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.058238983154296875, "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 , billing_npi\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 , 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_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_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join raw.terminology.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": "raw.claims_preprocessing._int_normalized_input_procedure_date_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.560095Z", "completed_at": "2024-02-20T20:47:50.582004Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.594605Z", "completed_at": "2024-02-20T20:47:50.594609Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.03737068176269531, "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 , billing_npi\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 , 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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join raw.terminology.revenue_center rev\n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\nwhere claim_type = 'institutional'", "relation_name": "raw.claims_preprocessing._int_normalized_input_revenue_center_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.565785Z", "completed_at": "2024-02-20T20:47:50.583997Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.604111Z", "completed_at": "2024-02-20T20:47:50.604115Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.04555702209472656, "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 , billing_npi\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 , 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 , 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 , billing_npi\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 , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim\nwhere claim_type in ('undetermined')", "relation_name": "raw.claims_preprocessing._int_normalized_input_undetermined_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.584211Z", "completed_at": "2024-02-20T20:47:50.604312Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.606084Z", "completed_at": "2024-02-20T20:47:50.606087Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.02542901039123535, "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 , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , data_source\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_npi\n , cast(dispensing_provider_npi as TEXT ) as dispensing_provider_npi\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\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(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(data_source as TEXT ) as data_source\n , cast('2024-02-20 20:47:44.615990+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_pharmacy_claim", "relation_name": "raw.claims_preprocessing.normalized_input_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.595638Z", "completed_at": "2024-02-20T20:47:50.605678Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.609575Z", "completed_at": "2024-02-20T20:47:50.609577Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.026739120483398438, "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_npi\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom raw.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 raw.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 raw.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": "raw.ed_classification._int_by_provider_parent_organization"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.607347Z", "completed_at": "2024-02-20T20:47:50.616792Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.618472Z", "completed_at": "2024-02-20T20:47:50.618475Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.015978097915649414, "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_type\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20T20:47:50.610692Z", "completed_at": "2024-02-20T20:47:50.618267Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.623597Z", "completed_at": "2024-02-20T20:47:50.623599Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01772594451904297, "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_npi,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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_npi as TEXT) as facility_npi,\n cast(ms_drg_code as TEXT) as ms_drg_code,\n cast(paid_amount as numeric) as paid_amount,\n cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__readmissions__stg_core__encounter", "relation_name": "raw.readmissions._int_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.618673Z", "completed_at": "2024-02-20T20:47:50.623994Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.625934Z", "completed_at": "2024-02-20T20:47:50.625936Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.021490097045898438, "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 , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20T20:47:50.621630Z", "completed_at": "2024-02-20T20:47:50.624928Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.638097Z", "completed_at": "2024-02-20T20:47:50.638102Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.021168231964111328, "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 , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20T20:47:50.626423Z", "completed_at": "2024-02-20T20:47:50.641947Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.643674Z", "completed_at": "2024-02-20T20:47:50.643677Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.021689891815185547, "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||data_source||payer||plan||enrollment_start_date||enrollment_end_date as patient_id_key\n , member_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 , address\n , city\n , state\n , zip_code\n , phone\n , data_source\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.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.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-02-20 20:47:44.615990+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join raw.claims_preprocessing._int_normalized_input_eligibility_dates_normalize date_norm\n on elig.patient_id_key = date_norm.patient_id_key", "relation_name": "raw.claims_preprocessing.normalized_input_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.639684Z", "completed_at": "2024-02-20T20:47:50.643462Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.648593Z", "completed_at": "2024-02-20T20:47:50.648596Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.02335834503173828, "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_normalized_input_admit_source_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "raw.claims_preprocessing._int_normalized_input_admit_source_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.644053Z", "completed_at": "2024-02-20T20:47:50.649051Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.650994Z", "completed_at": "2024-02-20T20:47:50.650996Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.012174844741821289, "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_normalized_input_admit_type_normalize_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "raw.claims_preprocessing._int_normalized_input_admit_type_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.646562Z", "completed_at": "2024-02-20T20:47:50.650032Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.654251Z", "completed_at": "2024-02-20T20:47:50.654253Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.012192010879516602, "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_normalized_input_apr_drg_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "raw.claims_preprocessing._int_normalized_input_apr_drg_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.651504Z", "completed_at": "2024-02-20T20:47:50.655621Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.659449Z", "completed_at": "2024-02-20T20:47:50.659451Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.012270927429199219, "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_normalized_input_bill_type_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "raw.claims_preprocessing._int_normalized_input_bill_type_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.655812Z", "completed_at": "2024-02-20T20:47:50.659640Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.665104Z", "completed_at": "2024-02-20T20:47:50.665106Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.014780044555664062, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw.claims_preprocessing._int_normalized_input_diagnosis_code_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.660022Z", "completed_at": "2024-02-20T20:47:50.665337Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.667255Z", "completed_at": "2024-02-20T20:47:50.667257Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.011538982391357422, "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_normalized_input_discharge_disposition_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "raw.claims_preprocessing._int_normalized_input_discharge_disposition_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.662447Z", "completed_at": "2024-02-20T20:47:50.666247Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.669684Z", "completed_at": "2024-02-20T20:47:50.669686Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.011619091033935547, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_normalized_input_medical_claim_date_normalize\nwhere claim_type = 'professional'\ngroup by\n claim_id\n , data_source", "relation_name": "raw.claims_preprocessing._int_normalized_input_medical_date_aggregation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.667459Z", "completed_at": "2024-02-20T20:47:50.670839Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.674764Z", "completed_at": "2024-02-20T20:47:50.674766Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.010104179382324219, "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 , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_normalized_input_ms_drg_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "raw.claims_preprocessing._int_normalized_input_ms_drg_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.671231Z", "completed_at": "2024-02-20T20:47:50.675139Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.681577Z", "completed_at": "2024-02-20T20:47:50.681580Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.013125896453857422, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw.claims_preprocessing._int_normalized_input_present_on_admit_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.675869Z", "completed_at": "2024-02-20T20:47:50.682156Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.685890Z", "completed_at": "2024-02-20T20:47:50.685893Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.012759208679199219, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw.claims_preprocessing._int_normalized_input_procedure_code_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.678567Z", "completed_at": "2024-02-20T20:47:50.682933Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.686441Z", "completed_at": "2024-02-20T20:47:50.686443Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.013225078582763672, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.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.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw.claims_preprocessing._int_normalized_input_procedure_date_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.683564Z", "completed_at": "2024-02-20T20:47:50.687320Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.690880Z", "completed_at": "2024-02-20T20:47:50.690882Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.010037899017333984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates", "compiled": true, "compiled_code": "\n\nwith test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_pharmacy_claim\n left join test_catalog\n on test_catalog.test_name = 'duplicate pharmacy claims'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n claim_id\n , claim_line_number\n , data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "relation_name": "raw.data_quality._int_claims_preprocessing_pharmacy_claim_duplicates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.688152Z", "completed_at": "2024-02-20T20:47:50.691391Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.699545Z", "completed_at": "2024-02-20T20:47:50.699547Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.014156103134155273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n\n select\n claim_id\n , claim_line_number\n , data_source\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, add_row_num as (\n\n select\n claim_id\n , data_source\n , claim_line_number\n , row_number() over (\n partition by claim_id, data_source\n order by claim_line_number\n ) as expected_line_number\n from pharmacy_claim\n\n)\n\n, line_num_check as (\n\n select\n add_row_num.claim_id\n , add_row_num.data_source\n , add_row_num.claim_line_number\n , add_row_num.expected_line_number\n from add_row_num\n left join pharmacy_claim\n on add_row_num.claim_id = pharmacy_claim.claim_id\n and add_row_num.data_source = pharmacy_claim.data_source\n and add_row_num.expected_line_number = pharmacy_claim.claim_line_number\n where pharmacy_claim.claim_line_number is null\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom line_num_check\n left join test_catalog\n on test_catalog.test_name = 'claim_line_number non-sequential'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_pharmacy_claim_line_numbers"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.692464Z", "completed_at": "2024-02-20T20:47:50.700546Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.703421Z", "completed_at": "2024-02-20T20:47:50.703423Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.013641834259033203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim_missing as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where claim_id is null\n union all\n select\n claim_id\n , data_source\n , 'claim_line_number' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where claim_line_number is null\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where patient_id is null\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where member_id is null\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where payer is null\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where plan is null\n union all\n select\n claim_id\n , data_source\n , 'prescribing_provider_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where prescribing_provider_npi is null\n union all\n select\n claim_id\n , data_source\n , 'dispensing_provider_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where dispensing_provider_npi is null\n union all\n select\n claim_id\n , data_source\n , 'dispensing_date' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where dispensing_date is null\n union all\n select\n claim_id\n , data_source\n , 'ndc_code' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where ndc_code is null\n union all\n select\n claim_id\n , data_source\n , 'quantity' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where quantity is null\n union all\n select\n claim_id\n , data_source\n , 'days_supply' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where days_supply is null\n union all\n select\n claim_id\n , data_source\n , 'refills' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where refills is null\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where paid_date is null\n union all\n select\n claim_id\n , data_source\n , 'paid_amount' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where paid_amount is null\n union all\n select\n claim_id\n , data_source\n , 'allowed_amount' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where allowed_amount is null\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n where data_source is null\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , pharmacy_claim_missing.claim_id\n , pharmacy_claim_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pharmacy_claim_missing\n left join test_catalog\n on test_catalog.test_name = pharmacy_claim_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by\n pharmacy_claim_missing.claim_id\n , pharmacy_claim_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_pharmacy_claim_missing_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.696716Z", "completed_at": "2024-02-20T20:47:50.701100Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.703848Z", "completed_at": "2024-02-20T20:47:50.703849Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.015550851821899414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details", "compiled": true, "compiled_code": "\n\nwith pharmacy_header_duplicates as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n , count(distinct claim_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct claim_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n , count(distinct patient_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct patient_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n , count(distinct member_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct member_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n , count(distinct payer) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct payer) > 1\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n , count(distinct plan) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct plan) > 1\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n , count(distinct data_source) as duplicate_count\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n group by claim_id, data_source\n having count(distinct data_source) > 1\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , pharmacy_header_duplicates.claim_id\n , pharmacy_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom pharmacy_header_duplicates\n left join test_catalog\n on test_catalog.test_name = pharmacy_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__pharmacy_claim'\ngroup by \n pharmacy_header_duplicates.claim_id\n , pharmacy_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_pharmacy_header_fail_details"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.701494Z", "completed_at": "2024-02-20T20:47:50.704418Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.707853Z", "completed_at": "2024-02-20T20:47:50.707855Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.009057998657226562, "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 raw.ed_classification._int_by_provider_parent_organization a\nwhere ed_classification_capture = 1", "relation_name": "raw.ed_classification._int_filter_encounter_with_classification"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.704605Z", "completed_at": "2024-02-20T20:47:50.708046Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.711620Z", "completed_at": "2024-02-20T20:47:50.711622Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011250019073486328, "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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom overlapping_pairs", "relation_name": "raw.readmissions._int_encounter_overlap"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.709405Z", "completed_at": "2024-02-20T20:47:50.714461Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.717781Z", "completed_at": "2024-02-20T20:47:50.717783Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.01131296157836914, "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_npi,\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-02-20 20:47:44.615990+00:00' as tuva_last_run\n\nfrom\n raw.readmissions._int_encounter aa\n left join raw.terminology.icd_10_cm bb\n on aa.primary_diagnosis_code = bb.icd_10_cm\n left join raw.readmissions._value_set_icd_10_cm_to_ccs cc\n on aa.primary_diagnosis_code = cc.icd_10_cm", "relation_name": "raw.readmissions._int_encounter_with_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.711832Z", "completed_at": "2024-02-20T20:47:50.715063Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.718183Z", "completed_at": "2024-02-20T20:47:50.718185Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.015572071075439453, "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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw.readmissions._int_index_discharge_requirement"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.715443Z", "completed_at": "2024-02-20T20:47:50.718370Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.724850Z", "completed_at": "2024-02-20T20:47:50.724853Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.01234889030456543, "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\n\nselect encounter_id, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.readmissions._int_encounter\nwhere discharge_date <= (select max(discharge_date)\n from raw.readmissions._int_encounter ) - 30", "relation_name": "raw.readmissions._int_index_time_requirement"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.731802Z", "completed_at": "2024-02-20T20:47:50.735021Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.745123Z", "completed_at": "2024-02-20T20:47:50.745127Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.01994180679321289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates", "compiled": true, "compiled_code": "\n\nwith eligibility as (\n\n select\n patient_id\n , member_id\n , payer\n , plan\n , enrollment_start_date\n , enrollment_end_date\n , data_source\n from raw.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'patient_id' as grain\n , patient_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom eligibility\n left join test_catalog\n on test_catalog.test_name = 'duplicate eligibility'\n and test_catalog.source_table = 'normalized_input__eligibility'\ngroup by\n eligibility.patient_id\n , eligibility.member_id\n , eligibility.payer\n , eligibility.plan\n , eligibility.enrollment_start_date\n , eligibility.enrollment_end_date\n , eligibility.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "relation_name": "raw.data_quality._int_claims_preprocessing_eligibility_duplicates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.735384Z", "completed_at": "2024-02-20T20:47:50.745762Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.747088Z", "completed_at": "2024-02-20T20:47:50.747090Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.014454126358032227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values", "compiled": true, "compiled_code": "\n\nwith eligiblity as (\n\n select *\n from raw.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, valid_gender as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.gender\n , count(eligiblity.gender) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.gender gender\n on eligiblity.gender = gender.gender\n left join test_catalog\n on test_catalog.test_name = 'gender invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where gender.gender is null\n and eligiblity.gender is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.gender\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_race as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.race\n , count(eligiblity.race) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.race race\n on eligiblity.race = race.description\n left join test_catalog\n on test_catalog.test_name = 'race invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where race.description is null\n and eligiblity.race is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.race\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_payer_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.payer_type\n , count(eligiblity.payer_type) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.payer_type payer\n on eligiblity.payer_type = payer.payer_type\n left join test_catalog\n on test_catalog.test_name = 'payer_type invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where payer.payer_type is null\n and eligiblity.payer_type is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.payer_type\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_orec as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.original_reason_entitlement_code\n , count(eligiblity.original_reason_entitlement_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.medicare_orec orec\n on eligiblity.original_reason_entitlement_code = orec.original_reason_entitlement_code\n left join test_catalog\n on test_catalog.test_name = 'original_reason_entitlement_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where orec.original_reason_entitlement_code is null\n and eligiblity.original_reason_entitlement_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.original_reason_entitlement_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_dual_status_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.dual_status_code\n , count(eligiblity.dual_status_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.medicare_dual_eligibility dual\n on eligiblity.dual_status_code = dual.dual_status_code\n left join test_catalog\n on test_catalog.test_name = 'dual_status_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where dual.dual_status_code is null\n and eligiblity.dual_status_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.dual_status_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_medicare_status_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.medicare_status_code\n , count(eligiblity.medicare_status_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join raw.terminology.medicare_status status\n on eligiblity.medicare_status_code = status.medicare_status_code\n left join test_catalog\n on test_catalog.test_name = 'medicare_status_code invalid'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where status.medicare_status_code is null\n and eligiblity.medicare_status_code is not null\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , eligiblity.medicare_status_code\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_gender\nunion all\nselect * from valid_race\nunion all\nselect * from valid_payer_type\nunion all\nselect * from valid_orec\nunion all\nselect * from valid_dual_status_code\nunion all\nselect * from valid_medicare_status_code", "relation_name": "raw.data_quality._int_claims_preprocessing_eligibility_invalid_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.741460Z", "completed_at": "2024-02-20T20:47:50.746204Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.747676Z", "completed_at": "2024-02-20T20:47:50.747678Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.021043062210083008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values", "compiled": true, "compiled_code": "\n\nwith eligibility_missing as (\n\n \n select\n patient_id\n , data_source\n , 'patient_id' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where patient_id is null\n union all\n select\n patient_id\n , data_source\n , 'member_id' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where member_id is null\n union all\n select\n patient_id\n , data_source\n , 'gender' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where gender is null\n union all\n select\n patient_id\n , data_source\n , 'race' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where race is null\n union all\n select\n patient_id\n , data_source\n , 'birth_date' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where birth_date is null\n union all\n select\n patient_id\n , data_source\n , 'death_date' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where death_date is null\n union all\n select\n patient_id\n , data_source\n , 'death_flag' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where death_flag is null\n union all\n select\n patient_id\n , data_source\n , 'enrollment_start_date' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where enrollment_start_date is null\n union all\n select\n patient_id\n , data_source\n , 'enrollment_end_date' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where enrollment_end_date is null\n union all\n select\n patient_id\n , data_source\n , 'payer' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where payer is null\n union all\n select\n patient_id\n , data_source\n , 'payer_type' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where payer_type is null\n union all\n select\n patient_id\n , data_source\n , 'dual_status_code' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where dual_status_code is null\n union all\n select\n patient_id\n , data_source\n , 'medicare_status_code' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where medicare_status_code is null\n union all\n select\n patient_id\n , data_source\n , 'first_name' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where first_name is null\n union all\n select\n patient_id\n , data_source\n , 'last_name' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where last_name is null\n union all\n select\n patient_id\n , data_source\n , 'address' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where address is null\n union all\n select\n patient_id\n , data_source\n , 'city' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where city is null\n union all\n select\n patient_id\n , data_source\n , 'state' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where state is null\n union all\n select\n patient_id\n , data_source\n , 'zip_code' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where zip_code is null\n union all\n select\n patient_id\n , data_source\n , 'phone' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where phone is null\n union all\n select\n patient_id\n , data_source\n , 'data_source' as column_checked\n from raw.claims_preprocessing.normalized_input_eligibility\n where data_source is null\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'patient_id' as grain\n , eligibility_missing.patient_id\n , eligibility_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom eligibility_missing\n left join test_catalog\n on test_catalog.test_name = eligibility_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__eligibility'\ngroup by\n eligibility_missing.patient_id\n , eligibility_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_eligibility_missing_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.748667Z", "completed_at": "2024-02-20T20:47:50.756948Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.762188Z", "completed_at": "2024-02-20T20:47:50.762191Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.016026735305786133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility", "compiled": true, "compiled_code": "\n\nwith eligiblity as (\n\n select *\n from raw.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, multiple_genders_test as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple genders'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.gender) > 1\n\n)\n\n, multiple_races_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple races'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.race) > 1\n\n)\n\n, multiple_birth_dates_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple birth dates'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.birth_date) > 1\n\n)\n\n, multiple_death_dates_test as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'multiple death dates'\n and test_catalog.source_table = 'normalized_input__eligibility'\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n having count(distinct eligiblity.death_date) > 1\n\n)\n\n, birth_date_after_death_date as(\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'patient_id' as grain\n , eligiblity.patient_id\n , eligiblity.data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from eligiblity\n left join test_catalog\n on test_catalog.test_name = 'birth date after death date'\n and test_catalog.source_table = 'normalized_input__eligibility'\n where eligiblity.birth_date > eligiblity.death_date\n group by\n eligiblity.patient_id\n , eligiblity.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from multiple_genders_test\nunion all\nselect * from multiple_races_test\nunion all\nselect * from multiple_birth_dates_test\nunion all\nselect * from multiple_death_dates_test\nunion all\nselect * from birth_date_after_death_date", "relation_name": "raw.data_quality._int_claims_preprocessing_eligibility_plausibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.759887Z", "completed_at": "2024-02-20T20:47:50.763329Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.764863Z", "completed_at": "2024-02-20T20:47:50.764866Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011020898818969727, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw.claims_preprocessing._int_normalized_input_diagnosis_code_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.765072Z", "completed_at": "2024-02-20T20:47:50.770425Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.771347Z", "completed_at": "2024-02-20T20:47:50.771349Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.010305166244506836, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw.claims_preprocessing._int_normalized_input_present_on_admit_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.768373Z", "completed_at": "2024-02-20T20:47:50.771535Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.774573Z", "completed_at": "2024-02-20T20:47:50.774575Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.008116960525512695, "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_14' then normalized_code else null end) as procedure_code_25\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw.claims_preprocessing._int_normalized_input_procedure_code_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.771740Z", "completed_at": "2024-02-20T20:47:50.775066Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.777836Z", "completed_at": "2024-02-20T20:47:50.777838Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007862091064453125, "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_14' then normalized_code else null end) as procedure_date_25\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw.claims_preprocessing._int_normalized_input_procedure_date_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.776170Z", "completed_at": "2024-02-20T20:47:50.779098Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.784293Z", "completed_at": "2024-02-20T20:47:50.784296Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.012559890747070312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim", "compiled": true, "compiled_code": "\n\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_pharmacy_claim_duplicates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_pharmacy_claim_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_pharmacy_header_fail_details\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_pharmacy_claim_line_numbers", "relation_name": "raw.data_quality._int_claims_preprocessing_test_detail_stage_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.779335Z", "completed_at": "2024-02-20T20:47:50.784499Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.787991Z", "completed_at": "2024-02-20T20:47:50.787993Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.010869979858398438, "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 raw.readmissions._int_encounter enc\nleft join raw.readmissions._int_encounter_overlap over_a\n on enc.encounter_id = over_a.encounter_id_A\nleft join raw.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 bb.admit_date - aa.discharge_date 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom readmission_calc", "relation_name": "raw.readmissions._int_readmission_crude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.784702Z", "completed_at": "2024-02-20T20:47:50.788571Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.791658Z", "completed_at": "2024-02-20T20:47:50.791660Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.008744955062866211, "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 raw.readmissions._int_encounter_overlap )\n\t or\n\t aa.encounter_id in (select distinct encounter_id_B\n\t from raw.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 raw.readmissions._int_encounter_with_ccs aa\n left join raw.terminology.discharge_disposition bb\n on aa.discharge_disposition_code = bb.discharge_disposition_code\n left join raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom all_data_quality_flags", "relation_name": "raw.readmissions._int_encounter_data_quality"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.789691Z", "completed_at": "2024-02-20T20:47:50.792656Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.795889Z", "completed_at": "2024-02-20T20:47:50.795893Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008263826370239258, "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 raw.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 raw.readmissions._value_set_exclusion_ccs_diagnosis_category )\n)\n)\n\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom exclusions", "relation_name": "raw.readmissions._int_exclusion"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.793566Z", "completed_at": "2024-02-20T20:47:50.802672Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.911464Z", "completed_at": "2024-02-20T20:47:50.911468Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.12019824981689453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility", "compiled": true, "compiled_code": "\n\n\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_eligibility_duplicates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_eligibility_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_eligibility_invalid_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , patient_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_eligibility_plausibility", "relation_name": "raw.data_quality._int_claims_preprocessing_test_detail_stage_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.796743Z", "completed_at": "2024-02-20T20:47:50.915716Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.916196Z", "completed_at": "2024-02-20T20:47:50.916198Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.12120604515075684, "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 , billing_npi\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 , 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\t, 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\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as TEXT ) as admit_type_code\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as TEXT ) as discharge_disposition_code\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as TEXT ) as place_of_service_code\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as TEXT ) as bill_type_code\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as TEXT ) as ms_drg_code\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as TEXT ) as apr_drg_code\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as TEXT ) as revenue_center_code\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_npi\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as TEXT ) as billing_npi\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as TEXT ) as facility_npi\n\t, 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('2024-02-20 20:47:44.615990+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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": "raw.claims_preprocessing.normalized_input_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.912336Z", "completed_at": "2024-02-20T20:47:50.916385Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.917762Z", "completed_at": "2024-02-20T20:47:50.917764Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.028731346130371094, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.readmissions._int_encounter a\ninner join raw.readmissions._int_index_time_requirement b\n on a.encounter_id = b.encounter_id\ninner join raw.readmissions._int_index_discharge_requirement c\n on a.encounter_id = c.encounter_id\nleft join raw.readmissions._int_exclusion d\n on a.encounter_id = d.encounter_id\nwhere d.encounter_id is null", "relation_name": "raw.readmissions._int_index_admission"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.921771Z", "completed_at": "2024-02-20T20:47:50.927126Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.930257Z", "completed_at": "2024-02-20T20:47:50.930264Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.013991832733154297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures", "compiled": true, "compiled_code": "\n\nwith claim_type_mapping as (\n\n select \n claim_id\n , claim_line_number\n , data_source\n , claim_type as source_claim_type\n , case\n when bill_type_code is not null or revenue_center_code is not null \n then 'institutional'\n when place_of_service_code is not null\n then 'professional'\n else null\n end as data_profiling_claim_type\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_type_mapping.claim_id\n , claim_type_mapping.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom claim_type_mapping\n left join test_catalog\n on test_catalog.test_name = 'claim_type mapping incorrect'\n and test_catalog.source_table = 'normalized_input__medical_claim'\nwhere claim_type_mapping.source_claim_type <> claim_type_mapping.data_profiling_claim_type\ngroup by\n claim_type_mapping.claim_id\n , claim_type_mapping.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_claim_type_mapping_failures"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.924575Z", "completed_at": "2024-02-20T20:47:50.929708Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.932710Z", "completed_at": "2024-02-20T20:47:50.932713Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.014523983001708984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select\n claim_id\n , data_source\n , claim_type\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom medical_claim\n left join test_catalog\n on test_catalog.test_name = 'claim_type missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\nwhere medical_claim.claim_type is null\ngroup by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_claim_type_unmapped"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.933147Z", "completed_at": "2024-02-20T20:47:50.939843Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.946890Z", "completed_at": "2024-02-20T20:47:50.946893Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.015769004821777344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details", "compiled": true, "compiled_code": "\n\nwith institutional_header_duplicates as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n , count(distinct claim_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_type' as column_checked\n , count(distinct claim_type) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n , count(distinct patient_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct patient_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n , count(distinct member_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct member_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n , count(distinct payer) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct payer) > 1\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n , count(distinct plan) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct plan) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n , count(distinct claim_start_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_start_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n , count(distinct claim_end_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct claim_end_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'admission_date' as column_checked\n , count(distinct admission_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct admission_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'discharge_date' as column_checked\n , count(distinct discharge_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct discharge_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'admit_source_code' as column_checked\n , count(distinct admit_source_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct admit_source_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'admit_type_code' as column_checked\n , count(distinct admit_type_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct admit_type_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'discharge_disposition_code' as column_checked\n , count(distinct discharge_disposition_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct discharge_disposition_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_checked\n , count(distinct bill_type_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct bill_type_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'ms_drg_code' as column_checked\n , count(distinct ms_drg_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct ms_drg_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'facility_npi' as column_checked\n , count(distinct facility_npi) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct facility_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n , count(distinct billing_npi) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct billing_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'rendering_npi' as column_checked\n , count(distinct rendering_npi) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct rendering_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n , count(distinct diagnosis_code_type) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n , count(distinct diagnosis_code_1) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_2' as column_checked\n , count(distinct diagnosis_code_2) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_3' as column_checked\n , count(distinct diagnosis_code_3) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_4' as column_checked\n , count(distinct diagnosis_code_4) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_5' as column_checked\n , count(distinct diagnosis_code_5) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_6' as column_checked\n , count(distinct diagnosis_code_6) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_7' as column_checked\n , count(distinct diagnosis_code_7) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_8' as column_checked\n , count(distinct diagnosis_code_8) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_9' as column_checked\n , count(distinct diagnosis_code_9) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_10' as column_checked\n , count(distinct diagnosis_code_10) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_11' as column_checked\n , count(distinct diagnosis_code_11) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_12' as column_checked\n , count(distinct diagnosis_code_12) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_13' as column_checked\n , count(distinct diagnosis_code_13) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_14' as column_checked\n , count(distinct diagnosis_code_14) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_15' as column_checked\n , count(distinct diagnosis_code_15) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_16' as column_checked\n , count(distinct diagnosis_code_16) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_17' as column_checked\n , count(distinct diagnosis_code_17) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_18' as column_checked\n , count(distinct diagnosis_code_18) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_19' as column_checked\n , count(distinct diagnosis_code_19) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_20' as column_checked\n , count(distinct diagnosis_code_20) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_21' as column_checked\n , count(distinct diagnosis_code_21) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_22' as column_checked\n , count(distinct diagnosis_code_22) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_23' as column_checked\n , count(distinct diagnosis_code_23) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_24' as column_checked\n , count(distinct diagnosis_code_24) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_25' as column_checked\n , count(distinct diagnosis_code_25) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_1' as column_checked\n , count(distinct diagnosis_poa_1) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_2' as column_checked\n , count(distinct diagnosis_poa_2) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_3' as column_checked\n , count(distinct diagnosis_poa_3) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_4' as column_checked\n , count(distinct diagnosis_poa_4) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_5' as column_checked\n , count(distinct diagnosis_poa_5) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_6' as column_checked\n , count(distinct diagnosis_poa_6) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_7' as column_checked\n , count(distinct diagnosis_poa_7) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_8' as column_checked\n , count(distinct diagnosis_poa_8) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_9' as column_checked\n , count(distinct diagnosis_poa_9) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_10' as column_checked\n , count(distinct diagnosis_poa_10) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_11' as column_checked\n , count(distinct diagnosis_poa_11) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_12' as column_checked\n , count(distinct diagnosis_poa_12) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_13' as column_checked\n , count(distinct diagnosis_poa_13) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_14' as column_checked\n , count(distinct diagnosis_poa_14) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_15' as column_checked\n , count(distinct diagnosis_poa_15) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_16' as column_checked\n , count(distinct diagnosis_poa_16) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_17' as column_checked\n , count(distinct diagnosis_poa_17) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_18' as column_checked\n , count(distinct diagnosis_poa_18) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_19' as column_checked\n , count(distinct diagnosis_poa_19) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_20' as column_checked\n , count(distinct diagnosis_poa_20) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_21' as column_checked\n , count(distinct diagnosis_poa_21) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_22' as column_checked\n , count(distinct diagnosis_poa_22) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_23' as column_checked\n , count(distinct diagnosis_poa_23) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_24' as column_checked\n , count(distinct diagnosis_poa_24) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_poa_25' as column_checked\n , count(distinct diagnosis_poa_25) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_poa_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_type' as column_checked\n , count(distinct procedure_code_type) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_1' as column_checked\n , count(distinct procedure_code_1) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_2' as column_checked\n , count(distinct procedure_code_2) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_3' as column_checked\n , count(distinct procedure_code_3) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_4' as column_checked\n , count(distinct procedure_code_4) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_5' as column_checked\n , count(distinct procedure_code_5) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_6' as column_checked\n , count(distinct procedure_code_6) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_7' as column_checked\n , count(distinct procedure_code_7) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_8' as column_checked\n , count(distinct procedure_code_8) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_9' as column_checked\n , count(distinct procedure_code_9) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_10' as column_checked\n , count(distinct procedure_code_10) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_11' as column_checked\n , count(distinct procedure_code_11) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_12' as column_checked\n , count(distinct procedure_code_12) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_13' as column_checked\n , count(distinct procedure_code_13) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_14' as column_checked\n , count(distinct procedure_code_14) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_15' as column_checked\n , count(distinct procedure_code_15) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_16' as column_checked\n , count(distinct procedure_code_16) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_17' as column_checked\n , count(distinct procedure_code_17) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_18' as column_checked\n , count(distinct procedure_code_18) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_19' as column_checked\n , count(distinct procedure_code_19) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_20' as column_checked\n , count(distinct procedure_code_20) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_21' as column_checked\n , count(distinct procedure_code_21) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_22' as column_checked\n , count(distinct procedure_code_22) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_23' as column_checked\n , count(distinct procedure_code_23) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_24' as column_checked\n , count(distinct procedure_code_24) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_code_25' as column_checked\n , count(distinct procedure_code_25) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_code_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_1' as column_checked\n , count(distinct procedure_date_1) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_2' as column_checked\n , count(distinct procedure_date_2) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_3' as column_checked\n , count(distinct procedure_date_3) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_4' as column_checked\n , count(distinct procedure_date_4) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_5' as column_checked\n , count(distinct procedure_date_5) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_6' as column_checked\n , count(distinct procedure_date_6) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_7' as column_checked\n , count(distinct procedure_date_7) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_8' as column_checked\n , count(distinct procedure_date_8) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_9' as column_checked\n , count(distinct procedure_date_9) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_10' as column_checked\n , count(distinct procedure_date_10) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_11' as column_checked\n , count(distinct procedure_date_11) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_12' as column_checked\n , count(distinct procedure_date_12) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_13' as column_checked\n , count(distinct procedure_date_13) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_14' as column_checked\n , count(distinct procedure_date_14) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_15' as column_checked\n , count(distinct procedure_date_15) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_16' as column_checked\n , count(distinct procedure_date_16) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_17' as column_checked\n , count(distinct procedure_date_17) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_18' as column_checked\n , count(distinct procedure_date_18) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_19' as column_checked\n , count(distinct procedure_date_19) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_20' as column_checked\n , count(distinct procedure_date_20) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_21' as column_checked\n , count(distinct procedure_date_21) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_22' as column_checked\n , count(distinct procedure_date_22) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_23' as column_checked\n , count(distinct procedure_date_23) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_24' as column_checked\n , count(distinct procedure_date_24) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_25' as column_checked\n , count(distinct procedure_date_25) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct procedure_date_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n , count(distinct data_source) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n group by\n claim_id\n , data_source\n having count(distinct data_source) > 1\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , institutional_header_duplicates.claim_id\n , institutional_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom institutional_header_duplicates\n left join test_catalog\n on test_catalog.test_name = institutional_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n and test_catalog.claim_type = 'institutional'\ngroup by \n institutional_header_duplicates.claim_id\n , institutional_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_institutional_header_fail_details"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.940092Z", "completed_at": "2024-02-20T20:47:50.947525Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.949013Z", "completed_at": "2024-02-20T20:47:50.949016Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011003255844116211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates", "compiled": true, "compiled_code": "\n\nwith claim_dates as (\n\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.claim_start_date = cal.full_date\n where cal.full_date is null\n and rel.claim_start_date is not null\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.claim_end_date = cal.full_date\n where cal.full_date is null\n and rel.claim_end_date is not null\n union all\n select\n claim_id\n , data_source\n , 'claim_line_start_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.claim_line_start_date = cal.full_date\n where cal.full_date is null\n and rel.claim_line_start_date is not null\n union all\n select\n claim_id\n , data_source\n , 'claim_line_end_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.claim_line_end_date = cal.full_date\n where cal.full_date is null\n and rel.claim_line_end_date is not null\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.paid_date = cal.full_date\n where cal.full_date is null\n and rel.paid_date is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_1' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_1 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_1 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_2' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_2 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_2 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_3' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_3 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_3 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_4' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_4 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_4 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_5' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_5 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_5 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_6' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_6 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_6 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_7' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_7 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_7 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_8' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_8 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_8 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_9' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_9 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_9 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_10' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_10 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_10 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_11' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_11 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_11 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_12' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_12 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_12 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_13' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_13 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_13 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_14' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_14 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_14 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_15' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_15 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_15 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_16' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_16 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_16 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_17' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_17 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_17 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_18' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_18 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_18 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_19' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_19 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_19 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_20' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_20 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_20 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_21' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_21 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_21 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_22' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_22 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_22 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_23' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_23 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_23 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_24' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_24 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_24 is not null\n union all\n select\n claim_id\n , data_source\n , 'procedure_date_25' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.procedure_date_25 = cal.full_date\n where cal.full_date is null\n and rel.procedure_date_25 is not null\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom claim_dates\n left join test_catalog\n on test_catalog.test_name = claim_dates.column_checked||' invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.944487Z", "completed_at": "2024-02-20T20:47:50.947970Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.949413Z", "completed_at": "2024-02-20T20:47:50.949414Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.01645374298095703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst", "compiled": true, "compiled_code": "\n\nwith claim_dates as (\n\n select\n claim_id\n , data_source\n , 'admission_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.admission_date = cal.full_date\n where cal.full_date is null\n and rel.admission_date is not null\n and rel.claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'discharge_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.terminology.calendar as cal\n on rel.discharge_date = cal.full_date\n where cal.full_date is null\n and rel.discharge_date is not null\n and rel.claim_type = 'institutional'\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom claim_dates\n left join test_catalog\n on test_catalog.test_name = claim_dates.column_checked||' invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_dates.claim_id\n , claim_dates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_dates_inst"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.958260Z", "completed_at": "2024-02-20T20:47:50.966931Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.967681Z", "completed_at": "2024-02-20T20:47:50.967685Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011242151260375977, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates", "compiled": true, "compiled_code": "\n\nwith test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect distinct\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , claim_id\n , data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n left join test_catalog\n on test_catalog.test_name = 'duplicate medical claims'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n claim_id\n , claim_line_number\n , data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\nhaving count(*) > 1", "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_duplicates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.961990Z", "completed_at": "2024-02-20T20:47:50.967155Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.967872Z", "completed_at": "2024-02-20T20:47:50.967873Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.011205196380615234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values", "compiled": true, "compiled_code": "\n\nwith institutional_missing as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_id is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'claim_line_number' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_line_number is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where patient_id is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where member_id is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where payer is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where plan is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_start_date is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_end_date is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where bill_type_code is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'revenue_center_code' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where revenue_center_code is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'hcpcs_code' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where hcpcs_code is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'rendering_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where rendering_npi is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where billing_npi is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'facility_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where facility_npi is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where paid_date is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'paid_amount' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where paid_amount is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_type is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_1 is null\n and claim_type = 'institutional'\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where data_source is null\n and claim_type = 'institutional'\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'institutional' as claim_type\n , 'claim_id' as grain\n , institutional_missing.claim_id\n , institutional_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom institutional_missing\n left join test_catalog\n on test_catalog.test_name = institutional_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n institutional_missing.claim_id\n , institutional_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.970469Z", "completed_at": "2024-02-20T20:47:50.984268Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.985062Z", "completed_at": "2024-02-20T20:47:50.985066Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01613903045654297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select *\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, valid_billing_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.billing_npi) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.provider pro\n on medical_claim.billing_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'billing_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.billing_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_facility_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.facility_npi) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.provider pro\n on medical_claim.facility_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'facility_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.facility_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_rendering_npi as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.rendering_npi) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.provider pro\n on medical_claim.rendering_npi = pro.npi\n left join test_catalog\n on test_catalog.test_name = 'rendering_npi invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where pro.npi is null\n and medical_claim.rendering_npi is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_billing_npi\nunion all\nselect * from valid_facility_npi\nunion all\nselect * from valid_rendering_npi", "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_invalid_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.973923Z", "completed_at": "2024-02-20T20:47:50.984486Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:50.985284Z", "completed_at": "2024-02-20T20:47:50.985286Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.016196012496948242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select *\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, valid_bill_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.bill_type_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.bill_type tob\n on medical_claim.bill_type_code = tob.bill_type_code\n left join test_catalog\n on test_catalog.test_name = 'bill_type_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and tob.bill_type_code is null\n and medical_claim.bill_type_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_revenue_center as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.revenue_center_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.revenue_center rev\n on medical_claim.revenue_center_code = rev.revenue_center_code\n left join test_catalog\n on test_catalog.test_name = 'revenue_center_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and rev.revenue_center_code is null\n and medical_claim.revenue_center_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_discharge_disposition as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.discharge_disposition_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.discharge_disposition discharge\n on medical_claim.discharge_disposition_code = discharge.discharge_disposition_code\n left join test_catalog\n on test_catalog.test_name = 'discharge_disposition_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and discharge.discharge_disposition_code is null\n and medical_claim.discharge_disposition_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_admit_source as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.admit_source_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.admit_source adsource\n on medical_claim.admit_source_code = adsource.admit_source_code\n left join test_catalog\n on test_catalog.test_name = 'admit_source_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and adsource.admit_source_code is null\n and medical_claim.admit_source_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_admit_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.admit_type_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.admit_type adtype\n on medical_claim.admit_type_code = adtype.admit_type_code\n left join test_catalog\n on test_catalog.test_name = 'admit_type_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and adtype.admit_type_code is null\n and medical_claim.admit_type_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_ms_drg as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.ms_drg_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.ms_drg msdrg\n on medical_claim.ms_drg_code = msdrg.ms_drg_code\n left join test_catalog\n on test_catalog.test_name = 'ms_drg_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and msdrg.ms_drg_code is null\n and medical_claim.ms_drg_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_apr_drg as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.apr_drg_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.apr_drg aprdrg\n on medical_claim.apr_drg_code = aprdrg.apr_drg_code\n left join test_catalog\n on test_catalog.test_name = 'apr_drg_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and aprdrg.apr_drg_code is null\n and medical_claim.apr_drg_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_present_on_admission as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_poa_1) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.present_on_admission poa\n on medical_claim.diagnosis_poa_1 = poa.present_on_admit_code\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_poa_1 invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and poa.present_on_admit_code is null\n and medical_claim.diagnosis_poa_1 is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_procedure_code_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.procedure_code_type) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.code_type codetype\n on medical_claim.procedure_code_type = codetype.code_type\n left join test_catalog\n on test_catalog.test_name = 'procedure_code_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claim_type = 'institutional'\n and codetype.code_type is null\n and medical_claim.procedure_code_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_place_of_service as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.place_of_service_code) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.place_of_service pos\n on medical_claim.place_of_service_code = pos.place_of_service_code\n left join test_catalog\n on test_catalog.test_name = 'place_of_service_code invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claim_type = 'professional'\n and pos.place_of_service_code is null\n and medical_claim.place_of_service_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_diagnosis_code_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_code_type) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.code_type codetype\n on medical_claim.diagnosis_code_type = codetype.code_type\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_code_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where codetype.code_type is null\n and medical_claim.diagnosis_code_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_diagnosis_code as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.diagnosis_code_1) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.icd_10_cm icd\n on medical_claim.diagnosis_code_1 = icd.icd_10_cm\n left join test_catalog\n on test_catalog.test_name = 'diagnosis_code_1 invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where diagnosis_code_type = 'icd-10-cm'\n and icd.icd_10_cm is null\n and medical_claim.diagnosis_code_1 is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, valid_claim_type as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(medical_claim.claim_type) as filled_row_count\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join raw.terminology.claim_type claimtype\n on medical_claim.claim_type = claimtype.claim_type\n left join test_catalog\n on test_catalog.test_name = 'claim_type invalid'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where claimtype.claim_type is null\n and medical_claim.claim_type is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from valid_bill_type\nunion all \nselect * from valid_revenue_center\nunion all \nselect * from valid_discharge_disposition\nunion all \nselect * from valid_admit_source\nunion all \nselect * from valid_admit_type\nunion all \nselect * from valid_ms_drg\nunion all \nselect * from valid_apr_drg\nunion all \nselect * from valid_present_on_admission\nunion all \nselect * from valid_diagnosis_code_type\nunion all \nselect * from valid_procedure_code_type\nunion all \nselect * from valid_diagnosis_code\nunion all \nselect * from valid_claim_type\nunion all \nselect * from valid_place_of_service", "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_invalid_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.987837Z", "completed_at": "2024-02-20T20:47:51.002708Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.003522Z", "completed_at": "2024-02-20T20:47:51.003526Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01723003387451172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select\n claim_id\n , claim_line_number\n , data_source\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, add_row_num as (\n\n select\n claim_id\n , data_source\n , claim_line_number\n , row_number() over (\n partition by claim_id, data_source\n order by claim_line_number\n ) as expected_line_number\n from medical_claim\n\n)\n\n, line_num_check as (\n\n select\n add_row_num.claim_id\n , add_row_num.data_source\n , add_row_num.claim_line_number\n , add_row_num.expected_line_number\n from add_row_num\n left join medical_claim\n on add_row_num.claim_id = medical_claim.claim_id\n and add_row_num.data_source = medical_claim.data_source\n and add_row_num.expected_line_number = medical_claim.claim_line_number\n where medical_claim.claim_line_number is null\n\n)\n\nselect\n test_catalog.source_table\n , 'all' as claim_type\n , 'claim_id' as grain\n , line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom line_num_check\n left join test_catalog\n on test_catalog.test_name = 'claim_line_number non-sequential'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n line_num_check.claim_id\n , line_num_check.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_line_numbers"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.990302Z", "completed_at": "2024-02-20T20:47:51.002969Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.003711Z", "completed_at": "2024-02-20T20:47:51.003713Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.017261028289794922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n\n select *\n from raw.claims_preprocessing.normalized_input_medical_claim\n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\n, claim_start_date_after_claim_end_date as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'all' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'claim_start_date after claim_end_date'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_start_date > medical_claim.claim_end_date\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, admission_date_after_discharge_date as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'institutional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'admission_date after discharge_date'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and medical_claim.admission_date > medical_claim.discharge_date\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, admission_date_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'admission_date incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.admission_date is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, discharge_date_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'discharge_date incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.discharge_date is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, revenue_center_code_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'revenue_center_code incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and medical_claim.revenue_center_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, institutional_header_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'institutional header-level fields incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'professional'\n and (\n medical_claim.admit_type_code is not null\n or medical_claim.admit_type_code is not null\n or medical_claim.admit_source_code is not null\n or medical_claim.discharge_disposition_code is not null\n or medical_claim.bill_type_code is not null\n or medical_claim.ms_drg_code is not null\n or medical_claim.apr_drg_code is not null\n )\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\n, place_of_service_code_incorrect as (\n\n select\n test_catalog.test_name\n , test_catalog.pipeline_test\n , test_catalog.source_table\n , 'professional' as claim_type\n , test_catalog.test_category\n , 'claim_id' as grain\n , medical_claim.claim_id\n , medical_claim.data_source\n , count(*) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from medical_claim\n left join test_catalog\n on test_catalog.test_name = 'place_of_service_code incorrectly populated'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n where medical_claim.claim_type = 'institutional'\n and medical_claim.place_of_service_code is not null\n group by\n medical_claim.claim_id\n , medical_claim.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n\n)\n\nselect * from claim_start_date_after_claim_end_date\nunion all\nselect * from admission_date_after_discharge_date\nunion all\nselect * from admission_date_incorrect\nunion all\nselect * from discharge_date_incorrect\nunion all\nselect * from revenue_center_code_incorrect\nunion all\nselect * from institutional_header_incorrect\nunion all\nselect * from place_of_service_code_incorrect", "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_plausibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.005938Z", "completed_at": "2024-02-20T20:47:51.012094Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.012852Z", "completed_at": "2024-02-20T20:47:51.012855Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.008321046829223633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values", "compiled": true, "compiled_code": "\n\nwith professional_missing as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_id is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'claim_line_number' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_line_number is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where patient_id is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where member_id is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where payer is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where plan is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_start_date is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_end_date is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'place_of_service_code' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where place_of_service_code is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'hcpcs_code' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where hcpcs_code is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'rendering_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where rendering_npi is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where billing_npi is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where paid_date is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'paid_amount' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where paid_amount is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_type is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where diagnosis_code_1 is null\n and claim_type = 'professional'\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n from raw.claims_preprocessing.normalized_input_medical_claim\n where data_source is null\n and claim_type = 'professional'\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'professional' as claim_type\n , 'claim_id' as grain\n , professional_missing.claim_id\n , professional_missing.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom professional_missing\n left join test_catalog\n on test_catalog.test_name = professional_missing.column_checked||' missing'\n and test_catalog.source_table = 'normalized_input__medical_claim'\ngroup by\n professional_missing.claim_id\n , professional_missing.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.008931Z", "completed_at": "2024-02-20T20:47:51.012320Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.013053Z", "completed_at": "2024-02-20T20:47:51.013055Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008414983749389648, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details", "compiled": true, "compiled_code": "\n\nwith professional_header_duplicates as (\n\n \n select\n claim_id\n , data_source\n , 'claim_id' as column_checked\n , count(distinct claim_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_type' as column_checked\n , count(distinct claim_type) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'patient_id' as column_checked\n , count(distinct patient_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct patient_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'member_id' as column_checked\n , count(distinct member_id) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct member_id) > 1\n union all\n select\n claim_id\n , data_source\n , 'payer' as column_checked\n , count(distinct payer) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct payer) > 1\n union all\n select\n claim_id\n , data_source\n , 'plan' as column_checked\n , count(distinct plan) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct plan) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_start_date' as column_checked\n , count(distinct claim_start_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_start_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'claim_end_date' as column_checked\n , count(distinct claim_end_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct claim_end_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'place_of_service_code' as column_checked\n , count(distinct place_of_service_code) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct place_of_service_code) > 1\n union all\n select\n claim_id\n , data_source\n , 'billing_npi' as column_checked\n , count(distinct billing_npi) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct billing_npi) > 1\n union all\n select\n claim_id\n , data_source\n , 'paid_date' as column_checked\n , count(distinct paid_date) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct paid_date) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_type' as column_checked\n , count(distinct diagnosis_code_type) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_type) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_1' as column_checked\n , count(distinct diagnosis_code_1) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_1) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_2' as column_checked\n , count(distinct diagnosis_code_2) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_2) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_3' as column_checked\n , count(distinct diagnosis_code_3) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_3) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_4' as column_checked\n , count(distinct diagnosis_code_4) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_4) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_5' as column_checked\n , count(distinct diagnosis_code_5) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_5) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_6' as column_checked\n , count(distinct diagnosis_code_6) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_6) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_7' as column_checked\n , count(distinct diagnosis_code_7) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_7) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_8' as column_checked\n , count(distinct diagnosis_code_8) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_8) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_9' as column_checked\n , count(distinct diagnosis_code_9) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_9) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_10' as column_checked\n , count(distinct diagnosis_code_10) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_10) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_11' as column_checked\n , count(distinct diagnosis_code_11) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_11) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_12' as column_checked\n , count(distinct diagnosis_code_12) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_12) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_13' as column_checked\n , count(distinct diagnosis_code_13) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_13) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_14' as column_checked\n , count(distinct diagnosis_code_14) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_14) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_15' as column_checked\n , count(distinct diagnosis_code_15) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_15) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_16' as column_checked\n , count(distinct diagnosis_code_16) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_16) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_17' as column_checked\n , count(distinct diagnosis_code_17) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_17) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_18' as column_checked\n , count(distinct diagnosis_code_18) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_18) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_19' as column_checked\n , count(distinct diagnosis_code_19) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_19) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_20' as column_checked\n , count(distinct diagnosis_code_20) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_20) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_21' as column_checked\n , count(distinct diagnosis_code_21) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_21) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_22' as column_checked\n , count(distinct diagnosis_code_22) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_22) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_23' as column_checked\n , count(distinct diagnosis_code_23) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_23) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_24' as column_checked\n , count(distinct diagnosis_code_24) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_24) > 1\n union all\n select\n claim_id\n , data_source\n , 'diagnosis_code_25' as column_checked\n , count(distinct diagnosis_code_25) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct diagnosis_code_25) > 1\n union all\n select\n claim_id\n , data_source\n , 'data_source' as column_checked\n , count(distinct data_source) as duplicate_count\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n group by\n claim_id\n , data_source\n having count(distinct data_source) > 1\n \n\n)\n\n, test_catalog as (\n\n select\n source_table\n , test_category\n , test_name\n , pipeline_test\n , claim_type\n from raw.data_quality._value_set_test_catalog\n\n)\n\nselect\n test_catalog.source_table\n , 'professional' as claim_type\n , 'claim_id' as grain\n , professional_header_duplicates.claim_id\n , professional_header_duplicates.data_source\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom professional_header_duplicates\n left join test_catalog\n on test_catalog.test_name = professional_header_duplicates.column_checked||' non-unique'\n and test_catalog.source_table = 'normalized_input__medical_claim'\n and test_catalog.claim_type = 'professional'\ngroup by \n professional_header_duplicates.claim_id\n , professional_header_duplicates.data_source\n , test_catalog.source_table\n , test_catalog.test_category\n , test_catalog.test_name\n , test_catalog.pipeline_test", "relation_name": "raw.data_quality._int_claims_preprocessing_professional_header_fail_details"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.024859Z", "completed_at": "2024-02-20T20:47:51.027601Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.028614Z", "completed_at": "2024-02-20T20:47:51.028622Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.006973981857299805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim", "compiled": true, "compiled_code": "\n \nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_institutional_header_fail_details\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_professional_header_fail_details\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_invalid_values\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_claim_type_unmapped\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_claim_type_mapping_failures\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_duplicates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_plausibility\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_dates\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_dates_inst\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_line_numbers\nunion all\nselect distinct\n source_table\n , claim_type\n , grain\n , claim_id as foreign_key\n , data_source\n , test_category\n , test_name\n , pipeline_test\nfrom raw.data_quality._int_claims_preprocessing_medical_claim_invalid_npi", "relation_name": "raw.data_quality._int_claims_preprocessing_test_detail_stage_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.022891Z", "completed_at": "2024-02-20T20:47:51.027835Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.028839Z", "completed_at": "2024-02-20T20:47:51.028841Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007663249969482422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f", "compiled": true, "compiled_code": "\n \n \n\nselect\n (claim_id||'-'||claim_line_number) as unique_field,\n count(*) as n_records\n\nfrom raw.claims_preprocessing.normalized_input_medical_claim\nwhere (claim_id||'-'||claim_line_number) is not null\ngroup by (claim_id||'-'||claim_line_number)\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.040246Z", "completed_at": "2024-02-20T20:47:51.043239Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.044001Z", "completed_at": "2024-02-20T20:47:51.044004Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.013887405395507812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct\n claim_id\n, claim_line_number\n, 'Acute Inpatient' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code = '21'", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.031333Z", "completed_at": "2024-02-20T20:47:51.043448Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.044204Z", "completed_at": "2024-02-20T20:47:51.044206Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.014592885971069336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), room_and_board_requirement as (\nselect distinct \n claim_id\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and revenue_center_code in\n ('0100','0101',\n '0110','0111','0112','0113','0114','0116','0117','0118','0119',\n '0120','0121','0122','0123','0124','0126','0127','0128','0129',\n '0130','0131','0132','0133','0134','0136','0137','0138','0139',\n '0140','0141','0142','0143','0144','0146','0147','0148','0149',\n '0150','0151','0152','0153','0154','0156','0157','0158','0159',\n '0160','0164','0167','0169',\n '0170','0171','0172','0173','0174','0179',\n '0190','0191','0192','0193','0194','0199',\n '0200','0201','0202','0203','0204','0206','0207','0208','0209',\n '0210','0211','0212','0213','0214','0219',\n '1000','1001','1002')\n)\n\n, drg_requirement as (\nselect distinct \n mc.claim_id\nfrom __dbt__cte__service_category__stg_medical_claim mc\nleft join raw.terminology.ms_drg msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\nleft join raw.terminology.apr_drg aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\nwhere claim_type = 'institutional'\n and (msdrg.ms_drg_code is not null or aprdrg.apr_drg_code is not null)\n)\n\n, bill_type_requirement as (\nselect distinct \n claim_id\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('11','12') \n)\n\nselect distinct \n a.claim_id\n, 'Acute Inpatient' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join room_and_board_requirement b\n on a.claim_id = b.claim_id\ninner join drg_requirement c\n on a.claim_id = c.claim_id\ninner join bill_type_requirement d\n on a.claim_id = d.claim_id", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.046615Z", "completed_at": "2024-02-20T20:47:51.052250Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.053012Z", "completed_at": "2024-02-20T20:47:51.053014Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007850170135498047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulance_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Ambulance' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and (hcpcs_code between 'A0425' and 'A0436' or place_of_service_code in ('41','42'))", "relation_name": "raw.claims_preprocessing._int_ambulance_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.049511Z", "completed_at": "2024-02-20T20:47:51.052439Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.053209Z", "completed_at": "2024-02-20T20:47:51.053211Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007951974868774414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dialysis_institutional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Dialysis' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('72')", "relation_name": "raw.claims_preprocessing._int_dialysis_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.055511Z", "completed_at": "2024-02-20T20:47:51.060698Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.061416Z", "completed_at": "2024-02-20T20:47:51.061418Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007329225540161133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dialysis_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Dialysis' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('65')", "relation_name": "raw.claims_preprocessing._int_dialysis_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.058046Z", "completed_at": "2024-02-20T20:47:51.060884Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.061607Z", "completed_at": "2024-02-20T20:47:51.061609Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007411003112792969, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dme_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Durable Medical Equipment' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and hcpcs_code between 'E0100' and 'E8002'", "relation_name": "raw.claims_preprocessing._int_dme_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.085301Z", "completed_at": "2024-02-20T20:47:51.087899Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.088653Z", "completed_at": "2024-02-20T20:47:51.088658Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.026082754135131836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__duplicate_bill_types", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct\n claim_id\n, count(distinct bill_type_code) as cnt\nfrom __dbt__cte__service_category__stg_medical_claim\ngroup by 1\nhaving count(distinct bill_type_code) > 1", "relation_name": "raw.claims_preprocessing._int_duplicate_bill_types"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.063915Z", "completed_at": "2024-02-20T20:47:51.088117Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.088884Z", "completed_at": "2024-02-20T20:47:51.088885Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.02679610252380371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dq_input_layer_tests", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Multiple claim_type' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\ngroup by 1\nhaving count(distinct claim_type) > 1\n\nunion all\n\nselect distinct \n claim_id\n, 'Multiple bill_type_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\ngroup by 1\nhaving count(distinct bill_type_code) > 1\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing claim_type' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing place_of_service_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing bill_type_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and bill_type_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing revenue_center_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and revenue_center_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Missing hcpcs_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and hcpcs_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid claim_type' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.claim_type b\n on a.claim_type = b.claim_type\nwhere b.claim_type is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid place_of_service_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.place_of_service b\n on a.place_of_service_code = b.place_of_service_code\nwhere a.claim_type = 'professional'\n and b.place_of_service_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid bill_type_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.bill_type b\n on a.bill_type_code = b.bill_type_code\nwhere a.claim_type = 'institutional'\n and b.bill_type_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid revenue_center_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.revenue_center b\n on a.revenue_center_code = b.revenue_center_code\nwhere a.claim_type = 'institutional'\n and b.revenue_center_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid hcpcs_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.hcpcs_level_2 b\n on a.hcpcs_code = b.hcpcs\nwhere a.claim_type = 'professional'\n and b.hcpcs is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid ms_drg_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.ms_drg b\n on a.ms_drg_code = b.ms_drg_code\nwhere a.claim_type = 'institutional'\n and b.ms_drg_code is null\n\nunion all\n\nselect distinct \n claim_id\n, 'Invalid apr_drg_code' as dq_problem\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\ninner join raw.terminology.apr_drg b\n on a.apr_drg_code = b.apr_drg_code\nwhere a.claim_type = 'institutional'\n and b.apr_drg_code is null", "relation_name": "raw.claims_preprocessing._dq_input_layer_tests"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.091565Z", "completed_at": "2024-02-20T20:47:51.096961Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.097582Z", "completed_at": "2024-02-20T20:47:51.097584Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007564067840576172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__emergency_department_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Emergency Department' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code = '23'", "relation_name": "raw.claims_preprocessing._int_emergency_department_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.094116Z", "completed_at": "2024-02-20T20:47:51.097374Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.098377Z", "completed_at": "2024-02-20T20:47:51.098378Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.00805807113647461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__home_health_institutional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Home Health' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('31','32','33')", "relation_name": "raw.claims_preprocessing._int_home_health_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.100157Z", "completed_at": "2024-02-20T20:47:51.105944Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.106524Z", "completed_at": "2024-02-20T20:47:51.106527Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.00783395767211914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__hospice_institutional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Hospice' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('81','82')", "relation_name": "raw.claims_preprocessing._int_hospice_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.103303Z", "completed_at": "2024-02-20T20:47:51.106319Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.107268Z", "completed_at": "2024-02-20T20:47:51.107270Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.00792384147644043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__hospice_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Hospice' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('34')", "relation_name": "raw.claims_preprocessing._int_hospice_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.108933Z", "completed_at": "2024-02-20T20:47:51.114277Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.114868Z", "completed_at": "2024-02-20T20:47:51.114870Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007327079772949219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Inpatient Psychiatric' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('51','55','56')", "relation_name": "raw.claims_preprocessing._int_inpatient_psychiatric_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.111803Z", "completed_at": "2024-02-20T20:47:51.114664Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.115607Z", "completed_at": "2024-02-20T20:47:51.115608Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007480144500732422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Inpatient Rehabilitation' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('61')", "relation_name": "raw.claims_preprocessing._int_inpatient_rehab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.117310Z", "completed_at": "2024-02-20T20:47:51.124011Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.124429Z", "completed_at": "2024-02-20T20:47:51.124437Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008599996566772461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__lab_institutional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Lab' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('14')", "relation_name": "raw.claims_preprocessing._int_lab_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.121395Z", "completed_at": "2024-02-20T20:47:51.124619Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.125663Z", "completed_at": "2024-02-20T20:47:51.125666Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.009284257888793945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__lab_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Lab' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code = '81'", "relation_name": "raw.claims_preprocessing._int_lab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.126927Z", "completed_at": "2024-02-20T20:47:51.133069Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.133469Z", "completed_at": "2024-02-20T20:47:51.133472Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008099079132080078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_visit_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Office Visit' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('11','02')", "relation_name": "raw.claims_preprocessing._int_office_visit_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.130217Z", "completed_at": "2024-02-20T20:47:51.133649Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.134618Z", "completed_at": "2024-02-20T20:47:51.134620Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.005522012710571289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Outpatient Hospital or Clinic' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('15','17','19','22','49','50','60','71','72')", "relation_name": "raw.claims_preprocessing._int_outpatient_hospital_or_clinic_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.135800Z", "completed_at": "2024-02-20T20:47:51.142923Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.143510Z", "completed_at": "2024-02-20T20:47:51.143512Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.009168863296508789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Outpatient Psychiatric' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('52')", "relation_name": "raw.claims_preprocessing._int_outpatient_psychiatric_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.140182Z", "completed_at": "2024-02-20T20:47:51.143318Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.144224Z", "completed_at": "2024-02-20T20:47:51.144226Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.005156278610229492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Outpatient Psychiatric' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('52','53','57','58')", "relation_name": "raw.claims_preprocessing._int_outpatient_psychiatric_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.145982Z", "completed_at": "2024-02-20T20:47:51.158252Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.158831Z", "completed_at": "2024-02-20T20:47:51.158835Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.014348983764648438, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Outpatient Rehabilitation' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('62')", "relation_name": "raw.claims_preprocessing._int_outpatient_rehab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.154973Z", "completed_at": "2024-02-20T20:47:51.159030Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.160057Z", "completed_at": "2024-02-20T20:47:51.160059Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.015046834945678711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__skilled_nursing_institutional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, 'Skilled Nursing' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and left(bill_type_code,2) in ('21','22')", "relation_name": "raw.claims_preprocessing._int_skilled_nursing_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.161405Z", "completed_at": "2024-02-20T20:47:51.167851Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.168427Z", "completed_at": "2024-02-20T20:47:51.168430Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008674144744873047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__urgent_care_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n claim_id\n, claim_line_number\n, 'Urgent Care' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('20')", "relation_name": "raw.claims_preprocessing._int_urgent_care_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.164652Z", "completed_at": "2024-02-20T20:47:51.168234Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.169221Z", "completed_at": "2024-02-20T20:47:51.169223Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.005667209625244141, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail", "compiled": true, "compiled_code": "\n\nwith test_detail_union as(\n\nselect * from raw.data_quality._int_claims_preprocessing_test_detail_stage_medical_claim\nunion all\nselect * from raw.data_quality._int_claims_preprocessing_test_detail_stage_eligibility\nunion all\nselect * from raw.data_quality._int_claims_preprocessing_test_detail_stage_pharmacy_claim\n\n\n)\n\nselect \n source_table\n , case \n when source_table = 'normalized_input__medical_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__medical_claim' and test_category = 'claim_type'\n then '2_claim_type'\n when source_table = 'normalized_input__medical_claim' and test_category = 'header'\n then '3_header'\n when source_table = 'normalized_input__medical_claim' and test_category = 'invalid_values'\n then '4_invalid_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'missing_values'\n then '5_missing_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'plausibility'\n then '6_plausibility' \n when source_table = 'normalized_input__eligibility' and test_category = 'duplicate_eligibility'\n then '1_duplicate_eligibility'\n when source_table = 'normalized_input__eligibility' and test_category = 'invalid_values'\n then '2_invalid_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'missing_values'\n then '3_missing_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'plausibility'\n then '4_plausibility'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'missing_values'\n then '2_missing_values'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'plausibility'\n then '3_plausibility'\n else test_category \n end as test_category\n , test_name \n , grain\n , claim_type\n , pipeline_test\n , foreign_key\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom test_detail_union", "relation_name": "raw.data_quality.claims_preprocessing_test_detail"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.171180Z", "completed_at": "2024-02-20T20:47:51.178095Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.178539Z", "completed_at": "2024-02-20T20:47:51.178543Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.009106874465942383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__emergency_department_institutional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n med.claim_id\n , 'Emergency Department' as service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim med\nleft join raw.claims_preprocessing._int_acute_inpatient_institutional inpatient\n on med.claim_id = inpatient.claim_id\nwhere claim_type = 'institutional'\nand revenue_center_code in ('0450','0451','0452','0459','0981')\nand inpatient.claim_id is null\n-- 0456, urgent care, is included in most published definitions\n-- that also include a requirement of a bill type code for\n-- inpatient or outpatient hospital.", "relation_name": "raw.claims_preprocessing._int_emergency_department_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.174660Z", "completed_at": "2024-02-20T20:47:51.178736Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.179831Z", "completed_at": "2024-02-20T20:47:51.179833Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.009831905364990234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n a.claim_id\n, a.claim_line_number\n, 'Ambulatory Surgery' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join raw.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 a.claim_type = 'professional'\n and a.place_of_service_code in ('24')\n and (b.claim_id is null and b.claim_line_number is null)", "relation_name": "raw.claims_preprocessing._int_ambulatory_surgery_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.181228Z", "completed_at": "2024-02-20T20:47:51.189293Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.189706Z", "completed_at": "2024-02-20T20:47:51.189710Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.010146856307983398, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__home_health_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n a.claim_id\n, a.claim_line_number\n, 'Home Health' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join raw.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 a.claim_type = 'professional'\n and a.place_of_service_code in ('12')\n and (b.claim_id is null and b.claim_line_number is null)", "relation_name": "raw.claims_preprocessing._int_home_health_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.185650Z", "completed_at": "2024-02-20T20:47:51.189896Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.190925Z", "completed_at": "2024-02-20T20:47:51.190927Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006508827209472656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__skilled_nursing_professional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n a.claim_id\n, a.claim_line_number\n, 'Skilled Nursing' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join raw.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": "raw.claims_preprocessing._int_skilled_nursing_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.192214Z", "completed_at": "2024-02-20T20:47:51.204236Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.204656Z", "completed_at": "2024-02-20T20:47:51.204659Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.01433110237121582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dq_input_layer_results", "compiled": true, "compiled_code": "\n\nselect\n dq_problem\n, count(distinct claim_id) as distinct_claims\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._dq_input_layer_tests\ngroup by 1", "relation_name": "raw.claims_preprocessing._dq_input_layer_results"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.194759Z", "completed_at": "2024-02-20T20:47:51.206227Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.208138Z", "completed_at": "2024-02-20T20:47:51.208141Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.014487981796264648, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_summary", "compiled": true, "compiled_code": "\n\nwith test_failure_summary as (\n select\n cast(source_table as TEXT ) as source_table\n , cast(grain as TEXT ) as grain\n , cast(test_category as TEXT ) as test_category\n , cast(count(distinct foreign_key||data_source) as int) as counts\n from raw.data_quality.claims_preprocessing_test_detail\n group by\n source_table\n ,grain\n ,test_category\n)\n\n, summary_union as(\n select\n cast(source_table as TEXT ) as source_table\n , cast(grain as TEXT ) as grain\n , cast(test_category as TEXT ) as test_category\n , cast(counts as int) as counts\n from test_failure_summary\n\n /******* The tables below populate the test when no failures are present ******/\n union all\n\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('duplicate_claims' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_duplicates )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('claim_type' as TEXT ) as test_category\n , cast(0 as int) as counts \n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_claim_type_mapping_failures )\n and not exists (select 1 from raw.data_quality._int_claims_preprocessing_claim_type_unmapped )\n and not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values where test_category = 'claim_type')\n and not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values where test_category = 'claim_type')\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('header' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_institutional_header_fail_details )\n and not exists (select 1 from raw.data_quality._int_claims_preprocessing_professional_header_fail_details )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('invalid_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_invalid_values )\n union all\n select * from (\n select\n cast('normalized_input__medical_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('missing_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_inst_missing_values )\n and not exists (select 1 from raw.data_quality._int_claims_preprocessing_medical_claim_prof_missing_values )\n\n /**** eligibility ****/\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as TEXT ) as source_table\n , cast('patient_id' as TEXT ) as grain\n , cast('duplicate_eligibility' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_eligibility_duplicates )\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as TEXT ) as source_table\n , cast('patient_id' as TEXT ) as grain\n , cast('invalid_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_eligibility_invalid_values )\n union all\n select * from (\n select\n cast('normalized_input__eligibility' as TEXT ) as source_table\n , cast('patient_id' as TEXT ) as grain\n , cast('missing_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_eligibility_missing_values )\n\n /**** pharmacy_claim ****/\n union all\n select * from (\n select\n cast('normalized_input__pharmacy_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('duplicate_claims' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_pharmacy_claim_duplicates )\n union all\n select * from (\n select\n cast('normalized_input__pharmacy_claim' as TEXT ) as source_table\n , cast('claim_id' as TEXT ) as grain\n , cast('missing_values' as TEXT ) as test_category\n , cast(0 as int) as counts\n ) failure_stub\n where not exists (select 1 from raw.data_quality._int_claims_preprocessing_pharmacy_claim_missing_values )\n)\n\nselect \n cast(source_table as TEXT ) as source_table\n , cast(case \n when source_table = 'normalized_input__medical_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__medical_claim' and test_category = 'claim_type'\n then '2_claim_type'\n when source_table = 'normalized_input__medical_claim' and test_category = 'header'\n then '3_header'\n when source_table = 'normalized_input__medical_claim' and test_category = 'invalid_values'\n then '4_invalid_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'missing_values'\n then '5_missing_values'\n when source_table = 'normalized_input__medical_claim' and test_category = 'plausibility'\n then '6_plausibility' \n when source_table = 'normalized_input__medical_claim' and test_category = 'good'\n then '7_good' \n when source_table = 'normalized_input__eligibility' and test_category = 'duplicate_eligibility'\n then '1_duplicate_eligibility'\n when source_table = 'normalized_input__eligibility' and test_category = 'invalid_values'\n then '2_invalid_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'missing_values'\n then '3_missing_values'\n when source_table = 'normalized_input__eligibility' and test_category = 'plausibility'\n then '4_plausibility' \n when source_table = 'normalized_input__eligibility' and test_category = 'good'\n then '5_good'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'duplicate_claims'\n then '1_duplicate_claims'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'missing_values'\n then '2_missing_values'\n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'plausibility'\n then '3_plausibility' \n when source_table = 'normalized_input__pharmacy_claim' and test_category = 'good'\n then '4_good'\n else test_category \n end as TEXT ) as test_category\n , cast(counts as int) as counts\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom summary_union", "relation_name": "raw.data_quality.claims_preprocessing_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.209010Z", "completed_at": "2024-02-20T20:47:51.218583Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.218986Z", "completed_at": "2024-02-20T20:47:51.218989Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.01153874397277832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim_denominator as(\n select \n cast('all' as TEXT ) as claim_type\n , cast(count(distinct claim_id||data_source) as int) as count\n , cast('2024-02-20 20:47:44.615990+00:00' as TEXT ) as tuva_last_run\n from raw.claims_preprocessing.normalized_input_pharmacy_claim\n)\n\n, distinct_patient_per_category as(\n select\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n from raw.data_quality.claims_preprocessing_test_detail\n where source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n )\n\n select\n source_table\n , grain\n , claim.test_category\n , claim.test_name\n , claim.claim_type\n , pipeline_test\n , claim.failures\n , denom.count as denominator\n , tuva_last_run\n from distinct_patient_per_category claim\n left join pharmacy_claim_denominator denom\n on claim.claim_type = denom.claim_type\n group by\n source_table\n , grain\n , claim.test_category\n , claim.test_name\n , claim.claim_type\n , pipeline_test\n , claim.failures\n , denom.count\n , tuva_last_run", "relation_name": "raw.data_quality._int_claims_preprocessing_test_result_stage_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.215055Z", "completed_at": "2024-02-20T20:47:51.219580Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.220479Z", "completed_at": "2024-02-20T20:47:51.220481Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.0064280033111572266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_use_case", "compiled": true, "compiled_code": "\nwith use_case_stage as(\n select\n 'encounters' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all\n\n select \n 'service_grouper' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'hcpcs_code missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'readmissions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'pmpm' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('patient_id missing'\n ,'claim_start_date missing'\n ,'claim_type invalid'\n ,'claim_type missing'\n\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'readmissions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_pharmacy_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('patient_id missing'\n ,'dispensing_date missing'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'paid_amount missing'\n )\n and source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'member_months' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct patient_id||data_source) from raw.claims_preprocessing.normalized_input_eligibility ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('patient_id missing'\n ,'enrollment_start_date missing'\n ,'enrollment_end_date invalid'\n ,'payer missing'\n ,'payer missing'\n ,'payer_type invalid'\n )\n and source_table = 'normalized_input__eligibility'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'chronic_conditions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_medical_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'claim_start_date missing'\n ,'claim_start_date invalid'\n ,'patient_id missing'\n ,'patient_id invalid'\n ,'diagnosis_code_type missing'\n ,'diagnosis_code_type invalid'\n ,'procedure_code_1 missing'\n ,'procedure_code_1 invalid'\n ,'procedure_code_type invalid'\n ,'procedure_code_type missing'\n /** encounter fields **/\n ,'diagnosis_code_1 missing'\n ,'diagnosis_code_1 invalid'\n ,'revenue_center_code missing'\n ,'revenue_center_code invalid'\n ,'discharge_disposition_code missing'\n ,'discharge_disposition_code invalid'\n ,'ms_drg_code missing'\n ,'ms_drg_code invalid'\n ,'bill_type_code missing'\n ,'bill_type_code invalid'\n ,'place_of_service_code missing'\n ,'place_of_service_code invalid'\n ,'claim_type invalid'\n ,'claim_type missing'\n ,'claim_id missing'\n ,'patient_id missing'\n ,'claim_start_date missing'\n ,'claim_end_date missing'\n ,'facility_npi missing'\n )\n and source_table = 'normalized_input__medical_claim'\n group by\n source_table\n , test_name\n\n union all \n\n select \n 'chronic_conditions' as use_case\n , source_table\n , test_name\n , count(distinct foreign_key||data_source) as failures\n , (select count(distinct claim_id||data_source) from raw.claims_preprocessing.normalized_input_pharmacy_claim ) as denominator\n from raw.data_quality.claims_preprocessing_test_detail\n where 1=1\n and test_name in ('ndc_code missing'\n ,'patient_id missing'\n ,'paid_date missing'\n )\n and source_table = 'normalized_input__pharmacy_claim'\n group by\n source_table\n , test_name\n)\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run from use_case_stage", "relation_name": "raw.data_quality.claims_preprocessing_use_case"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.221240Z", "completed_at": "2024-02-20T20:47:51.226478Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.226922Z", "completed_at": "2024-02-20T20:47:51.226925Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007097721099853516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom raw.data_quality.claims_preprocessing_test_detail\nwhere source_table is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.224497Z", "completed_at": "2024-02-20T20:47:51.227501Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.228477Z", "completed_at": "2024-02-20T20:47:51.228478Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.005052089691162109, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_category\nfrom raw.data_quality.claims_preprocessing_test_detail\nwhere test_category is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.229248Z", "completed_at": "2024-02-20T20:47:51.235295Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.235757Z", "completed_at": "2024-02-20T20:47:51.235761Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008040904998779297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_name\nfrom raw.data_quality.claims_preprocessing_test_detail\nwhere test_name is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.231885Z", "completed_at": "2024-02-20T20:47:51.236353Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.237157Z", "completed_at": "2024-02-20T20:47:51.237159Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.00629878044128418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__urgent_care_institutional", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n a.claim_id\n, 'Urgent Care' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join raw.claims_preprocessing._int_emergency_department_institutional b\n on a.claim_id = b.claim_id\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and left(bill_type_code,2) in ('13','71','73')\n and b.claim_id is null", "relation_name": "raw.claims_preprocessing._int_urgent_care_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.237935Z", "completed_at": "2024-02-20T20:47:51.247203Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.247647Z", "completed_at": "2024-02-20T20:47:51.247650Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.011114358901977539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__combined_professional", "compiled": true, "compiled_code": "\n\nwith combined as (\nselect *\nfrom raw.claims_preprocessing._int_acute_inpatient_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_ambulatory_surgery_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_dialysis_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_emergency_department_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_home_health_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_hospice_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_inpatient_psychiatric_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_inpatient_rehab_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_lab_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_office_visit_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_outpatient_hospital_or_clinic_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_outpatient_psychiatric_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_outpatient_rehab_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_skilled_nursing_professional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_urgent_care_professional\n)\n\nselect \n claim_id\n, claim_line_number\n, service_category_2\n, tuva_last_run\nfrom raw.claims_preprocessing._int_dme_professional\n\nunion all\n\nselect \n a.claim_id\n, a.claim_line_number\n, a.service_category_2\n, a.tuva_last_run\nfrom raw.claims_preprocessing._int_ambulance_professional a\nleft join raw.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 (b.claim_id is null and b.claim_line_number is null)\n\nunion all\n\nselect \n a.claim_id\n, a.claim_line_number\n, a.service_category_2\n, a.tuva_last_run\nfrom combined a\nleft join raw.claims_preprocessing._int_dme_professional b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\nleft join raw.claims_preprocessing._int_ambulance_professional c\n on a.claim_id = c.claim_id\n and a.claim_line_number = c.claim_line_number\nwhere (b.claim_id is null and b.claim_line_number is null)\n and (c.claim_id is null and c.claim_line_number is null)", "relation_name": "raw.claims_preprocessing._int_combined_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.243762Z", "completed_at": "2024-02-20T20:47:51.248210Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.249080Z", "completed_at": "2024-02-20T20:47:51.249082Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006308794021606445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_eligibility", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\n\n\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_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 , cast(plan as TEXT ) as 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(data_source as TEXT ) as data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_eligibility", "relation_name": "raw.core._stg_claims_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.249792Z", "completed_at": "2024-02-20T20:47:51.259742Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.260168Z", "completed_at": "2024-02-20T20:47:51.260171Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.011700868606567383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_patient", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\n\n\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\n\n\n\nwith patient_stage as(\n select\n patient_id\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,first_name\n ,last_name\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 from raw.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(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('2024-02-20 20:47:44.615990+00:00' as timestamp) as tuva_last_run\nfrom patient_stage\nwhere row_sequence = 1", "relation_name": "raw.core._stg_claims_patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.254735Z", "completed_at": "2024-02-20T20:47:51.260741Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.261653Z", "completed_at": "2024-02-20T20:47:51.261655Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007860183715820312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_pharmacy_claim", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\n\n\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 ) 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 , cast(plan as TEXT ) as plan\n , cast(prescribing_provider_npi as TEXT ) as prescribing_provider_npi\n , cast(dispensing_provider_npi as TEXT ) as dispensing_provider_npi\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\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(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(data_source as TEXT ) as data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_pharmacy_claim", "relation_name": "raw.core._stg_claims_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.262361Z", "completed_at": "2024-02-20T20:47:51.265180Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.267239Z", "completed_at": "2024-02-20T20:47:51.267241Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.0062062740325927734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468", "compiled": true, "compiled_code": "\n\n select *\n from raw.data_quality.claims_preprocessing_test_detail\n where pipeline_test = 1\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.265374Z", "completed_at": "2024-02-20T20:47:51.267967Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.268778Z", "completed_at": "2024-02-20T20:47:51.268780Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006124973297119141, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom raw.data_quality.claims_preprocessing_summary\nwhere source_table is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.268969Z", "completed_at": "2024-02-20T20:47:51.271730Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.274464Z", "completed_at": "2024-02-20T20:47:51.274466Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.00851297378540039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_category\nfrom raw.data_quality.claims_preprocessing_summary\nwhere test_category is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.272423Z", "completed_at": "2024-02-20T20:47:51.277574Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.280640Z", "completed_at": "2024-02-20T20:47:51.280644Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.009762048721313477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom raw.data_quality.claims_preprocessing_use_case\nwhere source_table is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.278501Z", "completed_at": "2024-02-20T20:47:51.281926Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.284292Z", "completed_at": "2024-02-20T20:47:51.284294Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.007415056228637695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_name\nfrom raw.data_quality.claims_preprocessing_use_case\nwhere test_name is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.282504Z", "completed_at": "2024-02-20T20:47:51.285442Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.289698Z", "completed_at": "2024-02-20T20:47:51.289700Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.008466005325317383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect use_case\nfrom raw.data_quality.claims_preprocessing_use_case\nwhere use_case is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.286010Z", "completed_at": "2024-02-20T20:47:51.290849Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.293496Z", "completed_at": "2024-02-20T20:47:51.293498Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.008741140365600586, "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 __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select distinct \n a.claim_id\n, 'Outpatient Hospital or Clinic' as service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__service_category__stg_medical_claim a\nleft join raw.claims_preprocessing._int_emergency_department_institutional b\n on a.claim_id = b.claim_id\nleft join raw.claims_preprocessing._int_urgent_care_institutional c\n on a.claim_id = c.claim_id\nwhere a.claim_type = 'institutional'\n and left(a.bill_type_code,2) in ('13','71','73')\n and b.claim_id is null\n and c.claim_id is null", "relation_name": "raw.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.291450Z", "completed_at": "2024-02-20T20:47:51.294665Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.297574Z", "completed_at": "2024-02-20T20:47:51.297576Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007353782653808594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dq_multiple_service_categories_professional", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n, claim_line_number\n, count(distinct service_category_2) as distinct_service_category_count\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_combined_professional\ngroup by 1,2\nhaving count(distinct service_category_2) > 1", "relation_name": "raw.claims_preprocessing._dq_multiple_service_categories_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.295204Z", "completed_at": "2024-02-20T20:47:51.298338Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.299139Z", "completed_at": "2024-02-20T20:47:51.299140Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.0076296329498291016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__eligibility", "compiled": true, "compiled_code": "\n\n\nselect * from raw.core._stg_claims_eligibility", "relation_name": "raw.core.eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.299314Z", "completed_at": "2024-02-20T20:47:51.302973Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.304754Z", "completed_at": "2024-02-20T20:47:51.304756Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.0065190792083740234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__patient", "compiled": true, "compiled_code": "\n\nselect * from raw.core._stg_claims_patient\nunion all\nselect * from raw.core._stg_clinical_patient\n\n", "relation_name": "raw.core.patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.303169Z", "completed_at": "2024-02-20T20:47:51.305282Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.306176Z", "completed_at": "2024-02-20T20:47:51.306178Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.004087686538696289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__pharmacy_claim", "compiled": true, "compiled_code": "\n\nselect * from raw.core._stg_claims_pharmacy_claim", "relation_name": "raw.core.pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.306850Z", "completed_at": "2024-02-20T20:47:51.309553Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.311084Z", "completed_at": "2024-02-20T20:47:51.311088Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007606029510498047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__combined_institutional", "compiled": true, "compiled_code": "\n\nwith duplicate_bill_types as (\nselect distinct\n claim_id\n, 'Other' as service_category_2\nfrom raw.claims_preprocessing._int_duplicate_bill_types\n)\n\n, combine as (\nselect *\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_dialysis_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_emergency_department_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_home_health_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_hospice_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_lab_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_outpatient_psychiatric_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_skilled_nursing_institutional\n\nunion all\n\nselect *\nfrom raw.claims_preprocessing._int_urgent_care_institutional\n)\n\nselect\n claim_id\n, service_category_2\nfrom duplicate_bill_types\n\nunion all\n\nselect\n a.claim_id\n, a.service_category_2\nfrom combine a\nleft join duplicate_bill_types b\n on a.claim_id = b.claim_id\nwhere b.claim_id is null", "relation_name": "raw.claims_preprocessing._int_combined_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.347941Z", "completed_at": "2024-02-20T20:47:51.351069Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.351929Z", "completed_at": "2024-02-20T20:47:51.351932Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.025645017623901367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dq_multiple_service_categories_institutional", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n, count(distinct service_category_2) as distinct_service_category_count\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_combined_institutional\ngroup by 1\nhaving count(distinct service_category_2) > 1", "relation_name": "raw.claims_preprocessing._dq_multiple_service_categories_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.352369Z", "completed_at": "2024-02-20T20:47:51.380243Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.381421Z", "completed_at": "2024-02-20T20:47:51.381427Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.03073883056640625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__service_category_grouper", "compiled": true, "compiled_code": "\nwith __dbt__cte__service_category__stg_medical_claim as (\n\n\nselect\nAPR_DRG_CODE,\nBILL_TYPE_CODE,\nCLAIM_ID,\nCLAIM_LINE_NUMBER,\nCLAIM_TYPE,\nHCPCS_CODE,\nMS_DRG_CODE,\nPLACE_OF_SERVICE_CODE,\nREVENUE_CENTER_CODE,\n'2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), service_category_1_mapping as(\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case\n when service_category_2 = 'Acute Inpatient' then 'Inpatient'\n when service_category_2 = 'Ambulance' then 'Ancillary'\n when service_category_2 = 'Ambulatory Surgery' then 'Outpatient'\n when service_category_2 = 'Dialysis' then 'Outpatient'\n when service_category_2 = 'Durable Medical Equipment' then 'Ancillary'\n when service_category_2 = 'Emergency Department' then 'Outpatient'\n when service_category_2 = 'Home Health' then 'Outpatient'\n when service_category_2 = 'Hospice' then 'Outpatient'\n when service_category_2 = 'Inpatient Psychiatric' then 'Inpatient'\n when service_category_2 = 'Inpatient Rehabilitation' then 'Inpatient'\n when service_category_2 = 'Lab' then 'Ancillary'\n when service_category_2 = 'Office Visit' then 'Office Visit'\n when service_category_2 = 'Outpatient Hospital or Clinic' then 'Outpatient'\n when service_category_2 = 'Outpatient Psychiatric' then 'Outpatient'\n when service_category_2 = 'Outpatient Rehabilitation' then 'Outpatient'\n when service_category_2 = 'Skilled Nursing' then 'Inpatient'\n when service_category_2 = 'Urgent Care' then 'Outpatient'\n when service_category_2 is null then 'Other'\n end service_category_1\n , case\n when service_category_2 is null then 'Other'\n else service_category_2\n end service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from __dbt__cte__service_category__stg_medical_claim a\n left join raw.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 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\n when service_category_2 = 'Acute Inpatient' then 'Inpatient'\n when service_category_2 = 'Ambulatory Surgery' then 'Outpatient'\n when service_category_2 = 'Dialysis' then 'Outpatient'\n when service_category_2 = 'Emergency Department' then 'Outpatient'\n when service_category_2 = 'Home Health' then 'Outpatient'\n when service_category_2 = 'Hospice' then 'Outpatient'\n when service_category_2 = 'Inpatient Psychiatric' then 'Inpatient'\n when service_category_2 = 'Inpatient Rehabilitation' then 'Inpatient'\n when service_category_2 = 'Lab' then 'Ancillary'\n when service_category_2 = 'Office Visit' then 'Office Visit'\n when service_category_2 = 'Outpatient Hospital or Clinic' then 'Outpatient'\n when service_category_2 = 'Outpatient Psychiatric' then 'Outpatient'\n when service_category_2 = 'Skilled Nursing' then 'Inpatient'\n when service_category_2 = 'Urgent Care' then 'Outpatient'\n when service_category_2 is null then 'Other'\n end service_category_1\n , case\n when service_category_2 is null then 'Other'\n else service_category_2\n end service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from __dbt__cte__service_category__stg_medical_claim a\n left join raw.claims_preprocessing._int_combined_institutional b\n on a.claim_id = b.claim_id\n where a.claim_type = 'institutional'\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 , row_number() over (partition by claim_id, claim_line_number order by \n case\n when service_category_2 = 'Acute Inpatient' then 3\n when service_category_2 = 'Ambulance' then 7\n when service_category_2 = 'Ambulatory Surgery' then 8\n when service_category_2 = 'Dialysis' then 17\n when service_category_2 = 'Durable Medical Equipment' then 1\n when service_category_2 = 'Emergency Department' then 5\n when service_category_2 = 'Home Health' then 9\n when service_category_2 = 'Hospice' then 10\n when service_category_2 = 'Inpatient Psychiatric' then 11\n when service_category_2 = 'Inpatient Rehabilitation' then 12\n when service_category_2 = 'Lab' then 13\n when service_category_2 = 'Office Visit' then 4\n when service_category_2 = 'Outpatient Hospital or Clinic' then 14\n when service_category_2 = 'Outpatient Psychiatric' then 15\n when service_category_2 = 'Outpatient Rehabilitation' then 16\n when service_category_2 = 'Skilled Nursing' then 6\n when service_category_2 = 'Urgent Care' then 2\n when service_category_2 is null then 18\n else 99 end) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\nfrom service_category_2_deduplication\nwhere duplicate_row_number = 1", "relation_name": "raw.claims_preprocessing.service_category_grouper"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.374099Z", "completed_at": "2024-02-20T20:47:51.381622Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.382717Z", "completed_at": "2024-02-20T20:47:51.382719Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.009910106658935547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__member_months", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__financial_pmpm__stg_eligibility as (\n\n\nselect\n patient_id\n, enrollment_start_date\n, enrollment_end_date\n, payer\n, plan\n, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.eligibility\n), month_start_and_end_dates as (\nselect \n concat(cast(year as TEXT ),lpad(cast(month as TEXT),2,'0')) as year_month\n, min(full_date) as month_start_date\n, max(full_date) as month_end_date\nfrom raw.terminology.calendar\ngroup by 1\n)\n\nselect distinct\n a.patient_id\n, year_month\n, a.payer\n, a.plan\n, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__financial_pmpm__stg_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": "raw.financial_pmpm.member_months"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.399859Z", "completed_at": "2024-02-20T20:47:51.449719Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.461847Z", "completed_at": "2024-02-20T20:47:51.461850Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.07983517646789551, "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\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 /* filter to members with eligibility in collection or payment year */\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, 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 < '2023-01-01'\n then '2023-01-01'\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > '2023-12-31'\n then '2023-12-31'\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 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, 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 , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\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 when dual_status_code is null then TRUE\n else FALSE\n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\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 end as orec_default\n /* Setting default true until institutional logic is added */\n , TRUE as institutional_status_default\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 , 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 , 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc._int_members"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.450298Z", "completed_at": "2024-02-20T20:47:51.462230Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.464267Z", "completed_at": "2024-02-20T20:47:51.464268Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.0462031364440918, "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 raw.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 , cast(date_part('year', class.encounter_end_date) as TEXT) \n || right('0'||cast(date_part('month', class.encounter_end_date) as TEXT),2) \n 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_npi\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-- , null as facility_latitude\n-- , null as facility_longitude\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 raw.ed_classification._int_filter_encounter_with_classification class\ninner join raw.ed_classification._value_set_categories cat\n using(classification)\nleft join raw.terminology.provider fac_prov \n on class.facility_npi = fac_prov.npi\nleft join __dbt__cte__ed_classification__stg_patient pat\n on class.patient_id = pat.patient_id", "relation_name": "raw.ed_classification.summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.466673Z", "completed_at": "2024-02-20T20:47:51.475446Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.475888Z", "completed_at": "2024-02-20T20:47:51.475891Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011771917343139648, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20T20:47:51.472921Z", "completed_at": "2024-02-20T20:47:51.476086Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.477099Z", "completed_at": "2024-02-20T20:47:51.477102Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.005896329879760742, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20T20:47:51.478378Z", "completed_at": "2024-02-20T20:47:51.483527Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.483971Z", "completed_at": "2024-02-20T20:47:51.483976Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007241964340209961, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20T20:47:51.481211Z", "completed_at": "2024-02-20T20:47:51.484157Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.485196Z", "completed_at": "2024-02-20T20:47:51.485198Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.00516200065612793, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20T20:47:51.493388Z", "completed_at": "2024-02-20T20:47:51.499651Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.500020Z", "completed_at": "2024-02-20T20:47:51.500022Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.008213996887207031, "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 raw.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 raw.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 , 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 , 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc._int_demographic_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.497961Z", "completed_at": "2024-02-20T20:47:51.500197Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.501207Z", "completed_at": "2024-02-20T20:47:51.501209Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.0043909549713134766, "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 raw.cms_hcc._int_members\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.502426Z", "completed_at": "2024-02-20T20:47:51.517316Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.540319Z", "completed_at": "2024-02-20T20:47:51.540322Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.039328813552856445, "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 raw.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-02-20T20:47:51.505599Z", "completed_at": "2024-02-20T20:47:51.541545Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.572809Z", "completed_at": "2024-02-20T20:47:51.572815Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.07206010818481445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__institutional_claims", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model gives us all acute inpatient institutional claims.\n-- We have one row per claim_id (for all claim_ids belonging to\n-- acute inpatient institutinal claims).\n-- The number of rows in the table is equal to the number of unique\n-- claim_ids (i.e. claim_id is a primary key).\n-- Note that we are assuming that a claim_id is unique across\n-- all people in the datset, i.e.\n-- that no two people can have the same claim_id.\n-- *************************************************\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), __dbt__cte__acute_inpatient__stg_service_category as (\n\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n), acute_inpatient_claim_lines as (\nselect\n mc.patient_id,\n mc.claim_id,\n mc.claim_line_number,\n mc.claim_start_date,\n mc.claim_end_date,\n mc.admission_date,\n mc.discharge_date,\n mc.admit_source_code,\n mc.admit_type_code,\n mc.discharge_disposition_code,\n mc.facility_npi,\n mc.claim_type,\n mc.data_source\nfrom __dbt__cte__acute_inpatient__stg_medical_claim mc\ninner join __dbt__cte__acute_inpatient__stg_service_category sc\n on mc.claim_id = sc.claim_id\nwhere mc.claim_type = 'institutional'\n and sc.service_category_2 = 'Acute Inpatient'\n),\n\ndata_quality_flags as (\nselect\n claim_id,\n-- patient_id_not_unique:\n case\n when count(distinct patient_id) > 1 then 1\n else 0\n end as patient_id_not_unique,\n-- patient_id_missing: \n case\n when max(patient_id) is null then 1\n else 0\n end as patient_id_missing, \n-- claim_start_date_not_unique:\n case\n when count(distinct claim_start_date) > 1 then 1\n else 0\n end as claim_start_date_not_unique,\n-- claim_start_date_missing: \n case\n when max(claim_start_date) is null then 1\n else 0\n end as claim_start_date_missing,\n-- claim_end_date_not_unique:\n case\n when count(distinct claim_end_date) > 1 then 1\n else 0\n end as claim_end_date_not_unique,\n-- claim_end_date_missing: \n case\n when max(claim_end_date) is null then 1\n else 0\n end as claim_end_date_missing,\n-- claim_start_date_after_claim_end_date:\n case\n when min(claim_start_date) > max(claim_end_date) then 1\n else 0\n end as claim_start_date_after_claim_end_date,\n-- admission_date_not_unique:\n case\n when count(distinct admission_date) > 1 then 1\n else 0\n end as admission_date_not_unique,\n-- admission_date_missing: \n case\n when max(admission_date) is null then 1\n else 0\n end as admission_date_missing,\n-- discharge_date_not_unique:\n case\n when count(distinct discharge_date) > 1 then 1\n else 0\n end as discharge_date_not_unique,\n-- discharge_date_missing: \n case\n when max(discharge_date) is null then 1\n else 0\n end as discharge_date_missing,\n-- admission_date_after_discharge_date:\n case\n when min(admission_date) > max(discharge_date) then 1\n else 0\n end as admission_date_after_discharge_date,\n-- admit_type_code_not_unique:\n case\n when count(distinct admit_type_code) > 1 then 1\n else 0\n end as admit_type_code_not_unique,\n-- admit_type_code_missing: \n case\n when max(admit_type_code) is null then 1\n else 0\n end as admit_type_code_missing, \n-- admit_source_code_not_unique:\n case\n when count(distinct admit_source_code) > 1 then 1\n else 0\n end as admit_source_code_not_unique,\n-- admit_source_code_missing: \n case\n when max(admit_source_code) is null then 1\n else 0\n end as admit_source_code_missing, \n-- discharge_disposition_code_not_unique:\n case\n when count(distinct discharge_disposition_code) > 1 then 1\n else 0\n end as discharge_disposition_code_not_unique,\n-- discharge_disposition_code_missing: \n case\n when max(discharge_disposition_code) is null then 1\n else 0\n end as discharge_disposition_code_missing,\n-- facility_npi_not_unique:\n case\n when count(distinct facility_npi) > 1 then 1\n else 0\n end as facility_npi_not_unique,\n-- facility_npi_missing: \n case\n when max(facility_npi) is null then 1\n else 0\n end as facility_npi_missing,\n-- claim_type_not_unique:\n case\n when count(distinct claim_type) > 1 then 1\n else 0\n end as claim_type_not_unique,\n-- claim_type_missing: \n case\n when max(claim_type) is null then 1\n else 0\n end as claim_type_missing,\n-- claim_type_not_institutional:\n case\n when max(claim_type) <> 'institutional'\n and min(claim_type) <> 'institutional' then 1\n else 0\n end as claim_type_not_institutional\nfrom acute_inpatient_claim_lines\ngroup by claim_id\n),\n\n\nheader_level_values as (\nselect\n claim_id,\n max(patient_id) as patient_id,\n min(claim_start_date) as claim_start_date,\n max(claim_end_date) as claim_end_date,\n min(admission_date) as admission_date,\n max(discharge_date) as discharge_date,\n max(admit_source_code) as admit_source_code,\n max(admit_type_code) as admit_type_code,\n max(discharge_disposition_code) as discharge_disposition_code,\n max(facility_npi) as facility_npi,\n max(claim_type) as claim_type,\n coalesce(min(admission_date),\n min(claim_start_date)) as start_date,\n coalesce(max(discharge_date),\n max(claim_end_date)) as end_date,\n case\n when min(admission_date) is not null then 'admission_date'\n when min(claim_start_date) is not null then 'claim_start_date'\n else null\n end as date_used_as_start_date,\n case\n when max(discharge_date) is not null then 'discharge_date'\n when max(claim_end_date) is not null then 'claim_end_date'\n else null\n end as date_used_as_end_date,\n data_source\nfrom acute_inpatient_claim_lines\ngroup by claim_id, data_source\n)\n\nselect\n h.patient_id as patient_id,\n h.claim_id as claim_id, \n h.claim_start_date as claim_start_date,\n h.claim_end_date as claim_end_date,\n h.admission_date as admission_date,\n h.discharge_date as discharge_date,\n h.admit_source_code as admit_source_code,\n h.admit_type_code as admit_type_code,\n h.discharge_disposition_code as discharge_disposition_code,\n h.facility_npi as facility_npi,\n h.claim_type as claim_type,\n h.start_date as start_date,\n h.end_date as end_date,\n h.date_used_as_start_date,\n h.date_used_as_end_date, \n\n case\n when\n ( (dq.patient_id_not_unique = 1) or\n (dq.patient_id_missing = 1) or\n (dq.discharge_disposition_code_not_unique = 1) or\n (dq.discharge_disposition_code_missing = 1) or\n (dq.facility_npi_not_unique = 1) or\n (dq.facility_npi_missing = 1) or\n (h.date_used_as_start_date is null) or\n\t(h.date_used_as_end_date is null) or\n\t(h.start_date > h.end_date) ) then 1\n else 0\n end as dq_problem,\n\n case\n when\n ( (dq.claim_start_date_not_unique = 1) or\n\t(dq.claim_start_date_missing = 1) or\n (dq.claim_end_date_not_unique = 1) or\n (dq.claim_end_date_missing = 1) or\n (dq.claim_start_date_after_claim_end_date = 1) or\n (dq.admission_date_not_unique = 1) or\n (dq.admission_date_missing = 1) or\n (dq.discharge_date_not_unique = 1) or\n (dq.discharge_date_missing = 1) or\n (dq.admission_date_after_discharge_date = 1) or\n (dq.admit_type_code_not_unique = 1) or\n (dq.admit_type_code_missing = 1) or\n (dq.admit_source_code_not_unique = 1) or\n (dq.admit_source_code_missing = 1) or\t\n (dq.claim_type_not_unique = 1) or\n (dq.claim_type_missing = 1) or\n (dq.claim_type_not_institutional = 1) ) then 1\n else 0\n end as dq_insight,\n\n case\n when (h.date_used_as_start_date is null) then 1\n else 0\n end as start_date_not_determined,\n \n case\n when (h.date_used_as_end_date is null) then 1\n else 0\n end as end_date_not_determined,\n\n case\n when (h.start_date > h.end_date) then 1\n else 0\n end as start_date_after_end_date,\n \n dq.patient_id_not_unique as patient_id_not_unique,\n dq.patient_id_missing as patient_id_missing,\n dq.claim_start_date_not_unique as claim_start_date_not_unique,\n dq.claim_start_date_missing as claim_start_date_missing,\n dq.claim_end_date_not_unique as claim_end_date_not_unique,\n dq.claim_end_date_missing as claim_end_date_missing,\n dq.claim_start_date_after_claim_end_date\n as claim_start_date_after_claim_end_date,\n dq.admission_date_not_unique as admission_date_not_unique,\n dq.admission_date_missing as admission_date_missing,\n dq.discharge_date_not_unique as discharge_date_not_unique,\n dq.discharge_date_missing as discharge_date_missing,\n dq.admission_date_after_discharge_date\n as admission_date_after_discharge_date,\n dq.admit_type_code_not_unique\n as admit_type_code_not_unique,\n dq.admit_type_code_missing\n as admit_type_code_missing,\n dq.admit_source_code_not_unique\n as admit_source_code_not_unique,\n dq.admit_source_code_missing\n as admit_source_code_missing,\n dq.discharge_disposition_code_not_unique\n as discharge_disposition_code_not_unique,\n dq.discharge_disposition_code_missing\n as discharge_disposition_code_missing,\n dq.facility_npi_not_unique as facility_npi_not_unique,\n dq.facility_npi_missing as facility_npi_missing,\n dq.claim_type_not_unique as claim_type_not_unique,\n dq.claim_type_missing as claim_type_missing,\n dq.claim_type_not_institutional as claim_type_not_institutional,\n h.data_source,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n\nfrom header_level_values h\nleft join data_quality_flags dq\n on h.claim_id = dq.claim_id", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_institutional_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.542057Z", "completed_at": "2024-02-20T20:47:51.578151Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.582366Z", "completed_at": "2024-02-20T20:47:51.582373Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.04156827926635742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_institutional_claims", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), __dbt__cte__emergency_department__stg_service_category as (\n\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n), emergency_department_claim_lines as (\nselect\n mc.patient_id,\n mc.claim_id,\n mc.claim_line_number,\n mc.claim_start_date,\n mc.claim_end_date,\n mc.admission_date,\n mc.discharge_date,\n mc.admit_source_code,\n mc.admit_type_code,\n mc.discharge_disposition_code,\n mc.facility_npi,\n mc.claim_type,\n mc.data_source\nfrom __dbt__cte__emergency_department__stg_medical_claim mc\ninner join __dbt__cte__emergency_department__stg_service_category sc\n on mc.claim_id = sc.claim_id\nwhere mc.claim_type = 'institutional'\n and sc.service_category_2 = 'Emergency Department'\n),\n\ndata_quality_flags as (\nselect\n claim_id,\n-- patient_id_not_unique:\n case\n when count(distinct patient_id) > 1 then 1\n else 0\n end as patient_id_not_unique,\n-- patient_id_missing: \n case\n when max(patient_id) is null then 1\n else 0\n end as patient_id_missing, \n-- claim_start_date_not_unique:\n case\n when count(distinct claim_start_date) > 1 then 1\n else 0\n end as claim_start_date_not_unique,\n-- claim_start_date_missing: \n case\n when max(claim_start_date) is null then 1\n else 0\n end as claim_start_date_missing,\n-- claim_end_date_not_unique:\n case\n when count(distinct claim_end_date) > 1 then 1\n else 0\n end as claim_end_date_not_unique,\n-- claim_end_date_missing: \n case\n when max(claim_end_date) is null then 1\n else 0\n end as claim_end_date_missing,\n-- claim_start_date_after_claim_end_date:\n case\n when min(claim_start_date) > max(claim_end_date) then 1\n else 0\n end as claim_start_date_after_claim_end_date,\n-- admission_date_not_unique:\n case\n when count(distinct admission_date) > 1 then 1\n else 0\n end as admission_date_not_unique,\n-- admission_date_missing: \n case\n when max(admission_date) is null then 1\n else 0\n end as admission_date_missing,\n-- discharge_date_not_unique:\n case\n when count(distinct discharge_date) > 1 then 1\n else 0\n end as discharge_date_not_unique,\n-- discharge_date_missing: \n case\n when max(discharge_date) is null then 1\n else 0\n end as discharge_date_missing,\n-- admission_date_after_discharge_date:\n case\n when min(admission_date) > max(discharge_date) then 1\n else 0\n end as admission_date_after_discharge_date,\n-- admit_type_code_not_unique:\n case\n when count(distinct admit_type_code) > 1 then 1\n else 0\n end as admit_type_code_not_unique,\n-- admit_type_code_missing: \n case\n when max(admit_type_code) is null then 1\n else 0\n end as admit_type_code_missing, \n-- admit_source_code_not_unique:\n case\n when count(distinct admit_source_code) > 1 then 1\n else 0\n end as admit_source_code_not_unique,\n-- admit_source_code_missing: \n case\n when max(admit_source_code) is null then 1\n else 0\n end as admit_source_code_missing, \n-- discharge_disposition_code_not_unique:\n case\n when count(distinct discharge_disposition_code) > 1 then 1\n else 0\n end as discharge_disposition_code_not_unique,\n-- discharge_disposition_code_missing: \n case\n when max(discharge_disposition_code) is null then 1\n else 0\n end as discharge_disposition_code_missing,\n-- facility_npi_not_unique:\n case\n when count(distinct facility_npi) > 1 then 1\n else 0\n end as facility_npi_not_unique,\n-- facility_npi_missing: \n case\n when max(facility_npi) is null then 1\n else 0\n end as facility_npi_missing,\n-- claim_type_not_unique:\n case\n when count(distinct claim_type) > 1 then 1\n else 0\n end as claim_type_not_unique,\n-- claim_type_missing: \n case\n when max(claim_type) is null then 1\n else 0\n end as claim_type_missing,\n-- claim_type_not_institutional:\n case\n when max(claim_type) <> 'institutional'\n and min(claim_type) <> 'institutional' then 1\n else 0\n end as claim_type_not_institutional\nfrom emergency_department_claim_lines\ngroup by claim_id\n),\n\n\nheader_level_values as (\nselect\n claim_id,\n max(patient_id) as patient_id,\n min(claim_start_date) as claim_start_date,\n max(claim_end_date) as claim_end_date,\n min(admission_date) as admission_date,\n max(discharge_date) as discharge_date,\n max(admit_source_code) as admit_source_code,\n max(admit_type_code) as admit_type_code,\n max(discharge_disposition_code) as discharge_disposition_code,\n max(facility_npi) as facility_npi,\n max(claim_type) as claim_type,\n coalesce(min(admission_date),\n min(claim_start_date)) as start_date,\n coalesce(max(discharge_date),\n max(claim_end_date)) as end_date,\n case\n when min(admission_date) is not null then 'admission_date'\n when min(claim_start_date) is not null then 'claim_start_date'\n else null\n end as date_used_as_start_date,\n case\n when max(discharge_date) is not null then 'discharge_date'\n when max(claim_end_date) is not null then 'claim_end_date'\n else null\n end as date_used_as_end_date,\n data_source\nfrom emergency_department_claim_lines\ngroup by claim_id, data_source\n)\n\nselect\n h.patient_id as patient_id,\n h.claim_id as claim_id, \n h.claim_start_date as claim_start_date,\n h.claim_end_date as claim_end_date,\n h.admission_date as admission_date,\n h.discharge_date as discharge_date,\n h.admit_source_code as admit_source_code,\n h.admit_type_code as admit_type_code,\n h.discharge_disposition_code as discharge_disposition_code,\n h.facility_npi as facility_npi,\n h.claim_type as claim_type,\n h.start_date as start_date,\n h.end_date as end_date,\n h.date_used_as_start_date,\n h.date_used_as_end_date, \n\n case\n when\n ( (dq.patient_id_not_unique = 1) or\n (dq.patient_id_missing = 1) or\n (dq.discharge_disposition_code_not_unique = 1) or\n (dq.discharge_disposition_code_missing = 1) or\n (dq.facility_npi_not_unique = 1) or\n (dq.facility_npi_missing = 1) or\n (h.date_used_as_start_date is null) or\n\t(h.date_used_as_end_date is null) or\n\t(h.start_date > h.end_date) ) then 1\n else 0\n end as dq_problem,\n\n case\n when\n ( (dq.claim_start_date_not_unique = 1) or\n\t(dq.claim_start_date_missing = 1) or\n (dq.claim_end_date_not_unique = 1) or\n (dq.claim_end_date_missing = 1) or\n (dq.claim_start_date_after_claim_end_date = 1) or\n (dq.admission_date_not_unique = 1) or\n (dq.admission_date_missing = 1) or\n (dq.discharge_date_not_unique = 1) or\n (dq.discharge_date_missing = 1) or\n (dq.admission_date_after_discharge_date = 1) or\n (dq.admit_type_code_not_unique = 1) or\n (dq.admit_type_code_missing = 1) or\n (dq.admit_source_code_not_unique = 1) or\n (dq.admit_source_code_missing = 1) or\t\n (dq.claim_type_not_unique = 1) or\n (dq.claim_type_missing = 1) or\n (dq.claim_type_not_institutional = 1) ) then 1\n else 0\n end as dq_insight,\n\n case\n when (h.date_used_as_start_date is null) then 1\n else 0\n end as start_date_not_determined,\n \n case\n when (h.date_used_as_end_date is null) then 1\n else 0\n end as end_date_not_determined,\n\n case\n when (h.start_date > h.end_date) then 1\n else 0\n end as start_date_after_end_date,\n \n dq.patient_id_not_unique as patient_id_not_unique,\n dq.patient_id_missing as patient_id_missing,\n dq.claim_start_date_not_unique as claim_start_date_not_unique,\n dq.claim_start_date_missing as claim_start_date_missing,\n dq.claim_end_date_not_unique as claim_end_date_not_unique,\n dq.claim_end_date_missing as claim_end_date_missing,\n dq.claim_start_date_after_claim_end_date\n as claim_start_date_after_claim_end_date,\n dq.admission_date_not_unique as admission_date_not_unique,\n dq.admission_date_missing as admission_date_missing,\n dq.discharge_date_not_unique as discharge_date_not_unique,\n dq.discharge_date_missing as discharge_date_missing,\n dq.admission_date_after_discharge_date\n as admission_date_after_discharge_date,\n dq.admit_type_code_not_unique\n as admit_type_code_not_unique,\n dq.admit_type_code_missing\n as admit_type_code_missing,\n dq.admit_source_code_not_unique\n as admit_source_code_not_unique,\n dq.admit_source_code_missing\n as admit_source_code_missing,\n dq.discharge_disposition_code_not_unique\n as discharge_disposition_code_not_unique,\n dq.discharge_disposition_code_missing\n as discharge_disposition_code_missing,\n dq.facility_npi_not_unique as facility_npi_not_unique,\n dq.facility_npi_missing as facility_npi_missing,\n dq.claim_type_not_unique as claim_type_not_unique,\n dq.claim_type_missing as claim_type_missing,\n dq.claim_type_not_institutional as claim_type_not_institutional,\n h.data_source,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n\nfrom header_level_values h\nleft join data_quality_flags dq\n on h.claim_id = dq.claim_id", "relation_name": "raw.claims_preprocessing._int_emergency_department_institutional_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.578765Z", "completed_at": "2024-02-20T20:47:51.583381Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.584268Z", "completed_at": "2024-02-20T20:47:51.584269Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.00878000259399414, "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 raw.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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc._int_enrollment_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.584447Z", "completed_at": "2024-02-20T20:47:51.587623Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.593894Z", "completed_at": "2024-02-20T20:47:51.593897Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.010664224624633789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id||'-'||model_version) as unique_field,\n count(*) as n_records\n\nfrom raw.cms_hcc._int_demographic_factors\nwhere (patient_id||'-'||model_version) is not null\ngroup by (patient_id||'-'||model_version)\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.587825Z", "completed_at": "2024-02-20T20:47:51.595161Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.598045Z", "completed_at": "2024-02-20T20:47:51.598047Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.01125025749206543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__data_quality_summary", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model summarizes data quality issues\n-- that could affect claims preprocessing.\n-- The table returns 2 fields:\n-- field\n-- total_count\n--\n-- If we order the results by 'field', the first\n-- 3 rows give us a high level summary:\n--\n-- 01 Total acute inpatient institutional claims:\n-- This is the total number of acute inpatient\n-- institutional claims\n-- 02 Acute inpatient institutional claims with insights:\n-- This is the number of acute inpatient institutional\n-- claims for which something is not ideal (e.g. they\n-- are missing a claim_start_date) but it's not something\n-- that prevents the claim from being used in the\n-- encounter grouper.\n\n-- 03 Acute inpatient institutional claims with problems:\n-- This is the number of acute inpatient institutional\n-- claims that have a data quality problem that\n-- prevents them from being used in the encounter grouper.\n\n-- The rest of the rows in the table give us counts\n-- of the number of acute inpatient institutional claims\n-- that have specific data quality problems.\n-- *************************************************\n\n\n\n\nwith total_acute_inpatient__institutional_claims as (\nselect\n '01 Total acute inpatient institutional claims' as field,\n count(*) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ntotal_claims_with_insights as (\nselect\n '02 Acute inpatient institutional claims with insights' as field,\n count(*) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\nwhere dq_insight = 1\n),\n\n\ntotal_claims_with_problems as (\nselect\n '03 Acute inpatient institutional claims with problems' as field,\n count(*) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\nwhere dq_problem = 1\n),\n\n\npatient_id_not_unique as (\nselect\n '04 patient_id_not_unique' as field,\n sum(patient_id_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\npatient_id_missing as (\nselect\n '05 patient_id_missing' as field,\n sum(patient_id_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_start_date_not_unique as (\nselect\n '06 claim_start_date_not_unique' as field,\n sum(claim_start_date_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_start_date_missing as (\nselect\n '07 claim_start_date_missing' as field,\n sum(claim_start_date_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_end_date_not_unique as (\nselect\n '08 claim_end_date_not_unique' as field,\n sum(claim_end_date_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_end_date_missing as (\nselect\n '09 claim_end_date_missing' as field,\n sum(claim_end_date_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_start_date_after_claim_end_date as (\nselect\n '10 claim_start_date_after_claim_end_date' as field,\n sum(claim_start_date_after_claim_end_date) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmission_date_not_unique as (\nselect\n '11 admission_date_not_unique' as field,\n sum(admission_date_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmission_date_missing as (\nselect\n '12 admission_date_missing' as field,\n sum(admission_date_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_date_not_unique as (\nselect\n '13 discharge_date_not_unique' as field,\n sum(discharge_date_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_date_missing as (\nselect\n '14 discharge_date_missing' as field,\n sum(discharge_date_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmission_date_after_discharge_date as (\nselect\n '15 admission_date_after_discharge_date' as field,\n sum(admission_date_after_discharge_date) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_type_code_not_unique as (\nselect\n '16 admit_type_code_not_unique' as field,\n sum(admit_type_code_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_type_code_missing as (\nselect\n '17 admit_type_code_missing' as field,\n sum(admit_type_code_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_source_code_not_unique as (\nselect\n '18 admit_source_code_not_unique' as field,\n sum(admit_source_code_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nadmit_source_code_missing as (\nselect\n '19 admit_source_code_missing' as field,\n sum(admit_source_code_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_disposition_code_not_unique as (\nselect\n '20 discharge_disposition_code_not_unique' as field,\n sum(discharge_disposition_code_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\ndischarge_disposition_code_missing as (\nselect\n '21 discharge_disposition_code_missing' as field,\n sum(discharge_disposition_code_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nfacility_npi_not_unique as (\nselect\n '22 facility_npi_not_unique' as field,\n sum(facility_npi_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nfacility_npi_missing as (\nselect\n '23 facility_npi_missing' as field,\n sum(facility_npi_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_type_not_unique as (\nselect\n '24 claim_type_not_unique' as field,\n sum(claim_type_not_unique) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_type_missing as (\nselect\n '25 claim_type_missing' as field,\n sum(claim_type_missing) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nclaim_type_not_institutional as (\nselect\n '26 claim_type_not_institutional' as field,\n sum(claim_type_not_institutional) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nstart_date_not_determined as (\nselect\n '27 start_date_not_determined' as field,\n sum(start_date_not_determined) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nend_date_not_determined as (\nselect\n '28 end_date_not_determined' as field,\n sum(end_date_not_determined) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\nstart_date_after_end_date as (\nselect\n '29 start_date_after_end_date' as field,\n sum(start_date_after_end_date) as total_count\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\n\n\nunion_cte as (\nselect *\nfrom total_acute_inpatient__institutional_claims\n\nunion all\n\nselect *\nfrom total_claims_with_insights\n\nunion all\n\nselect *\nfrom total_claims_with_problems\n\nunion all\n\nselect *\nfrom patient_id_not_unique\n\nunion all\n\nselect *\nfrom patient_id_missing\n\nunion all\n\nselect *\nfrom claim_start_date_not_unique\n\nunion all\n\nselect *\nfrom claim_start_date_missing\n\nunion all\n\nselect *\nfrom claim_end_date_not_unique\n\nunion all\n\nselect *\nfrom claim_end_date_missing\n\nunion all\n\nselect *\nfrom claim_start_date_after_claim_end_date\n\nunion all\n\nselect *\nfrom admission_date_not_unique\n\nunion all\n\nselect *\nfrom admission_date_missing\n\nunion all\n\nselect *\nfrom discharge_date_not_unique\n\nunion all\n\nselect *\nfrom discharge_date_missing\n\nunion all\n\nselect *\nfrom admission_date_after_discharge_date\n\nunion all\n\nselect *\nfrom admit_type_code_not_unique\n\nunion all\n\nselect *\nfrom admit_type_code_missing\n\nunion all\n\nselect *\nfrom admit_source_code_not_unique\n\nunion all\n\nselect *\nfrom admit_source_code_missing\n\nunion all\n\nselect *\nfrom discharge_disposition_code_not_unique\n\nunion all\n\nselect *\nfrom discharge_disposition_code_missing\n\nunion all\n\nselect *\nfrom facility_npi_not_unique\n\nunion all\n\nselect *\nfrom facility_npi_missing\n\nunion all\n\nselect *\nfrom claim_type_not_unique\n\nunion all\n\nselect *\nfrom claim_type_missing\n\nunion all\n\nselect *\nfrom claim_type_not_institutional\n\nunion all\n\nselect *\nfrom start_date_not_determined\n\nunion all\n\nselect *\nfrom end_date_not_determined\n\nunion all\n\nselect *\nfrom start_date_after_end_date\n)\n\n\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_data_quality_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.595365Z", "completed_at": "2024-02-20T20:47:51.598818Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.599621Z", "completed_at": "2024-02-20T20:47:51.599622Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007470130920410156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__institutional_encounter_id", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model groups acute inpatient institutional\n-- claims into encounters. It assigns an encounter_id\n-- to each acute inpatient institutional claim.\n-- This returns a table with 3 fields:\n-- patient_id\n-- claim_id\n-- encounter_id\n-- The number of rows in the table should be equal\n-- to the number of acute inpatient institutional claims.\n-- *************************************************\n\n\nwith add_row_num as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_npi,\n row_number() over (partition by patient_id order by end_date, start_date, claim_id) as row_num\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims\n),\n\ncheck_for_merges_with_larger_row_num as (\nselect\n aa.patient_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_npi should be merged:\n when (aa.end_date = bb.end_date\n and aa.facility_npi = bb.facility_npi) 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_npi = bb.facility_npi\n\t 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) and \n (aa.end_date >= bb.start_date) and --overlap requirement\n (aa.facility_npi = bb.facility_npi)\n\t )then 1\n else 0\n end as merge_flag\nfrom add_row_num aa\n inner join add_row_num bb\n on aa.patient_id = bb.patient_id\n and aa.row_num < bb.row_num\n),\n\nmerges_with_larger_row_num as (\nselect\n patient_id,\n claim_id_a,\n claim_id_b,\n row_num_a,\n row_num_b,\n merge_flag\nfrom check_for_merges_with_larger_row_num\nwhere merge_flag = 1\n),\n\n\nclaim_ids_that_merge_with_larger_row_num as (\nselect distinct claim_id_a as claim_id\nfrom merges_with_larger_row_num\n),\n\n\nclaim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\nselect distinct aa.claim_id as claim_id\nfrom add_row_num aa\n inner join\n merges_with_larger_row_num bb\n on aa.patient_id = bb.patient_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n),\n\n\nclose_flags as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.discharge_disposition_code,\n aa.facility_npi,\n aa.row_num,\n case when (bb.claim_id is null and cc.claim_id is null) then 1\n else 0\n end as close_flag\n\nfrom add_row_num aa\n\nleft join claim_ids_that_merge_with_larger_row_num bb\non aa.claim_id = bb.claim_id\n\nleft join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num cc\non aa.claim_id = cc.claim_id\n),\n\n\njoin_every_row_to_later_closes as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.row_num as row_num,\n bb.row_num as row_num_b\nfrom close_flags aa inner join close_flags bb\n on aa.patient_id = bb.patient_id\n and aa.row_num <= bb.row_num\nwhere bb.close_flag = 1\n),\n\n\nfind_min_closing_row_num_for_every_claim as (\nselect\n patient_id,\n claim_id,\n min(row_num_b) as min_closing_row\nfrom join_every_row_to_later_closes\ngroup by patient_id, claim_id\n),\n\n\nadd_min_closing_row_to_every_claim as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n bb.min_closing_row as min_closing_row\nfrom close_flags aa\n left join find_min_closing_row_num_for_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.claim_id = bb.claim_id\n),\n\n\nadd_encounter_id as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n aa.min_closing_row as min_closing_row,\n bb.claim_id as encounter_id\nfrom add_min_closing_row_to_every_claim aa\n left join add_min_closing_row_to_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_encounter_id", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_institutional_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.599818Z", "completed_at": "2024-02-20T20:47:51.603002Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.605606Z", "completed_at": "2024-02-20T20:47:51.605608Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.006963968276977539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_institutional_encounter_id", "compiled": true, "compiled_code": "\n\n\nwith add_row_num as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_npi,\n row_number() over (partition by patient_id order by end_date, start_date, claim_id) as row_num\nfrom raw.claims_preprocessing._int_emergency_department_institutional_claims\n),\n\ncheck_for_merges_with_larger_row_num as (\nselect\n aa.patient_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_npi should be merged:\n when (aa.end_date = bb.end_date\n and aa.facility_npi = bb.facility_npi) then 1\n -- Claims with different end_date \n -- should be merged if they overlap:\n when ( (aa.end_date <> bb.end_date) and \n (aa.end_date >= bb.start_date) and --overlap requirement\n (aa.facility_npi = bb.facility_npi)\n\t )then 1\n else 0\n end as merge_flag\nfrom add_row_num aa\n inner join add_row_num bb\n on aa.patient_id = bb.patient_id\n and aa.row_num < bb.row_num\n),\n\nmerges_with_larger_row_num as (\nselect\n patient_id,\n claim_id_a,\n claim_id_b,\n row_num_a,\n row_num_b,\n merge_flag\nfrom check_for_merges_with_larger_row_num\nwhere merge_flag = 1\n),\n\n\nclaim_ids_that_merge_with_larger_row_num as (\nselect distinct claim_id_a as claim_id\nfrom merges_with_larger_row_num\n),\n\n\nclaim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\nselect distinct aa.claim_id as claim_id\nfrom add_row_num aa\n inner join\n merges_with_larger_row_num bb\n on aa.patient_id = bb.patient_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n),\n\n\nclose_flags as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.discharge_disposition_code,\n aa.facility_npi,\n aa.row_num,\n case when (bb.claim_id is null and cc.claim_id is null) then 1\n else 0\n end as close_flag\n\nfrom add_row_num aa\n\nleft join claim_ids_that_merge_with_larger_row_num bb\non aa.claim_id = bb.claim_id\n\nleft join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num cc\non aa.claim_id = cc.claim_id\n),\n\n\njoin_every_row_to_later_closes as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.row_num as row_num,\n bb.row_num as row_num_b\nfrom close_flags aa inner join close_flags bb\n on aa.patient_id = bb.patient_id\n and aa.row_num <= bb.row_num\nwhere bb.close_flag = 1\n),\n\n\nfind_min_closing_row_num_for_every_claim as (\nselect\n patient_id,\n claim_id,\n min(row_num_b) as min_closing_row\nfrom join_every_row_to_later_closes\ngroup by patient_id, claim_id\n),\n\n\nadd_min_closing_row_to_every_claim as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n bb.min_closing_row as min_closing_row\nfrom close_flags aa\n left join find_min_closing_row_num_for_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.claim_id = bb.claim_id\n),\n\n\nadd_encounter_id as (\nselect\n aa.patient_id as patient_id,\n aa.claim_id as claim_id,\n aa.start_date as start_date,\n aa.end_date as end_date,\n aa.discharge_disposition_code as discharge_disposition_code,\n aa.facility_npi as facility_npi,\n aa.row_num as row_num,\n aa.close_flag as close_flag,\n aa.min_closing_row as min_closing_row,\n bb.claim_id as encounter_id\nfrom add_min_closing_row_to_every_claim aa\n left join add_min_closing_row_to_every_claim bb\n on aa.patient_id = bb.patient_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_encounter_id", "relation_name": "raw.claims_preprocessing._int_emergency_department_institutional_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.603504Z", "completed_at": "2024-02-20T20:47:51.606317Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.607200Z", "completed_at": "2024-02-20T20:47:51.607202Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.004972934722900391, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model assigns an encounter_start_date and\n-- an encounter_end_date to each acute inpatient\n-- encounter_id.\n-- This returns a table with 4 fields:\n-- patient_id\n-- encounter_id\n-- encounter_start_date\n-- encounter_end_date\n-- The number of rows in the table should be equal\n-- to the number of acute inpatient encounters.\n-- *************************************************\n\n\nwith add_encounter_id_to_acute_inpatient_encounters as (\nselect\n aip.claim_id as claim_id,\n aip.patient_id as patient_id,\n aip.start_date as start_date,\n aip.end_date as end_date,\n eid.encounter_id as encounter_id\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims aip\nleft join raw.claims_preprocessing._int_acute_inpatient_institutional_encounter_id eid\n on aip.patient_id = eid.patient_id\n and aip.claim_id = eid.claim_id\n),\n\nencounter_start_and_end_dates as (\nselect\n patient_id,\n encounter_id,\n min(start_date) as encounter_start_date,\n max(end_date) as encounter_end_date\nfrom add_encounter_id_to_acute_inpatient_encounters\ngroup by patient_id, encounter_id\n)\n\nselect\n patient_id\n , encounter_id\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom encounter_start_and_end_dates", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.607970Z", "completed_at": "2024-02-20T20:47:51.617039Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.623581Z", "completed_at": "2024-02-20T20:47:51.623586Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.018698930740356445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates", "compiled": true, "compiled_code": "\n\n\nwith add_encounter_id_to_emergency_department_encounters as (\nselect\n aip.claim_id as claim_id,\n aip.patient_id as patient_id,\n aip.start_date as start_date,\n aip.end_date as end_date,\n eid.encounter_id as encounter_id\nfrom raw.claims_preprocessing._int_emergency_department_institutional_claims aip\nleft join raw.claims_preprocessing._int_emergency_department_institutional_encounter_id eid\n on aip.patient_id = eid.patient_id\n and aip.claim_id = eid.claim_id\n),\n\nencounter_start_and_end_dates as (\nselect\n patient_id,\n encounter_id,\n min(start_date) as encounter_start_date,\n max(end_date) as encounter_end_date\nfrom add_encounter_id_to_emergency_department_encounters\ngroup by patient_id, encounter_id\n)\n\nselect \n patient_id\n , encounter_id\n , encounter_start_date\n , encounter_end_date\n , coalesce(encounter_start_date, encounter_end_date) as determined_encounter_start_date\n , coalesce(encounter_end_date, encounter_start_date) as determined_encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom encounter_start_and_end_dates", "relation_name": "raw.claims_preprocessing._int_emergency_department_encounter_start_and_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.611240Z", "completed_at": "2024-02-20T20:47:51.626651Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.639386Z", "completed_at": "2024-02-20T20:47:51.639391Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.029119014739990234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__professional_encounter_id", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model assigns professional acute inpatient\n-- claims to acute inpatient encounters.\n-- Some acute inpatient professional claims do not fall\n-- within an acute inpatient encounter. We call these\n-- orphan claims, and they do not have an encounter_id.\n-- Some acute inpatient professional claims fall within\n-- more than one acute inpatient encounter. Since we do not\n-- know what encounter these claims should be mapped to\n-- we do not assign them an encounter_id. These claims\n-- have encounter_count > 1.\n-- This model returns a table with 5 fields:\n-- patient_id\n-- claim_id\n-- encounter_id (is null for orphan claims or claims\n-- that fall within more than one encounter)\n-- orphan_claim_flag (is always 0 or 1)\n-- encounter_count (an integer that represents the number\n-- of acute inpatient encounters this\n-- professional claim could fall into:\n-- could be 0,1,2,3,... but is never null\n-- for acute inpatient professional claims)\n-- *************************************************\n\n\n\n\nwith __dbt__cte__acute_inpatient__stg_service_category as (\n\n\n\nSELECT\n claim_id\n, claim_type\n, claim_line_number\n, service_category_2\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n), __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), acute_inpatient_professional_claim_ids as (\nselect distinct \n claim_id\n , claim_line_number\nfrom __dbt__cte__acute_inpatient__stg_service_category \nwhere claim_type = 'professional'\n and service_category_2 = 'Acute Inpatient'\n),\n\nacute_inpatient_professional_claim_lines as (\nselect\n mc.claim_id,\n mc.claim_line_number,\n mc.patient_id,\n mc.claim_start_date as start_date,\n mc.claim_end_date as end_date\t \nfrom __dbt__cte__acute_inpatient__stg_medical_claim mc\ninner join acute_inpatient_professional_claim_ids prof\n on mc.claim_id = prof.claim_id\n and mc.claim_line_number = prof.claim_line_number\n),\n\n\nacute_inpatient_professional_claim_dates as (\nselect\n claim_id,\n claim_line_number,\n patient_id,\n min(start_date) as start_date,\n max(end_date) as end_date\nfrom acute_inpatient_professional_claim_lines\ngroup by claim_id, claim_line_number, patient_id\n),\n\n\nroll_up_professional_claims_to_institutional_claims as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n bb.encounter_id,\n case\n when bb.encounter_id is null then 1\n else 0\n end as orphan_claim_flag\nfrom acute_inpatient_professional_claim_dates aa\nleft join raw.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates bb\n on aa.patient_id = bb.patient_id\n and (coalesce(aa.start_date, aa.end_date) between bb.encounter_start_date and bb.encounter_end_date)\n and (coalesce(aa.end_date, aa.start_date) between bb.encounter_start_date and bb.encounter_end_date)\n),\n\nprofessional_claims_in_more_than_one_encounter as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n min(start_date) as start_date,\n max(end_date) as end_date,\n count(distinct encounter_id) as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims\ngroup by patient_id, claim_line_number, claim_id\nhaving count(distinct encounter_id) > 1\n),\n\n\nprofessional_claims_not_in_more_than_one_encounter as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.orphan_claim_flag,\n case\n when (aa.orphan_claim_flag = 1) then 0\n else 1\n end as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims aa\nleft join professional_claims_in_more_than_one_encounter bb\non aa.claim_id = bb.claim_id\nand aa.claim_line_number = bb.claim_line_number\nand aa.patient_id = bb.patient_id\nwhere (bb.patient_id is null) and (bb.claim_id is null)\n),\n\n\nall_acute_inpatient_professional_claims as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n encounter_id,\n orphan_claim_flag,\n encounter_count\nfrom professional_claims_not_in_more_than_one_encounter\n\nunion all\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n null as encounter_id,\n 0 as orphan_claim_count,\n encounter_count\nfrom professional_claims_in_more_than_one_encounter\n)\n\n\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom all_acute_inpatient_professional_claims", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_professional_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.727493Z", "completed_at": "2024-02-20T20:47:51.441300Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.461408Z", "completed_at": "2024-02-20T20:47:51.461413Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.9149682521820068, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators", "compiled": true, "compiled_code": "\n/*\n Denominator logic for invalid value tests is dependent on whether that\n specific field is populated or not. We created a macro to automatically\n generate the CTE. All invalid value tests must have a\n test_category = 'invalid_values' in the catalog seed.\n*/\nwith all_denominator as (\n\n select\n cast('all' as TEXT ) as test_denominator_name\n , count(distinct patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility\n\n)\n\n, invalid_value_denominators as (\n\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'dual_status_code'\n where rel.dual_status_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'gender'\n where rel.gender is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'medicare_status_code'\n where rel.medicare_status_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'original_reason_entitlement_code'\n where rel.original_reason_entitlement_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'payer_type'\n where rel.payer_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_eligibility as rel\n left join raw.data_quality._value_set_test_catalog as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = 'race'\n where rel.race is not null\n group by cat.test_name\n \n\n)\n\nselect * from all_denominator\nunion all\nselect * from invalid_value_denominators", "relation_name": "raw.data_quality._int_claims_preprocessing_eligibility_denominators"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:50.950038Z", "completed_at": "2024-02-20T20:47:51.461653Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.463750Z", "completed_at": "2024-02-20T20:47:51.463753Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.6938660144805908, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators", "compiled": true, "compiled_code": "\n/*\n Denominator logic for invalid value tests is dependent on whether that\n specific field is populated or not. We created a macro to automatically\n generate the CTE. All invalid value tests must have a\n test_category = 'invalid_values' in the catalog seed.\n*/\nwith professional_denominator as (\n\n select\n cast('professional' as TEXT ) as test_denominator_name\n , cast(count(distinct claim_id||data_source) as int) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'professional'\n\n)\n\n, institutional_denominator as (\n\n select\n cast('institutional' as TEXT ) as test_denominator_name\n , count(distinct claim_id||data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type = 'institutional'\n\n)\n\n, all_claim_denominator as (\n\n select\n cast('all' as TEXT ) as test_denominator_name\n , count(distinct claim_id||data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim\n where claim_type is not null\n\n)\n\n, invalid_value_denominators as (\n\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'admit_source_code'\n where rel.admit_source_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'admit_type_code'\n where rel.admit_type_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'apr_drg_code'\n where rel.apr_drg_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'bill_type_code'\n where rel.bill_type_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'billing_npi'\n where rel.billing_npi is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'claim_type'\n where rel.claim_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'diagnosis_code_1'\n where rel.diagnosis_code_1 is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'diagnosis_code_type'\n where rel.diagnosis_code_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'diagnosis_poa_1'\n where rel.diagnosis_poa_1 is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'discharge_disposition_code'\n where rel.discharge_disposition_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'facility_npi'\n where rel.facility_npi is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'ms_drg_code'\n where rel.ms_drg_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'place_of_service_code'\n where rel.place_of_service_code is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'procedure_code_type'\n where rel.procedure_code_type is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'rendering_npi'\n where rel.rendering_npi is not null\n group by cat.test_name\n union all\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\n from raw.claims_preprocessing.normalized_input_medical_claim as rel\n left join raw.data_quality._value_set_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 = 'revenue_center_code'\n where rel.revenue_center_code is not null\n group by cat.test_name\n \n\n)\n\nselect * from institutional_denominator\nunion all \nselect * from professional_denominator\nunion all\nselect * from all_claim_denominator\nunion all\nselect * from invalid_value_denominators", "relation_name": "raw.data_quality._int_claims_preprocessing_medical_claim_denominators"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.627224Z", "completed_at": "2024-02-20T20:47:51.640835Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.642790Z", "completed_at": "2024-02-20T20:47:51.642792Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.02194499969482422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_professional_encounter_id", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__emergency_department__stg_service_category as (\n\n\n\nselect\n claim_id\n , claim_type\n , claim_line_number\n , service_category_2\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.service_category_grouper\n), __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), emergency_department_professional_claim_ids as (\nselect \n claim_id\n , claim_line_number\nfrom __dbt__cte__emergency_department__stg_service_category \nwhere claim_type = 'professional'\n and service_category_2 = 'Emergency Department'\n),\n\nemergency_department_professional_claim_lines as (\nselect\n mc.claim_id\n , mc.claim_line_number\n , mc.patient_id\n , mc.claim_start_date as start_date\n , mc.claim_end_date as end_date\t \nfrom __dbt__cte__emergency_department__stg_medical_claim mc\ninner join emergency_department_professional_claim_ids prof\n on mc.claim_id = prof.claim_id\n and mc.claim_line_number = prof.claim_line_number\n),\n\n\nemergency_department_professional_claim_dates as (\nselect\n claim_id\n , claim_line_number\n , patient_id\n , min(start_date) as start_date\n , max(end_date) as end_date\nfrom emergency_department_professional_claim_lines\ngroup by \n claim_id\n , claim_line_number\n , patient_id\n),\n\n\nroll_up_professional_claims_to_institutional_claims as (\n select\n aa.patient_id\n , aa.claim_id\n , aa.claim_line_number\n , aa.start_date\n , aa.end_date\n , bb.encounter_id\n , case\n when bb.encounter_id is null then 1\n else 0\n end as orphan_claim_flag\n from emergency_department_professional_claim_dates aa\n left join raw.claims_preprocessing._int_emergency_department_encounter_start_and_end_dates bb\n on aa.patient_id = bb.patient_id\n and (coalesce(aa.start_date, aa.end_date) between coalesce(bb.encounter_start_date, bb.determined_encounter_start_date) and coalesce(bb.encounter_end_date, bb.determined_encounter_end_date))\n and (coalesce(aa.end_date, aa.start_date) between coalesce(bb.encounter_start_date, bb.determined_encounter_start_date) and coalesce(bb.encounter_end_date, bb.determined_encounter_end_date))\n),\n\nprofessional_claims_in_more_than_one_encounter as (\nselect\n patient_id\n , claim_id\n , claim_line_number\n , min(start_date) as start_date\n , max(end_date) as end_date\n , count(distinct encounter_id) as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims\ngroup by patient_id, claim_id, claim_line_number\nhaving count(distinct encounter_id) > 1\n),\n\n\nprofessional_claims_not_in_more_than_one_encounter as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.claim_line_number,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.orphan_claim_flag,\n case\n when (aa.orphan_claim_flag = 1) then 0\n else 1\n end as encounter_count\nfrom roll_up_professional_claims_to_institutional_claims aa\nleft join professional_claims_in_more_than_one_encounter bb\non aa.claim_id = bb.claim_id\nand aa.claim_line_number = bb.claim_line_number\nand aa.patient_id = bb.patient_id\nwhere (bb.patient_id is null) and (bb.claim_id is null)\n),\n\n\nall_emergency_department_professional_claims as (\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n encounter_id,\n orphan_claim_flag,\n encounter_count\nfrom professional_claims_not_in_more_than_one_encounter\n\nunion all\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n start_date,\n end_date,\n null as encounter_id,\n 0 as orphan_claim_count,\n encounter_count\nfrom professional_claims_in_more_than_one_encounter\n)\n\n\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom all_emergency_department_professional_claims", "relation_name": "raw.claims_preprocessing._int_emergency_department_professional_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.643257Z", "completed_at": "2024-02-20T20:47:51.652056Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.655854Z", "completed_at": "2024-02-20T20:47:51.655857Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.018908977508544922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__encounter_id", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) -- *************************************************\n-- This dbt model assigns an encounter_id to each\n-- institutional or professional acute inpatient claim\n-- that is eligible to be part of an encounter.\n-- Professional acute inpatient claims that are\n-- orphan claims (don't overlap with an institutional\n-- acute inpatient claim) or that have\n-- encounter_count > 1 (overlap with more than one different\n-- acute inpatient encounter) are not included here.\n-- It returns a table with these 3 columns:\n-- patient_id\n-- claim_id\n-- encounter_id\n-- *************************************************\n\n\n\n\nselect\n inst.patient_id,\n inst.claim_id,\n med.claim_line_number,\n inst.encounter_id,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_encounter_id inst\nleft join __dbt__cte__acute_inpatient__stg_medical_claim med\n on inst.claim_id = med.claim_id\n\nunion distinct\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n encounter_id,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_acute_inpatient_professional_encounter_id\nwhere (orphan_claim_flag = 0) and (encounter_count = 1)", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.648448Z", "completed_at": "2024-02-20T20:47:51.652871Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.660800Z", "completed_at": "2024-02-20T20:47:51.660803Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0199739933013916, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility", "compiled": true, "compiled_code": "\n/*\n Tests with the category 'invalid_values' are joined to the denominator model\n on test_name since that denominator logic is dependent on whether that\n specific field is populated or not.\n\n All other tests are joined to the denominator model on claim_type.\n*/\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.data_quality.claims_preprocessing_test_detail det\ninner join raw.data_quality._int_claims_preprocessing_eligibility_denominators denom\n on det.claim_type = denom.test_denominator_name\nwhere source_table = 'normalized_input__eligibility'\nand test_category <> 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator\n\nunion all\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.data_quality.claims_preprocessing_test_detail det\ninner join raw.data_quality._int_claims_preprocessing_eligibility_denominators denom\n on det.test_name = denom.test_denominator_name\nwhere source_table = 'normalized_input__eligibility'\nand test_category = 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator", "relation_name": "raw.data_quality._int_claims_preprocessing_test_result_stage_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.653055Z", "completed_at": "2024-02-20T20:47:51.660573Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.662412Z", "completed_at": "2024-02-20T20:47:51.662414Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.011883735656738281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim", "compiled": true, "compiled_code": "\n/*\n Tests with the category 'invalid_values' are joined to the denominator model\n on test_name since that denominator logic is dependent on whether that\n specific field is populated or not.\n\n All other tests are joined to the denominator model on claim_type.\n*/\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.data_quality.claims_preprocessing_test_detail det\ninner join raw.data_quality._int_claims_preprocessing_medical_claim_denominators denom\n on det.claim_type = denom.test_denominator_name\nwhere source_table = 'normalized_input__medical_claim'\nand test_category <> 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator\n\nunion all\n\nselect\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , count(distinct foreign_key||data_source) as failures\n , denom.denominator\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.data_quality.claims_preprocessing_test_detail det\ninner join raw.data_quality._int_claims_preprocessing_medical_claim_denominators denom\n on det.test_name = denom.test_denominator_name\nwhere source_table = 'normalized_input__medical_claim'\nand test_category = 'invalid_values'\ngroup by\n source_table\n , grain\n , test_category\n , test_name\n , claim_type\n , pipeline_test\n , denom.denominator", "relation_name": "raw.data_quality._int_claims_preprocessing_test_result_stage_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.656279Z", "completed_at": "2024-02-20T20:47:51.661533Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.663581Z", "completed_at": "2024-02-20T20:47:51.663583Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.014298200607299805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_encounter_id", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n) select\n inst.patient_id,\n inst.claim_id,\n med.claim_line_number,\n inst.encounter_id,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_emergency_department_institutional_encounter_id inst\nleft join __dbt__cte__emergency_department__stg_medical_claim med\n on inst.claim_id = med.claim_id\n\nunion distinct\n\nselect\n patient_id,\n claim_id,\n claim_line_number,\n encounter_id,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing._int_emergency_department_professional_encounter_id\nwhere (orphan_claim_flag = 0) and (encounter_count = 1)", "relation_name": "raw.claims_preprocessing._int_emergency_department_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.664204Z", "completed_at": "2024-02-20T20:47:51.667771Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.677466Z", "completed_at": "2024-02-20T20:47:51.677471Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.017804861068725586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__claims_with_encounter_data", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model returns relevant encounter-level\n-- data for every professional or institutional\n-- acute inpatient claim that is part of an encounter\n-- (note that all institutional acute inpatienet claims\n-- are part of an acute inpatient encounter, but only\n-- professional acute inpatient claims that are not\n-- orphan claims and that belong to one and only\n-- one encounter, i.e. have encounter_count = 1,\n-- are part of an acute inpatient encounter).\n-- It returns a table with these columns:\n-- patient_id\n-- claim_id\n-- start_date (date used for merging claims into encounters)\n-- end_date (date used for merging claims into encounters)\n-- encounter_id\n-- encounter_start_date,\n-- encounter_end_date,\n-- encounter_admit_source_code,\n-- encounter_admit_type_code,\n-- encounter_discharge_disposition_code\n-- *************************************************\n\n\n\n\nwith useful_fields_at_claim_id_level as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.admit_type_code,\n aa.admit_source_code,\n aa.discharge_disposition_code,\n aa.start_date,\n aa.end_date,\n\n bb.encounter_id,\n\n cc.encounter_start_date,\n cc.encounter_end_date\n\nfrom raw.claims_preprocessing._int_acute_inpatient_institutional_claims aa\n\nleft join\nraw.claims_preprocessing._int_acute_inpatient_encounter_id bb\non aa.claim_id = bb.claim_id\nand aa.patient_id = bb.patient_id\n\nleft join\nraw.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates cc\non bb.encounter_id = cc.encounter_id\nand bb.patient_id = cc.patient_id\n),\n\n\n\nadmit_codes as (\nselect\n encounter_id,\n max(admit_source_code) as encounter_admit_source_code,\n max(admit_type_code) as encounter_admit_type_code\nfrom useful_fields_at_claim_id_level\nwhere start_date = encounter_start_date\ngroup by encounter_id\n),\n\n\ndischarge_code as (\nselect\n encounter_id,\n max(discharge_disposition_code) as encounter_discharge_disposition_code\nfrom useful_fields_at_claim_id_level\nwhere end_date = encounter_end_date\ngroup by encounter_id\n),\n\n\nall_useful_fields_at_claim_id_level as (\nselect\n aa.patient_id,\n aa.claim_id,\n aa.start_date,\n aa.end_date,\n aa.encounter_id,\n aa.encounter_start_date,\n aa.encounter_end_date,\n\n bb.encounter_admit_source_code,\n bb.encounter_admit_type_code,\n \n cc.encounter_discharge_disposition_code\n\nfrom useful_fields_at_claim_id_level aa \n left join admit_codes bb on aa.encounter_id = bb.encounter_id\n left join discharge_code cc on aa.encounter_id = cc.encounter_id\n)\n\n\n\nselect \n *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom all_useful_fields_at_claim_id_level", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_claims_with_encounter_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.667987Z", "completed_at": "2024-02-20T20:47:51.677677Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.680866Z", "completed_at": "2024-02-20T20:47:51.680868Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.018146038055419922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__first_claim_values", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n from raw.claims_preprocessing._int_acute_inpatient_encounter_id e\n inner join __dbt__cte__acute_inpatient__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , row_number() over (partition by encounter_id order by claim_start) as claim_row\nfrom first_claim_values", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_first_claim_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.673722Z", "completed_at": "2024-02-20T20:47:51.680342Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.682327Z", "completed_at": "2024-02-20T20:47:51.682329Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.016087055206298828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__last_claim_values", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , discharge_disposition_code\n from raw.claims_preprocessing._int_acute_inpatient_encounter_id e\n inner join __dbt__cte__acute_inpatient__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , discharge_disposition_code\n , row_number() over (partition by encounter_id order by claim_start desc) as claim_row\nfrom first_claim_values", "relation_name": "raw.claims_preprocessing._int_acute_inpatient_last_claim_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.677934Z", "completed_at": "2024-02-20T20:47:51.681091Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.682914Z", "completed_at": "2024-02-20T20:47:51.682916Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.01977086067199707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result", "compiled": true, "compiled_code": "\n\nselect * from raw.data_quality._int_claims_preprocessing_test_result_stage_medical_claim\n\nunion all\n\nselect * from raw.data_quality._int_claims_preprocessing_test_result_stage_eligibility\n\nunion all\n\nselect * from raw.data_quality._int_claims_preprocessing_test_result_stage_pharmacy_claim", "relation_name": "raw.data_quality.claims_preprocessing_test_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.683520Z", "completed_at": "2024-02-20T20:47:51.694251Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.712174Z", "completed_at": "2024-02-20T20:47:51.712178Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.03666400909423828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_condition", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\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 , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere diagnosis_code_1 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_2 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_3 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_4 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_5 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_6 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_7 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_8 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_9 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_10 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_11 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_12 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_13 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_14 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_15 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_16 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_17 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_18 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_19 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_20 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_21 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_22 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_23 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_24 is not null\n\nunion all \n\nselect\n claim_id\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as condition_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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_25 is not null\n\n)\n\nselect distinct\n cast(unpivot_cte.data_source||'_'||unpivot_cte.claim_id||'_'||unpivot_cte.diagnosis_rank||'_'||unpivot_cte.source_code as TEXT ) as condition_id\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(coalesce(ap.encounter_id, ed.encounter_id) as TEXT ) as encounter_id\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.condition_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.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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\nleft join raw.claims_preprocessing._int_acute_inpatient_encounter_id as ap\n on unpivot_cte.claim_id = ap.claim_id\nleft join raw.claims_preprocessing._int_emergency_department_encounter_id as ed\n on unpivot_cte.claim_id = ed.claim_id\nleft join raw.terminology.icd_10_cm icd\n on unpivot_cte.source_code = icd.icd_10_cm\nleft join raw.terminology.present_on_admission as poa\n on unpivot_cte.present_on_admit_code = poa.present_on_admit_code", "relation_name": "raw.core._stg_claims_condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.694439Z", "completed_at": "2024-02-20T20:47:51.712371Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.720553Z", "completed_at": "2024-02-20T20:47:51.720564Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.029783010482788086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_medical_claim", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\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\n\nselect\n cast(med.claim_id as TEXT ) as claim_id\n , cast(med.claim_line_number as integer ) as claim_line_number\n , cast(coalesce(ap.encounter_id,ed.encounter_id) as TEXT ) as encounter_id \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 , cast(med.plan as TEXT ) as 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(med.admit_source_code as TEXT ) as admit_source_code\n , cast(med.admit_type_code as TEXT ) as admit_type_code\n , cast(med.discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(med.place_of_service_code as TEXT ) as place_of_service_code\n , cast(med.bill_type_code as TEXT ) as bill_type_code\n , cast(med.ms_drg_code as TEXT ) as ms_drg_code\n , cast(med.apr_drg_code as TEXT ) as apr_drg_code\n , cast(med.revenue_center_code as TEXT ) as revenue_center_code\n , cast(med.service_unit_quantity as integer ) 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_npi as TEXT ) as rendering_npi\n , cast(med.billing_npi as TEXT ) as billing_npi\n , cast(med.facility_npi as TEXT ) as facility_npi\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.data_source as TEXT ) as data_source\n , cast('2024-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim med\nleft join raw.claims_preprocessing.service_category_grouper srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\nleft join raw.claims_preprocessing._int_acute_inpatient_encounter_id ap\n on med.claim_id = ap.claim_id\n and med.claim_line_number = ap.claim_line_number\nleft join raw.claims_preprocessing._int_emergency_department_encounter_id ed\n on med.claim_id = ed.claim_id\n and med.claim_line_number = ed.claim_line_number", "relation_name": "raw.core._stg_claims_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.704392Z", "completed_at": "2024-02-20T20:47:51.719498Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.722953Z", "completed_at": "2024-02-20T20:47:51.722956Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.033538818359375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_procedure", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\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 , 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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim\nwhere hcpcs_code is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_1 is not null\n \nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_2 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_3 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_4 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_5 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_6 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_7 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_8 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_9 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_10 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_11 is not null\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_12 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_13 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_14 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_15 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_16 is not null\n \nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_17 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_18 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_19 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_20 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_21 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_22 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_23 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_24 is not null\n\nunion distinct\n\nselect\n claim_id as claim_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_npi 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 raw.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_25 is not null\n\n)\n\nselect distinct\n cast(\n unpivot_cte.data_source\n ||'_'\n ||unpivot_cte.claim_id\n ||'_'\n ||unpivot_cte.source_code\n ||case when unpivot_cte.modifier_1 is not null then '_'||unpivot_cte.modifier_1 else '' end\n ||case when unpivot_cte.modifier_2 is not null then '_'||unpivot_cte.modifier_2 else '' end\n ||case when unpivot_cte.modifier_3 is not null then '_'||unpivot_cte.modifier_3 else '' end\n ||case when unpivot_cte.modifier_4 is not null then '_'||unpivot_cte.modifier_4 else '' end\n ||case when unpivot_cte.modifier_5 is not null then '_'||unpivot_cte.modifier_5 else '' end\n ||case when unpivot_cte.practitioner_npi is not null then '_'||unpivot_cte.practitioner_npi else '' end\n as TEXT ) as procedure_id\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(coalesce(ap.encounter_id, ed.encounter_id) as TEXT ) as encounter_id\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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\nleft join raw.terminology.icd_10_pcs as icd\n on unpivot_cte.source_code = icd.icd_10_pcs\nleft join raw.terminology.hcpcs_level_2 as hcpcs\n on unpivot_cte.source_code = hcpcs.hcpcs\nleft join raw.claims_preprocessing._int_acute_inpatient_encounter_id as ap\n on unpivot_cte.claim_id = ap.claim_id\nleft join raw.claims_preprocessing._int_emergency_department_encounter_id as ed\n on unpivot_cte.claim_id = ed.claim_id", "relation_name": "raw.core._stg_claims_procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.712552Z", "completed_at": "2024-02-20T20:47:51.721162Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.723484Z", "completed_at": "2024-02-20T20:47:51.723485Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.024722814559936523, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_first_claim_values", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n from raw.claims_preprocessing._int_emergency_department_encounter_id e\n inner join __dbt__cte__emergency_department__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , diagnosis_code_1\n , diagnosis_code_type\n , admit_source_code\n , admit_type_code\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , row_number() over (partition by encounter_id order by claim_start) as claim_row\nfrom first_claim_values", "relation_name": "raw.claims_preprocessing._int_emergency_department_first_claim_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.723696Z", "completed_at": "2024-02-20T20:47:51.729147Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.733909Z", "completed_at": "2024-02-20T20:47:51.733912Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.03527665138244629, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_last_claim_values", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__emergency_department__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), first_claim_values as(\n select distinct\n e.encounter_id\n , coalesce(claim_start_date, admission_date) as claim_start\n , discharge_disposition_code\n from raw.claims_preprocessing._int_emergency_department_encounter_id e\n inner join __dbt__cte__emergency_department__stg_medical_claim m\n on e.claim_id = m.claim_id\n where claim_type = 'institutional'\n)\n\nselect\n encounter_id\n , claim_start\n , discharge_disposition_code\n , row_number() over (partition by encounter_id order by claim_start desc) as claim_row\nfrom first_claim_values", "relation_name": "raw.claims_preprocessing._int_emergency_department_last_claim_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.729642Z", "completed_at": "2024-02-20T20:47:51.739297Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.757775Z", "completed_at": "2024-02-20T20:47:51.757779Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0311431884765625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model returns all the columns with relevant\n-- encounter fields that we will append to the medical_claim\n-- table.\n\n-- It returns a table with these columns:\n-- patient_id\n-- claim_id\n-- encounter_type\n-- encounter_id\n-- start_date (date used for merging claims into encounters)\n-- end_date (date used for merging claims into encounters)\n-- encounter_start_date,\n-- encounter_end_date,\n-- encounter_admit_source_code,\n-- encounter_admit_type_code,\n-- encounter_discharge_disposition_code\n-- orphan_claim_flag (always 0 or 1) (never null)\n-- encounter_count (could be 0,1,2,3,...) (never null)\n-- *************************************************\n\n\n\n\nwith acute_inpatient_claims_with_encounter_id as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date, \n-- Relevant encounter-level fields for\n-- professional and institutional acute inpatient\n-- claims that are assigned to an encounter:\n 'acute inpatient' as encounter_type,\n encounter_id,\n encounter_start_date,\n encounter_end_date,\n encounter_admit_source_code,\n encounter_admit_type_code,\n encounter_discharge_disposition_code,\n-- Fields that are only relevant for professional\n-- acute inpatient claims that are not assigned to\n-- an encounter because they are orphan claims or because\n-- they overlap with more than one encounter:\n 0 as orphan_claim_flag,\n 1 as encounter_count\nfrom raw.claims_preprocessing._int_acute_inpatient_claims_with_encounter_data\n),\n\n\nacute_inpatient_claims_without_encounter_id as (\nselect\n patient_id,\n claim_id,\n start_date,\n end_date, \n-- Relevant encounter-level fields for\n-- professional and institutional acute inpatient\n-- claims that are assigned to an encounter:\n 'acute inpatient' encounter_type,\n cast(null as TEXT) as encounter_id,\n cast(null as date) as encounter_start_date,\n cast(null as date) as encounter_end_date,\n cast(null as TEXT) as encounter_admit_source_code,\n cast(null as TEXT) as encounter_admit_type_code,\n cast(null as TEXT) as encounter_discharge_disposition_code,\n-- Fields that are only relevant for professional\n-- acute inpatient claims that are not assigned to\n-- an encounter because they are orphan claims or because\n-- they overlap with more than one encounter:\n orphan_claim_flag,\n encounter_count\n \nfrom raw.claims_preprocessing._int_acute_inpatient_professional_encounter_id\nwhere (orphan_claim_flag = 1) or (encounter_count > 1)\n)\n\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom acute_inpatient_claims_with_encounter_id\n\nunion all\n\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom acute_inpatient_claims_without_encounter_id", "relation_name": "raw.claims_preprocessing._int_encounter_data_for_medical_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.734119Z", "completed_at": "2024-02-20T20:47:51.758371Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.762095Z", "completed_at": "2024-02-20T20:47:51.762098Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.03368496894836426, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__summary", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__acute_inpatient__stg_medical_claim as (\n\n\nselect \n claim_id\n , claim_line_number\n , patient_id\n , claim_type\n , claim_start_date\n , claim_end_date\n , admission_date\n , discharge_date\n , facility_npi\n , ms_drg_code\n , apr_drg_code\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , paid_amount\n , allowed_amount\n , charge_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_medical_claim\n), __dbt__cte__acute_inpatient__stg_eligibility as (\n\n\nselect\n patient_id\n , birth_date\n , gender\n , race\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.claims_preprocessing.normalized_input_eligibility\n), distinct_encounters as (\n select distinct\n a.encounter_id\n , a.patient_id\n , b.encounter_start_date\n , b.encounter_end_date\nfrom raw.claims_preprocessing._int_acute_inpatient_encounter_id a\ninner join raw.claims_preprocessing._int_acute_inpatient_encounter_start_and_end_dates b\n on a.encounter_id = b.encounter_id\n)\n\n, institutional_claim_details as (\n select\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi as facility_npi\n , first.ms_drg_code as ms_drg_code\n , first.apr_drg_code as apr_drg_code\n , first.admit_source_code as admit_source_code\n , first.admit_type_code as admit_type_code\n , last.discharge_disposition_code as discharge_disposition_code\n , sum(paid_amount) as inst_paid_amount\n , sum(allowed_amount) as inst_allowed_amount\n , sum(charge_amount) as inst_charge_amount\n , max(data_source) as data_source\n from tuva.input_layer.medical_claim a\n inner join raw.claims_preprocessing._int_acute_inpatient_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'institutional'\n inner join raw.claims_preprocessing._int_acute_inpatient_first_claim_values first\n on b.encounter_id = first.encounter_id\n and first.claim_row = 1\n inner join raw.claims_preprocessing._int_acute_inpatient_last_claim_values last\n on b.encounter_id = last.encounter_id\n and last.claim_row = 1\n group by\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi\n , first.ms_drg_code\n , first.apr_drg_code\n , first.admit_source_code\n , first.admit_type_code\n , last.discharge_disposition_code\n)\n\n, professional_claim_details as (\n select\n b.encounter_id\n , sum(paid_amount) as prof_paid_amount\n , sum(allowed_amount) as prof_allowed_amount\n , sum(charge_amount) as prof_charge_amount\n from __dbt__cte__acute_inpatient__stg_medical_claim a\n inner join raw.claims_preprocessing._int_acute_inpatient_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'professional'\ngroup by 1\n)\n\n, patient as (\n select distinct\n patient_id\n , birth_date\n , gender\n , race\n from __dbt__cte__acute_inpatient__stg_eligibility\n )\n\n, provider as (\n select\n a.encounter_id\n , max(a.facility_npi) as facility_npi\n , b.provider_first_name\n , b.provider_last_name\n , count(distinct facility_npi) as npi_count\n from raw.claims_preprocessing._int_acute_inpatient_institutional_encounter_id a\n left join raw.terminology.provider b\n on a.facility_npi = b.npi\n group by 1,3,4\n)\n\nselect\n a.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, a.patient_id\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.description, icd9cm.long_description) as primary_diagnosis_description\n, f.facility_npi\n, f.provider_first_name\n, f.provider_last_name\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, c.inst_paid_amount + coalesce(d.prof_paid_amount,0) as total_paid_amount\n, c.inst_allowed_amount + coalesce(d.prof_allowed_amount,0) as total_allowed_amount\n, c.inst_charge_amount + coalesce(d.prof_charge_amount,0) as total_charge_amount\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, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom distinct_encounters a\nleft join institutional_claim_details c\n on a.encounter_id = c.encounter_id\nleft join professional_claim_details d\n on a.encounter_id = d.encounter_id\nleft join patient e\n on a.patient_id = e.patient_id\nleft join provider f\n on a.encounter_id = f.encounter_id\nleft join raw.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join raw.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join raw.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join raw.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join raw.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join raw.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 raw.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": "raw.claims_preprocessing.acute_inpatient_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.753723Z", "completed_at": "2024-02-20T20:47:51.758579Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.762311Z", "completed_at": "2024-02-20T20:47:51.762313Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.030428171157836914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect source_table\nfrom raw.data_quality.claims_preprocessing_test_result\nwhere source_table is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.759838Z", "completed_at": "2024-02-20T20:47:51.763700Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.768358Z", "completed_at": "2024-02-20T20:47:51.768361Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01107478141784668, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_category\nfrom raw.data_quality.claims_preprocessing_test_result\nwhere test_category is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.764666Z", "completed_at": "2024-02-20T20:47:51.769328Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.774387Z", "completed_at": "2024-02-20T20:47:51.774389Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.012740135192871094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect test_name\nfrom raw.data_quality.claims_preprocessing_test_result\nwhere test_name is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.769546Z", "completed_at": "2024-02-20T20:47:51.774588Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.780022Z", "completed_at": "2024-02-20T20:47:51.780024Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.013179779052734375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__condition", "compiled": true, "compiled_code": "\n\n\nselect * from raw.core._stg_claims_condition\nunion all\nselect * from raw.core._stg_clinical_condition\n\n", "relation_name": "raw.core.condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.772221Z", "completed_at": "2024-02-20T20:47:51.774761Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.780232Z", "completed_at": "2024-02-20T20:47:51.780234Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.01326608657836914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__medical_claim", "compiled": true, "compiled_code": "\n\n\nselect * from raw.core._stg_claims_medical_claim", "relation_name": "raw.core.medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.775859Z", "completed_at": "2024-02-20T20:47:51.781517Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.787400Z", "completed_at": "2024-02-20T20:47:51.787403Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.014150857925415039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_location", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\n\n\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct rendering_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct billing_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom raw.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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom provider", "relation_name": "raw.core._stg_claims_location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.782663Z", "completed_at": "2024-02-20T20:47:51.788441Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.798622Z", "completed_at": "2024-02-20T20:47:51.798625Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.019064903259277344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_practitioner", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\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_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct rendering_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n\nunion all\n\nselect distinct billing_npi as npi, data_source\nfrom raw.core._stg_claims_medical_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom raw.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-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom provider", "relation_name": "raw.core._stg_claims_practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.788653Z", "completed_at": "2024-02-20T20:47:51.798995Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.802441Z", "completed_at": "2024-02-20T20:47:51.802443Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.016726016998291016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__procedure", "compiled": true, "compiled_code": "\n\nselect * from raw.core._stg_claims_procedure\nunion all\nselect * from raw.core._stg_clinical_procedure\n\n", "relation_name": "raw.core.procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.793659Z", "completed_at": "2024-02-20T20:47:51.799190Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.802654Z", "completed_at": "2024-02-20T20:47:51.802656Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.016763925552368164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__summary", "compiled": true, "compiled_code": "\n\nwith distinct_encounters as (\nselect distinct\n a.encounter_id\n, a.patient_id\n, b.encounter_start_date\n, b.encounter_end_date\nfrom raw.claims_preprocessing._int_emergency_department_encounter_id a\ninner join raw.claims_preprocessing._int_emergency_department_encounter_start_and_end_dates b\n on a.encounter_id = b.encounter_id\n)\n\n, institutional_claim_details as (\n select\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi as facility_npi\n , first.ms_drg_code as ms_drg_code\n , first.apr_drg_code as apr_drg_code\n , first.admit_source_code as admit_source_code\n , first.admit_type_code as admit_type_code\n , last.discharge_disposition_code as discharge_disposition_code\n , sum(paid_amount) as inst_paid_amount\n , sum(allowed_amount) as inst_allowed_amount\n , sum(charge_amount) as inst_charge_amount\n , max(data_source) as data_source\n from tuva.input_layer.medical_claim a\n inner join raw.claims_preprocessing._int_emergency_department_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'institutional'\n inner join raw.claims_preprocessing._int_emergency_department_first_claim_values first\n on b.encounter_id = first.encounter_id\n and first.claim_row = 1\n inner join raw.claims_preprocessing._int_emergency_department_last_claim_values last\n on b.encounter_id = last.encounter_id\n and last.claim_row = 1\n group by\n b.encounter_id\n , first.diagnosis_code_1\n , first.diagnosis_code_type\n , first.facility_npi\n , first.ms_drg_code\n , first.apr_drg_code\n , first.admit_source_code\n , first.admit_type_code\n , last.discharge_disposition_code\n)\n\n, professional_claim_details as (\nselect\n b.encounter_id\n, sum(paid_amount) as prof_paid_amount\n, sum(allowed_amount) as prof_allowed_amount\n, sum(charge_amount) as prof_charge_amount\nfrom tuva.input_layer.medical_claim a\ninner join raw.claims_preprocessing._int_emergency_department_encounter_id b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n and a.claim_type = 'professional'\ngroup by 1\n)\n\n, patient as (\nselect distinct\n patient_id\n, birth_date\n, gender\n, race\nfrom tuva.input_layer.eligibility\n)\n\n, provider as (\nselect\n a.encounter_id\n, max(a.facility_npi) as facility_npi\n, b.provider_first_name\n, b.provider_last_name\n, count(distinct facility_npi) as npi_count\nfrom raw.claims_preprocessing._int_emergency_department_institutional_encounter_id a\nleft join raw.terminology.provider b\n on a.facility_npi = b.npi\ngroup by 1,3,4\n)\n\nselect\n a.encounter_id\n , a.encounter_start_date\n , a.encounter_end_date\n , a.patient_id\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.description, icd9cm.long_description) as primary_diagnosis_description\n , f.facility_npi\n , f.provider_first_name\n , f.provider_last_name\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 , c.inst_paid_amount + coalesce(d.prof_paid_amount,0) as total_paid_amount\n , c.inst_allowed_amount + coalesce(d.prof_allowed_amount,0) as total_allowed_amount\n , c.inst_charge_amount + coalesce(d.prof_charge_amount,0) as total_charge_amount\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 , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom distinct_encounters a\nleft join institutional_claim_details c\n on a.encounter_id = c.encounter_id\nleft join professional_claim_details d\n on a.encounter_id = d.encounter_id\nleft join patient e\n on a.patient_id = e.patient_id\nleft join provider f\n on a.encounter_id = f.encounter_id\nleft join raw.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join raw.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join raw.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join raw.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join raw.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join raw.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 raw.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": "raw.claims_preprocessing.emergency_department_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.829382Z", "completed_at": "2024-02-20T20:47:51.834460Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.838036Z", "completed_at": "2024-02-20T20:47:51.838039Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.016023874282836914, "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 raw.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-02-20T20:47:51.839548Z", "completed_at": "2024-02-20T20:47:51.842352Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.852439Z", "completed_at": "2024-02-20T20:47:51.852442Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.018099069595336914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__count_claim_by_claim_type", "compiled": true, "compiled_code": "\n\n\nselect \n claim_type\n , count(distinct claim_id) as distinct_claim_count\nfrom raw.core.medical_claim\ngroup by claim_type\nunion all\nselect \n 'pharmacy'\n , count(distinct claim_id) as distinct_claim_count\nfrom raw.core.pharmacy_claim", "relation_name": "raw.insights.count_claim_by_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.842552Z", "completed_at": "2024-02-20T20:47:51.852626Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.856755Z", "completed_at": "2024-02-20T20:47:51.856757Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01848888397216797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__count_claim_by_date_column", "compiled": true, "compiled_code": "\n\nwith date_stage as(\n\n select\n 'claim_start_date' as date_field\n , cast(date_part('year', claim_start_date) as TEXT) || right('0'||cast(date_part('month', claim_start_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'claim_end_date' as date_field\n , cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.medical_claim\n group by \n year_month\n union all\n\n select\n 'admission_date' as date_field\n , cast(date_part('year', admission_date) as TEXT) || right('0'||cast(date_part('month', admission_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'discharge_date' as date_field\n , cast(date_part('year', discharge_date) as TEXT) || right('0'||cast(date_part('month', discharge_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'medical paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) || right('0'||cast(date_part('month', paid_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.medical_claim\n group by \n year_month\n\n union all\n\n select\n 'dispensing_date' as date_field\n , cast(date_part('year', dispensing_date) as TEXT) || right('0'||cast(date_part('month', dispensing_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.pharmacy_claim\n group by \n year_month\n\n union all\n\n select\n 'pharmacy paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) || right('0'||cast(date_part('month', paid_date) as TEXT),2) as year_month\n , count(distinct claim_id) as distinct_count\n from raw.core.pharmacy_claim\n group by \n year_month\n\n union all \n\n select\n 'member_months' as date_field\n , year_month\n , count(*) as distinct_count\n from raw.financial_pmpm.member_months\n group by\n year_month\n)\n\n\n, all_date_range as (\n select distinct \n replace(cal.year_month,'-','') as year_month\n from raw.terminology.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 , member_months.distinct_count as member_months\n , claim_start.distinct_count as claim_start_date\n , claim_end.distinct_count as claim_end_date\n , admission_date.distinct_count as admission_date\n , discharge_date.distinct_count as discharge_date\n , med_paid_date.distinct_count as medical_paid_date\n , dispensing_date.distinct_count as dispensing_date\n , pharm_paid_date.distinct_count as pharmacy_paid_date\nfrom all_date_range all_date\nleft join date_stage member_months\n on all_date.year_month = member_months.year_month\n and member_months.date_field = 'member_months'\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": "raw.insights.count_claim_by_date_column"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.850862Z", "completed_at": "2024-02-20T20:47:51.856268Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.858171Z", "completed_at": "2024-02-20T20:47:51.858173Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.017701148986816406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__count_claim_by_service_category", "compiled": true, "compiled_code": "\n\nselect \n 'service_category_1' as service_category_type\n , service_category_1 as service_category\n , count(distinct claim_id) as distinct_claim_count\nfrom raw.core.medical_claim\ngroup by service_category_1\n\nunion all\n\nselect \n 'service_category_2' as service_category_type\n , service_category_2 as service_category\n , count(distinct claim_id) as distinct_claim_count\nfrom raw.core.medical_claim\ngroup by service_category_2", "relation_name": "raw.insights.count_claim_by_service_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.852834Z", "completed_at": "2024-02-20T20:47:51.856940Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.859403Z", "completed_at": "2024-02-20T20:47:51.859405Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.012446880340576172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__orphan_claim_by_claim_type", "compiled": true, "compiled_code": "\n\nwith medical_claim_orphan as(\nselect\n 'medical_claim' as claim_category\n , claim_id\n , patient_id\n , cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\nfrom raw.core.medical_claim\n)\n\n, pharmacy_claim_orphan as(\nselect\n 'pharmacy_claim' as claim_category\n , claim_id\n , patient_id\n , cast(date_part('year', dispensing_date) as TEXT) || right('0'||cast(date_part('month', dispensing_date) as TEXT),2) as year_month\nfrom raw.core.pharmacy_claim\n)\n, union_orphans as(\n select \n med.* \n from medical_claim_orphan med\n left join raw.financial_pmpm.member_months months\n on med.patient_id = months.patient_id\n and med.year_month = months.year_month\n where months.patient_id is null\n\n union all\n\n select \n med.* \n from pharmacy_claim_orphan med\n left join raw.financial_pmpm.member_months months\n on med.patient_id = months.patient_id\n and med.year_month = months.year_month\n where months.patient_id is null\n)\n\nselect\n claim_category\n , count(distinct claim_id) as distinct_claim_count\nfrom union_orphans\ngroup by claim_category", "relation_name": "raw.insights.orphan_claim_by_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.860052Z", "completed_at": "2024-02-20T20:47:51.863675Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.868490Z", "completed_at": "2024-02-20T20:47:51.868493Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.014614105224609375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__sum_amount_by_claim_type", "compiled": true, "compiled_code": "\n\nselect \n claim_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\nfrom raw.core.medical_claim\ngroup by claim_type\n\nunion all\n\nselect \n 'pharmacy'\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , null as total_charge_amount\nfrom raw.core.pharmacy_claim", "relation_name": "raw.insights.sum_amount_by_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.863877Z", "completed_at": "2024-02-20T20:47:51.868308Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.872422Z", "completed_at": "2024-02-20T20:47:51.872424Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01148676872253418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__sum_amount_by_service_category", "compiled": true, "compiled_code": "\n\nselect\n 'service_category_1' as service_category_type\n , service_category_1\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\nfrom raw.core.medical_claim\ngroup by service_category_1\n\nunion all\n\nselect\n 'service_category_2' as service_category_type\n , service_category_2\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\nfrom raw.core.medical_claim\ngroup by service_category_2", "relation_name": "raw.insights.sum_amount_by_service_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.866239Z", "completed_at": "2024-02-20T20:47:51.872175Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.874070Z", "completed_at": "2024-02-20T20:47:51.874071Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.011606931686401367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_claim_type", "compiled": true, "compiled_code": "\n\nwith trend_by_claim_type as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , claim_type\n , count(distinct claim_id) as distinct_claim_count\n from raw.core.medical_claim\n group by \n year_month\n , claim_type\n)\n, trend_with_previous_count as(\n select \n year_month\n , claim_type\n , distinct_claim_count\n , lag(distinct_claim_count) over (partition by claim_type order by year_month) as previous_distinct_claim_count\n from trend_by_claim_type\n)\n\nselect\n year_month\n , claim_type\n , distinct_claim_count\n , distinct_claim_count - previous_distinct_claim_count as distinct_claim_count_change\n , case\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \n else distinct_claim_count\n end as distinct_claim_percentage_change\nfrom trend_with_previous_count", "relation_name": "raw.insights.trend_count_claim_by_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.868703Z", "completed_at": "2024-02-20T20:47:51.873115Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.875246Z", "completed_at": "2024-02-20T20:47:51.875247Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.014161825180053711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_service_category", "compiled": true, "compiled_code": "\n\nwith trend_by_service_category_1 as (\n select \n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , service_category_1\n , count(distinct claim_id) as distinct_claim_count\n from raw.core.medical_claim\n group by \n year_month\n , service_category_1\n)\n, trend_by_service_category_2 as (\n select \n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , service_category_2\n , count(distinct claim_id) as distinct_claim_count\n from raw.core.medical_claim\n group by \n year_month\n , service_category_2\n)\n, previous_service_category_1_claim_count as(\n select\n year_month\n , service_category_1\n , distinct_claim_count\n , lag(distinct_claim_count) over (partition by service_category_1 order by year_month) as previous_distinct_claim_count\n from trend_by_service_category_1\n)\n, previous_service_category_2_claim_count as(\n select\n year_month\n , service_category_2\n , distinct_claim_count\n , lag(distinct_claim_count) over (partition by service_category_2 order by year_month) as previous_distinct_claim_count\n from trend_by_service_category_2\n)\nselect \n year_month\n , service_category_1 as service_category\n , distinct_claim_count\n , distinct_claim_count-previous_distinct_claim_count as distinct_claim_count_change\n , case\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \n else distinct_claim_count\n end as distinct_claim_percentage_change\nfrom previous_service_category_1_claim_count\n\n union all\n\n select \n year_month\n , service_category_2 as service_category\n , distinct_claim_count\n , distinct_claim_count-previous_distinct_claim_count as distinct_claim_count_change\n , case\n when distinct_claim_count <> 0 then ((distinct_claim_count-previous_distinct_claim_count) / distinct_claim_count) * 100 \n else distinct_claim_count\n end as distinct_claim_percentage_change\nfrom previous_service_category_2_claim_count", "relation_name": "raw.insights.trend_count_claim_by_service_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.875728Z", "completed_at": "2024-02-20T20:47:51.883615Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.889535Z", "completed_at": "2024-02-20T20:47:51.889538Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.0182342529296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_claim_type", "compiled": true, "compiled_code": "\n\nwith trend_by_medical_claim_type as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , claim_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 from raw.core.medical_claim\n group by \n year_month\n , claim_type\n)\n, trend_by_pharmacy_claim_type as(\n select\n cast(date_part('year', dispensing_date) as TEXT) || right('0'||cast(date_part('month', dispensing_date) as TEXT),2) as year_month\n , cast('pharmacy' as TEXT) as claim_type\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , 0 as total_charge_amount\n from raw.core.pharmacy_claim\n group by \n year_month\n)\n, trend_with_previous_medical_sum as(\n select \n year_month\n , claim_type\n , total_paid_amount\n , lag(total_paid_amount) over (partition by claim_type order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by claim_type order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by claim_type order by year_month) as previous_total_charge_amount\n from trend_by_medical_claim_type\n)\n, trend_with_previous_pharmacy_sum as(\n select \n year_month\n , claim_type\n , total_paid_amount\n , lag(total_paid_amount) over (partition by claim_type order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by claim_type order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by claim_type order by year_month) as previous_total_charge_amount\n from trend_by_pharmacy_claim_type\n)\nselect\n year_month\n , claim_type\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_medical_sum\n\nunion all \n\nselect\n year_month\n , claim_type\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_pharmacy_sum", "relation_name": "raw.insights.trend_sum_amount_by_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.880575Z", "completed_at": "2024-02-20T20:47:51.889139Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.892221Z", "completed_at": "2024-02-20T20:47:51.892223Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.017901182174682617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_service_category", "compiled": true, "compiled_code": "\n\n\nwith trend_by_service_category_1 as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , 'service_category_1' as service_category_type\n , service_category_1 as service_category\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 from raw.core.medical_claim\n group by \n year_month\n , service_category_1\n)\n, trend_by_service_category_2 as(\n select\n cast(date_part('year', claim_end_date) as TEXT) || right('0'||cast(date_part('month', claim_end_date) as TEXT),2) as year_month\n , 'service_category_2' as service_category_type\n , service_category_2 as service_category\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 from raw.core.medical_claim\n group by \n year_month\n , service_category_2\n)\n, trend_with_previous_service_category_1_sum as(\n select \n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , lag(total_paid_amount) over (partition by service_category order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by service_category order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by service_category order by year_month) as previous_total_charge_amount\n from trend_by_service_category_1\n)\n, trend_with_previous_service_category_2_sum as(\n select \n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , lag(total_paid_amount) over (partition by service_category order by year_month) as previous_total_paid_amount\n , total_allowed_amount\n , lag(total_allowed_amount) over (partition by service_category order by year_month) as previous_total_allowed_amount\n , total_charge_amount\n , lag(total_charge_amount) over (partition by service_category order by year_month) as previous_total_charge_amount\n from trend_by_service_category_2\n)\nselect\n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_service_category_1_sum\n\nunion all \n\nselect\n year_month\n , service_category_type\n , service_category\n , total_paid_amount\n , total_paid_amount - previous_total_paid_amount as total_paid_amount_change\n , case \n when total_paid_amount <> 0 then ((total_paid_amount - previous_total_paid_amount)/total_paid_amount)*100\n else total_paid_amount\n end as total_paid_amount_percent_change\n , total_allowed_amount\n , total_allowed_amount - previous_total_allowed_amount as total_allowed_amount_change\n , case \n when total_allowed_amount <> 0 then ((total_allowed_amount - previous_total_allowed_amount)/total_allowed_amount)*100\n else total_allowed_amount\n end as total_allowed_amount_percent_change\n , total_charge_amount\n , total_charge_amount - previous_total_charge_amount as total_charge_amount_change\n , case \n when total_charge_amount <> 0 then ((total_charge_amount - previous_total_charge_amount)/total_charge_amount)*100\n else total_charge_amount\n end as total_charge_amount_percent_change\nfrom trend_with_previous_service_category_2_sum", "relation_name": "raw.insights.trend_sum_amount_by_service_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.889965Z", "completed_at": "2024-02-20T20:47:51.893015Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.896510Z", "completed_at": "2024-02-20T20:47:51.896514Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.016862869262695312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0", "compiled": true, "compiled_code": "\n \n \n\nselect\n (claim_id||'-'||claim_line_number) as unique_field,\n count(*) as n_records\n\nfrom raw.core.medical_claim\nwhere (claim_id||'-'||claim_line_number) is not null\ngroup by (claim_id||'-'||claim_line_number)\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.897788Z", "completed_at": "2024-02-20T20:47:51.906430Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.910085Z", "completed_at": "2024-02-20T20:47:51.910089Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.017283916473388672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__location", "compiled": true, "compiled_code": "\n\nselect * from raw.core._stg_claims_location\nunion all\nselect * from raw.core._stg_clinical_location\n\n", "relation_name": "raw.core.location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.901349Z", "completed_at": "2024-02-20T20:47:51.906698Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.910708Z", "completed_at": "2024-02-20T20:47:51.910710Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.017482995986938477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__practitioner", "compiled": true, "compiled_code": "\n\nselect * from raw.core._stg_claims_practitioner\nunion all\nselect * from raw.core._stg_clinical_practitioner\n\n", "relation_name": "raw.core.practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.919642Z", "completed_at": "2024-02-20T20:47:51.933685Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.935675Z", "completed_at": "2024-02-20T20:47:51.935677Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.022488117218017578, "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 raw.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-02-20T20:47:51.921629Z", "completed_at": "2024-02-20T20:47:51.934220Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.936040Z", "completed_at": "2024-02-20T20:47:51.936042Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.025159358978271484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_encounter", "compiled": true, "compiled_code": "-- depends_on: raw.data_quality.claims_preprocessing_summary\n\n\n\n-- *************************************************\n-- This dbt model creates the encounter table in core.\n-- *************************************************\n\nselect\n cast(encounter_id as TEXT ) as encounter_id\n , cast(patient_id as TEXT ) as patient_id\n , cast('acute inpatient' as TEXT ) as encounter_type\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(facility_npi as TEXT ) as facility_npi\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(data_source as TEXT ) as data_source\n , cast('2024-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom raw.claims_preprocessing.acute_inpatient_summary \n\nunion all \n\nselect\n cast(encounter_id as TEXT ) as encounter_id\n , cast(patient_id as TEXT ) as patient_id\n , cast('emergency department' as TEXT ) as encounter_type\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(facility_npi as TEXT ) as facility_npi\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(data_source as TEXT ) as data_source\n , cast('2024-02-20 20:47:44.615990+00:00' as timestamp ) as tuva_last_run\nfrom raw.claims_preprocessing.emergency_department_summary", "relation_name": "raw.core._stg_claims_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.936869Z", "completed_at": "2024-02-20T20:47:51.955525Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.958114Z", "completed_at": "2024-02-20T20:47:51.958118Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.036540985107421875, "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 *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\nwhere normalized_code_type = 'icd-10-cm'\n), ccsr__dx_vertical_pivot as (\n \n select * from raw.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 raw.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-02-20 20:47:44.615990+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 using(ccsr_parent_category)", "relation_name": "raw.ccsr.long_condition_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.942940Z", "completed_at": "2024-02-20T20:47:51.957887Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.971851Z", "completed_at": "2024-02-20T20:47:51.971853Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.03665614128112793, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n), __dbt__cte__cms_chronic_conditions__stg_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim\n), chronic_conditions as (\n\n select * from raw.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_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, 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\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom inclusions_unioned", "relation_name": "raw.chronic_conditions._int_cms_chronic_condition_hiv_aids"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.958339Z", "completed_at": "2024-02-20T20:47:51.972377Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.974204Z", "completed_at": "2024-02-20T20:47:51.974206Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.02717304229736328, "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 , normalized_code_type as code_type\n , normalized_code as code\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.hcc_suspecting._int_prep_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.968684Z", "completed_at": "2024-02-20T20:47:51.972559Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:51.974397Z", "completed_at": "2024-02-20T20:47:51.974399Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.02724599838256836, "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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20T20:47:51.974835Z", "completed_at": "2024-02-20T20:47:51.985163Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.002802Z", "completed_at": "2024-02-20T20:47:52.002807Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.04462790489196777, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n), condition_row_number as (\n\n select \n patient_id\n , normalized_code\n , recorded_date\n , row_number() over(\n partition by\n patient_id\n , normalized_code\n order by recorded_date asc\n ) as rn_asc\n , row_number() over(\n partition by\n patient_id\n , normalized_code\n order by recorded_date desc\n ) as rn_desc\n from __dbt__cte__tuva_chronic_conditions__stg_core__condition\n\n)\n\n, patient_conditions as (\n\n select \n patient_id\n , normalized_code as icd_10_cm\n , max(\n case\n when rn_asc = 1\n then recorded_date\n end\n ) as first_diagnosis_date\n , max(\n case\n when rn_desc = 1\n then recorded_date\n end\n ) as last_diagnosis_date\n from condition_row_number\n group by \n patient_id\n , normalized_code\n\n)\n\nselect \n pc.patient_id\n , h.condition_family\n , h.condition\n , min(first_diagnosis_date) as first_diagnosis_date\n , max(last_diagnosis_date) as last_diagnosis_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.chronic_conditions._value_set_tuva_chronic_conditions_hierarchy h\n inner join patient_conditions pc\n on h.icd_10_cm_code = pc.icd_10_cm\ngroup by \n pc.patient_id\n , h.condition_family\n , h.condition", "relation_name": "raw.chronic_conditions.tuva_chronic_conditions_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:51.985393Z", "completed_at": "2024-02-20T20:47:52.003017Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.018648Z", "completed_at": "2024-02-20T20:47:52.018651Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.04502606391906738, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 raw.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 extract(year from claim_end_date) = 2023\n and cpt_hcpcs_list.payment_year = 2024\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 and extract(year from claim_end_date) = 2023\n and left(bill_type_code,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 and extract(year from claim_end_date) = 2023\n and cpt_hcpcs_list.payment_year = 2024\n and left(bill_type_code,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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc._int_eligible_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.013683Z", "completed_at": "2024-02-20T20:47:52.018856Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.020589Z", "completed_at": "2024-02-20T20:47:52.020591Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.039077043533325195, "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 *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), procedure as (\n \n select * from __dbt__cte__ccsr__stg_core__procedure\n\n), ccsr__procedure_category_map as (\n\n select * from raw.ccsr.procedure_category_map\n\n)\n\nselect distinct\n procedure.encounter_id,\n procedure.patient_id,\n procedure.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom procedure\nleft join ccsr__procedure_category_map\n on procedure.normalized_code = ccsr__procedure_category_map.code", "relation_name": "raw.ccsr.long_procedure_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.003231Z", "completed_at": "2024-02-20T20:47:52.019037Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.020798Z", "completed_at": "2024-02-20T20:47:52.020800Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.03983497619628906, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n), __dbt__cte__financial_pmpm__stg_pharmacy_claim as (\n\n\n\nSELECT\n patient_id\n, dispensing_date\n, paid_amount\n, allowed_amount\n, payer\n, plan\n, data_source\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.pharmacy_claim\n), claims_with_service_categories as (\n select\n a.patient_id\n , a.payer\n , a.plan\n , a.service_category_1\n , a.service_category_2\n , coalesce(a.claim_start_date,a.claim_end_date) as claim_date\n , a.paid_amount\n , a.allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_medical_claim a\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 , cast(date_part('year', claim_date) as TEXT ) || lpad(cast(date_part('month', claim_date) as TEXT ),2,'0') 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 , try_cast( dispensing_date as 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 , cast(date_part('year', claim_date) as TEXT ) || lpad(cast(date_part('month', claim_date) as TEXT ),2,'0') 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-02-20 20:47:44.615990+00:00' as tuva_last_run\n from combine_medical_and_rx\ngroup by 1,2,3,4,5,6,9", "relation_name": "raw.financial_pmpm._int_patient_spend_with_service_categories"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.021003Z", "completed_at": "2024-02-20T20:47:52.040950Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.059694Z", "completed_at": "2024-02-20T20:47:52.059699Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.08308672904968262, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n), __dbt__cte__cms_chronic_conditions__stg_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom tuva.input_layer.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), chronic_conditions as (\n\n select * from raw.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_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, 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\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-02-20 20:47:44.615990+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": "raw.chronic_conditions._int_cms_chronic_condition_all"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.041205Z", "completed_at": "2024-02-20T20:47:52.066181Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.103229Z", "completed_at": "2024-02-20T20:47:52.103232Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.06542491912841797, "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_type\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from raw.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), visits_encounters as (\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 raw.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\n,procedure_encounters as (\n select patient_id, PROCEDURE_DATE as min_date, PROCEDURE_DATE as max_date\n from __dbt__cte__quality_measures__stg_core__procedure proc\n inner join raw.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(proc.normalized_code,proc.source_code) = visit_codes.code\n\n\n)\n,\nclaims_encounters as (\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 raw.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\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, 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 ) / 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.BIRTH_DATE is not null\n\n)\n\nselect 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": "raw.quality_measures._int_nqf0034_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.080350Z", "completed_at": "2024-02-20T20:47:52.103446Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.105544Z", "completed_at": "2024-02-20T20:47:52.105553Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.07167577743530273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9710\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), exclusion_codes as (\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 raw.quality_measures._value_set_codes\n where concept_name in (\n 'Hospice Care Ambulatory'\n , 'Hospice Encounter'\n , 'Palliative Care Encounter'\n , 'Palliative Care Intervention'\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\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 inner join raw.quality_measures._int_nqf0034__performance_period as pp\n on recorded_date between pp.performance_period_begin and pp.performance_period_end\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 inner join raw.quality_measures._int_nqf0034__performance_period as pp on 1=1\n where exclusion_codes.code_system = 'hcpcs'\n and claim_start_date between pp.performance_period_begin and pp.performance_period_end\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 inner join raw.quality_measures._int_nqf0034__performance_period as pp on 1=1\n where observation_date between pp.performance_period_begin and pp.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 inner join raw.quality_measures._int_nqf0034__performance_period as pp on 1=1\n where procedure_date between pp.performance_period_begin and pp.performance_period_end\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\n\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom patients_with_exclusions", "relation_name": "raw.quality_measures._int_nqf0034_exclude_hospice_palliative"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.059916Z", "completed_at": "2024-02-20T20:47:52.103663Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.106085Z", "completed_at": "2024-02-20T20:47:52.106093Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0724480152130127, "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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), exclusion_codes as (\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 raw.quality_measures._value_set_codes\n where 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\n\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom patients_with_exclusions", "relation_name": "raw.quality_measures._int_nqf0034_exclude_colectomy_cancer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.106714Z", "completed_at": "2024-02-20T20:47:52.131814Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.135636Z", "completed_at": "2024-02-20T20:47:52.135640Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.039839982986450195, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_type\n , encounter_start_date\n , encounter_end_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 raw.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 raw.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_end\n ) / 8766.0) as age\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.quality_measures._int_nqf2372_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.132027Z", "completed_at": "2024-02-20T20:47:52.135837Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.144503Z", "completed_at": "2024-02-20T20:47:52.144507Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.015745162963867188, "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 , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20T20:47:52.141228Z", "completed_at": "2024-02-20T20:47:52.144762Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.146635Z", "completed_at": "2024-02-20T20:47:52.146637Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.014714241027832031, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.ccsr.long_condition_category\nwhere \n is_ip_default_category = true\n and condition_rank = 1", "relation_name": "raw.ccsr.singular_condition_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.136045Z", "completed_at": "2024-02-20T20:47:52.144960Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.146832Z", "completed_at": "2024-02-20T20:47:52.146833Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.01538395881652832, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom\n __dbt__cte__readmissions__stg_core__procedure aa\n left join raw.terminology.icd_10_pcs bb\n on aa.normalized_code = bb.icd_10_pcs\n left join raw.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": "raw.readmissions._int_procedure_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.147029Z", "completed_at": "2024-02-20T20:47:52.150633Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.154053Z", "completed_at": "2024-02-20T20:47:52.154057Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011887073516845703, "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 raw.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-02-20T20:47:52.151121Z", "completed_at": "2024-02-20T20:47:52.154460Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.159916Z", "completed_at": "2024-02-20T20:47:52.159919Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.011898040771484375, "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 raw.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-02-20T20:47:52.154668Z", "completed_at": "2024-02-20T20:47:52.159710Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.161619Z", "completed_at": "2024-02-20T20:47:52.161621Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.01314091682434082, "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 raw.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-02-20T20:47:52.157340Z", "completed_at": "2024-02-20T20:47:52.160437Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.165654Z", "completed_at": "2024-02-20T20:47:52.165657Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.013270139694213867, "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 raw.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-02-20T20:47:52.162041Z", "completed_at": "2024-02-20T20:47:52.167423Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.178998Z", "completed_at": "2024-02-20T20:47:52.179002Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.021456003189086914, "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 raw.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 raw.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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.hcc_suspecting._int_all_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.179399Z", "completed_at": "2024-02-20T20:47:52.186376Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.187499Z", "completed_at": "2024-02-20T20:47:52.187502Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.02226114273071289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id || '_' || condition) as unique_field,\n count(*) as n_records\n\nfrom raw.chronic_conditions.tuva_chronic_conditions_long\nwhere (patient_id || '_' || condition) is not null\ngroup by (patient_id || '_' || condition)\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.181861Z", "completed_at": "2024-02-20T20:47:52.187293Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.190394Z", "completed_at": "2024-02-20T20:47:52.190395Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.013148784637451172, "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 raw.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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc._int_hcc_mapping"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.187710Z", "completed_at": "2024-02-20T20:47:52.190986Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.193080Z", "completed_at": "2024-02-20T20:47:52.193082Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01556086540222168, "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 raw.cms_hcc._int_eligible_conditions\nwhere condition_code is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.193606Z", "completed_at": "2024-02-20T20:47:52.206178Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.207313Z", "completed_at": "2024-02-20T20:47:52.207317Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.021551132202148438, "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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_1\n, data_source\n, sum(total_allowed) as total_allowed\nfrom raw.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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 Visit'\n then total_allowed\n else 0\n end\n )\n \n \n as office_visit_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by 1,2,3,4,5", "relation_name": "raw.financial_pmpm._int_service_category_1_allowed_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.202915Z", "completed_at": "2024-02-20T20:47:52.207102Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.213598Z", "completed_at": "2024-02-20T20:47:52.213601Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.02111196517944336, "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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_1\n, data_source\n, sum(total_paid) as total_paid\nfrom raw.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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 Visit'\n then total_paid\n else 0\n end\n )\n \n \n as office_visit_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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by 1,2,3,4,5", "relation_name": "raw.financial_pmpm._int_service_category_1_paid_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.207533Z", "completed_at": "2024-02-20T20:47:52.214062Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.215473Z", "completed_at": "2024-02-20T20:47:52.215475Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.014646768569946289, "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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_2\n, data_source\n, sum(total_allowed) as total_allowed\nfrom raw.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulatory_surgery_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 = 'Hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as 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 = 'Office Visit'\n then total_allowed\n else 0\n end\n )\n \n \n as office_visit_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 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 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 = '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 = '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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by 1,2,3,4,5", "relation_name": "raw.financial_pmpm._int_service_category_2_allowed_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.215975Z", "completed_at": "2024-02-20T20:47:52.227980Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.244656Z", "completed_at": "2024-02-20T20:47:52.244677Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.03295278549194336, "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 (\nselect\n patient_id\n, year_month\n, payer\n, plan\n, service_category_2\n, data_source\n, sum(total_paid) as total_paid\nfrom raw.financial_pmpm._int_patient_spend_with_service_categories\ngroup by 1,2,3,4,5,6\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'\n then total_paid\n else 0\n end\n )\n \n \n as ambulatory_surgery_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 = 'Hospice'\n then total_paid\n else 0\n end\n )\n \n \n as 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 = 'Office Visit'\n then total_paid\n else 0\n end\n )\n \n \n as office_visit_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 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 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 = '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 = '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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by 1,2,3,4,5", "relation_name": "raw.financial_pmpm._int_service_category_2_paid_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.221719Z", "completed_at": "2024-02-20T20:47:52.244918Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.248576Z", "completed_at": "2024-02-20T20:47:52.248579Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.03375983238220215, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n), __dbt__cte__cms_chronic_conditions__stg_pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom tuva.input_layer.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), chronic_conditions as (\n\n select * from raw.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_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 raw.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, 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\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-02-20 20:47:44.615990+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": "raw.chronic_conditions._int_cms_chronic_condition_oud"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.245145Z", "completed_at": "2024-02-20T20:47:52.249111Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.252416Z", "completed_at": "2024-02-20T20:47:52.252418Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.010766267776489258, "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 raw.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-02-20T20:47:52.250296Z", "completed_at": "2024-02-20T20:47:52.253756Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.256459Z", "completed_at": "2024-02-20T20:47:52.256461Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.032800912857055664, "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 raw.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-02-20T20:47:52.253957Z", "completed_at": "2024-02-20T20:47:52.267398Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.282469Z", "completed_at": "2024-02-20T20:47:52.282473Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.030530214309692383, "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 raw.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-02-20T20:47:52.256668Z", "completed_at": "2024-02-20T20:47:52.283404Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.291481Z", "completed_at": "2024-02-20T20:47:52.291485Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.036321163177490234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__frailty", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients 66 years of age and older with at least one claim/encounter\nfor frailty during the measurement period (not full exclusion, used\nin conjunction with dementia medication or\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), aged_patients as (\n select distinct patient_id\n from raw.quality_measures._int_nqf0034_denominator\n where max_age >=66\n\n)\n\n, exclusion_codes as (\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 , case when code in ('G2100','G2101') then 1 else 0 end as meets_all_criteria\n From raw.quality_measures._value_set_codes\n where concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n\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\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\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 aged_patients\n on conditions.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n inner join raw.quality_measures._int_nqf0034__performance_period as pp on\n recorded_date between pp.performance_period_begin and pp.performance_period_end\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 aged_patients\n on medical_claim.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n inner join raw.quality_measures._int_nqf0034__performance_period as pp\n on claim_start_date between pp.performance_period_begin and pp.performance_period_end\n where exclusion_codes.code_system = 'hcpcs'\n\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 aged_patients\n on observations.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n inner join raw.quality_measures._int_nqf0034__performance_period as pp\n on observation_date between pp.performance_period_begin and pp.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\n from procedures\n inner join aged_patients\n on procedures.patient_id = aged_patients.patient_id\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n inner join raw.quality_measures._int_nqf0034__performance_period as pp on\n procedure_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as concept_name\n from condition_exclusions\n\n union distinct\n\n select patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , concept_name as concept_name\n from med_claim_exclusions\n\n union distinct\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as concept_name\n from observation_exclusions\n\n union distinct\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as concept_name\n from procedure_exclusions\n\n)\n, ordered_exclusions as (\n select patient_id\n , exclusion_date\n , concept_name\n , row_number() over (partition by patient_id order by exclusion_date) as exclusion_row\n from patients_with_exclusions\n )\n\nselect patient_id\n , exclusion_date\n , concept_name\nfrom ordered_exclusions", "relation_name": "raw.quality_measures._int_nqf0034__frailty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.284354Z", "completed_at": "2024-02-20T20:47:52.297436Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.315317Z", "completed_at": "2024-02-20T20:47:52.315330Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.034732818603515625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 in Institutional Special Needs Plans (SNP)\n or residing in long term care\n\n Future enhancement: group claims into encounters\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), aged_patients as (\n select distinct patient_id\n from raw.quality_measures._int_nqf0034_denominator\n where max_age >=66\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 aged_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 aged_patients\n inner join medical_claim\n on aged_patients.patient_id = medical_claim.patient_id\n\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) between pp.performance_period_begin and pp.performance_period_end\n\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\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom exclusions", "relation_name": "raw.quality_measures._int_nqf0034_exclude_institutional_snp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.292345Z", "completed_at": "2024-02-20T20:47:52.316667Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.389559Z", "completed_at": "2024-02-20T20:47:52.389563Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.09916305541992188, "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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.lab_result\n\n\n), denominator as (\n\n select\n patient_id\n\n from raw.quality_measures._int_nqf0034_denominator\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) end as code_system\n , concept_name\n From raw.quality_measures._value_set_codes\n where 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, screening_periods as (\n select *,\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 end as effective_performance_period_begin\n\n from screening_codes\n inner join raw.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 select 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,qualifying_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) between screening_periods.effective_performance_period_begin and 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 or ( labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system )\n )\n\n,qualifying_events as (\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) patient_id\n ,cast( evidence_date as date) as evidence_date\n ,cast( evidence as TEXT) as evidence\n\nfrom qualifying_events\ninner join denominator\n on qualifying_events.patient_id = denominator.patient_id", "relation_name": "raw.quality_measures._int_nqf0034_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.317721Z", "completed_at": "2024-02-20T20:47:52.390760Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.407175Z", "completed_at": "2024-02-20T20:47:52.407180Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.0933990478515625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__frailty", "compiled": true, "compiled_code": "\n/*\n This concept is used in multiple exclusions. Patients greater than\n or equal to 66 with at least one claim/encounter for frailty during\n the measurement period.\n*/\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), denominator as (\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n from raw.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 raw.quality_measures._value_set_codes\n where 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 denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and condition_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and condition_exclusions.recorded_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where denominator.age >= 66\n and med_claim_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and observation_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\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 where denominator.age >= 66\n and procedure_exclusions.concept_name in (\n 'Frailty Device'\n , 'Frailty Diagnosis'\n , 'Frailty Encounter'\n , 'Frailty Symptom'\n )\n and procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom patients_with_frailty", "relation_name": "raw.quality_measures._int_nqf2372__frailty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.391216Z", "completed_at": "2024-02-20T20:47:52.414348Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.416353Z", "completed_at": "2024-02-20T20:47:52.416355Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.027268171310424805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice", "compiled": true, "compiled_code": "\n\n/*\n Hospice services used by patient any time during the measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from raw.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 raw.quality_measures._value_set_codes\n where concept_name in (\n 'Hospice Care Ambulatory'\n , 'Hospice Encounter'\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\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, procedures as (\n\n select\n patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__procedure\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, 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, 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.normalized_code = exclusion_codes.code\n and procedures.normalized_code_type = exclusion_codes.code_system\n\n)\n\n, hospice as (\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 where observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n union all\n\n select\n denominator.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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\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 where procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom hospice", "relation_name": "raw.quality_measures._int_nqf2372_exclude_hospice"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.408079Z", "completed_at": "2024-02-20T20:47:52.416741Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.447696Z", "completed_at": "2024-02-20T20:47:52.447701Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.04172015190124512, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 in Institutional Special Needs Plans (SNP)\n or residing in long term care\n\n Future enhancement: group claims into encounters\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), denominator as (\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n from raw.quality_measures._int_nqf2372_denominator\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 denominator.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 denominator\n inner join medical_claim\n on denominator.patient_id = medical_claim.patient_id\n where denominator.age >= 66\n and (\n medical_claim.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or medical_claim.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\n and 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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom exclusions", "relation_name": "raw.quality_measures._int_nqf2372_exclude_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.417330Z", "completed_at": "2024-02-20T20:47:52.449037Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.467690Z", "completed_at": "2024-02-20T20:47:52.467694Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.05226612091064453, "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 , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.condition\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from raw.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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom unioned", "relation_name": "raw.quality_measures._int_nqf2372_exclude_mastectomy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.449450Z", "completed_at": "2024-02-20T20:47:52.468527Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.494362Z", "completed_at": "2024-02-20T20:47:52.494372Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.047380924224853516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative", "compiled": true, "compiled_code": "\n\n/*\n Palliative care services used by patient any time during the measurement period\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from raw.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 raw.quality_measures._value_set_codes\n where concept_name in (\n 'Palliative Care Encounter'\n , 'Palliative Care Intervention'\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 , 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, 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, palliative_care as (\n\n select\n denominator.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 denominator\n inner join med_claim_exclusions\n on denominator.patient_id = med_claim_exclusions.patient_id\n where (\n med_claim_exclusions.claim_start_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n or med_claim_exclusions.claim_end_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n )\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 where observation_exclusions.observation_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\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 where procedure_exclusions.procedure_date\n between denominator.performance_period_begin\n and denominator.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom palliative_care", "relation_name": "raw.quality_measures._int_nqf2372_exclude_palliative"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.468732Z", "completed_at": "2024-02-20T20:47:52.494767Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.498385Z", "completed_at": "2024-02-20T20:47:52.498388Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.031942129135131836, "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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 raw.quality_measures._int_nqf2372_denominator\n\n)\n\n, mammography_codes as (\n\n select\n code\n , code_system\n from raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.quality_measures._int_nqf2372_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.495965Z", "completed_at": "2024-02-20T20:47:52.499561Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.502461Z", "completed_at": "2024-02-20T20:47:52.502464Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.009784936904907227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom raw.ccsr.singular_condition_category\nwhere claim_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.500012Z", "completed_at": "2024-02-20T20:47:52.502860Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.506450Z", "completed_at": "2024-02-20T20:47:52.506452Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.008682966232299805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b", "compiled": true, "compiled_code": "\n \n \n\nselect\n claim_id as unique_field,\n count(*) as n_records\n\nfrom raw.ccsr.singular_condition_category\nwhere claim_id is not null\ngroup by claim_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.503434Z", "completed_at": "2024-02-20T20:47:52.506956Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.512345Z", "completed_at": "2024-02-20T20:47:52.512351Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.01104283332824707, "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 proc.encounter_id, 1 as c_rank\n from raw.readmissions._int_procedure_ccs proc\n left join raw.readmissions._value_set_surgery_gynecology_cohort sgc\n on proc.procedure_code = sgc.icd_10_pcs\n left join raw.readmissions._value_set_specialty_cohort sgsc\n on proc.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 raw.readmissions._int_encounter_with_ccs diag\n inner join raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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": "raw.readmissions._int_encounter_specialty_cohort"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.508181Z", "completed_at": "2024-02-20T20:47:52.513907Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.518458Z", "completed_at": "2024-02-20T20:47:52.518460Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01538991928100586, "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 raw.readmissions._int_procedure_ccs pccs\ninner join raw.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 raw.readmissions._int_encounter_with_ccs dccs\ninner join raw.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 raw.readmissions._int_procedure_ccs pccs\ninner join raw.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 raw.readmissions._int_procedure_ccs pcs\ninner join raw.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 raw.readmissions._int_encounter_with_ccs dccs\nleft join raw.readmissions._value_set_acute_diagnosis_icd_10_cm adi\n on dccs.primary_diagnosis_code = adi.icd_10_cm\nleft join raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run from always_planned_px\nunion distinct\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run from always_planned_dx\nunion distinct\nselect *, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run from potentially_planned_that_are_actually_planned", "relation_name": "raw.readmissions._int_planned_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.514111Z", "completed_at": "2024-02-20T20:47:52.521660Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.522840Z", "completed_at": "2024-02-20T20:47:52.522842Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.011085271835327148, "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 raw.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 extract(year from hcc_billed.last_billed) = extract(year from convert_timezone('UTC', current_timestamp()) )\n then 1\n else 0\n end as current_year_billed\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 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_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 , cast(current_year_billed as boolean) as current_year_billed\n from all_conditions_with_flag\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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.hcc_suspecting._int_patient_hcc_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.518663Z", "completed_at": "2024-02-20T20:47:52.523035Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.524488Z", "completed_at": "2024-02-20T20:47:52.524490Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.011668205261230469, "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 raw.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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc._int_hcc_hierarchy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.524691Z", "completed_at": "2024-02-20T20:47:52.530291Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.534471Z", "completed_at": "2024-02-20T20:47:52.534475Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.013761043548583984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_prep", "compiled": true, "compiled_code": "\n\nwith combine as (\nSELECT\n a.patient_id,\n a.year_month,\n a.payer,\n a.plan, \n a.data_source,\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_visit_paid, 0) AS office_visit_paid,\n COALESCE(b.ancillary_paid, 0) AS ancillary_paid,\n COALESCE(b.pharmacy_paid, 0) AS pharmacy_paid,\n COALESCE(b.other_paid, 0) AS other_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_paid, 0) AS ambulatory_surgery_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.hospice_paid, 0) AS 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.office_visit_paid, 0) AS office_visit_paid_2,\n COALESCE(c.outpatient_hospital_or_clinic_paid, 0) AS outpatient_hospital_or_clinic_paid,\n COALESCE(c.outpatient_psychiatric_paid, 0) AS outpatient_psychiatric_paid,\n COALESCE(c.outpatient_rehabilitation_paid, 0) AS outpatient_rehabilitation_paid,\n COALESCE(c.skilled_nursing_paid, 0) AS skilled_nursing_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_visit_allowed, 0) AS office_visit_allowed,\n COALESCE(d.ancillary_allowed, 0) AS ancillary_allowed,\n COALESCE(d.pharmacy_allowed, 0) AS pharmacy_allowed,\n COALESCE(d.other_allowed, 0) AS other_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_allowed, 0) AS ambulatory_surgery_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.hospice_allowed, 0) AS 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.office_visit_allowed, 0) AS office_visit_allowed_2,\n COALESCE(e.outpatient_hospital_or_clinic_allowed, 0) AS outpatient_hospital_or_clinic_allowed,\n COALESCE(e.outpatient_psychiatric_allowed, 0) AS outpatient_psychiatric_allowed,\n COALESCE(e.outpatient_rehabilitation_allowed, 0) AS outpatient_rehabilitation_allowed,\n COALESCE(e.skilled_nursing_allowed, 0) AS skilled_nursing_allowed,\n COALESCE(e.urgent_care_allowed, 0) AS urgent_care_allowed\nFROM raw.financial_pmpm.member_months a\nleft join raw.financial_pmpm._int_service_category_1_paid_pivot 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\nleft join raw.financial_pmpm._int_service_category_2_paid_pivot 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\nleft join raw.financial_pmpm._int_service_category_1_allowed_pivot 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\nleft join raw.financial_pmpm._int_service_category_2_allowed_pivot 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, inpatient_paid + outpatient_paid + office_visit_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n, inpatient_paid + outpatient_paid + office_visit_paid + ancillary_paid + other_paid as medical_paid\n, inpatient_allowed + outpatient_allowed + office_visit_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n, inpatient_allowed + outpatient_allowed + office_visit_allowed + ancillary_allowed + other_allowed as medical_allowed\n, '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom combine", "relation_name": "raw.financial_pmpm.pmpm_prep"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.530523Z", "completed_at": "2024-02-20T20:47:52.534657Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.537735Z", "completed_at": "2024-02-20T20:47:52.537738Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.010583162307739258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "compiled": true, "compiled_code": "\n\nwith conditions_unioned as (\n\n select * from raw.chronic_conditions._int_cms_chronic_condition_all\n union distinct\n select * from raw.chronic_conditions._int_cms_chronic_condition_hiv_aids\n union distinct\n select * from raw.chronic_conditions._int_cms_chronic_condition_oud\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom conditions_unioned", "relation_name": "raw.chronic_conditions.cms_chronic_conditions_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.534865Z", "completed_at": "2024-02-20T20:47:52.538229Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.541258Z", "completed_at": "2024-02-20T20:47:52.541260Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.008307933807373047, "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 raw.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-02-20T20:47:52.539373Z", "completed_at": "2024-02-20T20:47:52.542479Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.545291Z", "completed_at": "2024-02-20T20:47:52.545293Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007999897003173828, "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 raw.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-02-20T20:47:52.542907Z", "completed_at": "2024-02-20T20:47:52.546220Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.549322Z", "completed_at": "2024-02-20T20:47:52.549325Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.008537054061889648, "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 raw.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-02-20T20:47:52.546447Z", "completed_at": "2024-02-20T20:47:52.549695Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.573910Z", "completed_at": "2024-02-20T20:47:52.573914Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.0297396183013916, "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 raw.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-02-20T20:47:52.550257Z", "completed_at": "2024-02-20T20:47:52.574890Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.590502Z", "completed_at": "2024-02-20T20:47:52.590505Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.04211997985839844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness", "compiled": true, "compiled_code": "\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n OR two outpatient, observation, ED or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), encounter_exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n , case when concept_name = 'Acute Inpatient' then 'Acute Inpatient'\n else 'Other Encounter' end as concept_category\n , case when concept_name = 'Acute Inpatient' then 1\n else 2 end as qualifying_count\n from raw.quality_measures._value_set_codes\n where concept_name in (\n 'Acute Inpatient'\n , 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n\n)\n\n, condition_exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from raw.quality_measures._value_set_codes\n where concept_name in (\n 'Advanced Illness'\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/* -- observation based exclusions removed until we have better testing data\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 select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , condition_exclusion_codes.concept_name\n from conditions\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on conditions.recorded_date between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join condition_exclusion_codes\n on conditions.code = condition_exclusion_codes.code\n and conditions.code_type = condition_exclusion_codes.code_system\n\n/* -- observations temporarily removed until we have better testing data\n union all\n select\n observations.patient_id\n , cast(null as TEXT) as claim_id\n , observations.observation_date\n , condition_exclusion_codes.concept_name\n from observations\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on observations.observation_date between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join condition_exclusion_codes\n on observations.code = condition_exclusion_codes.code\n and observations.code_type = condition_exclusion_codes.code_system\n*/\n\n\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 , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from medical_claim\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on coalesce(medical_claim.claim_start_date,medical_claim.claim_end_date) between pp.performance_period_begin_1yp and pp.performance_period_end\n inner join encounter_exclusion_codes\n on medical_claim.hcpcs_code = encounter_exclusion_codes.code\n where encounter_exclusion_codes.code_system = 'hcpcs'\n\n)\n\n/* -- observations temporarily removed until we get better testing data\n, observation_exclusions as (\n\n\n select\n observations.patient_id\n , observations.observation_date\n , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from observations\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on observations.observation_date between pp.performance_period_begin_1yp and pp.performance_period_end\n\n inner join encounter_exclusion_codes\n on observations.code = encounter_exclusion_codes.code\n and observations.code_type = encounter_exclusion_codes.code_system\n\n)\n*/\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , encounter_exclusion_codes.concept_name\n , encounter_exclusion_codes.concept_category\n , encounter_exclusion_codes.qualifying_count\n from procedures\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on procedures.procedure_date between pp.performance_period_begin_1yp and pp.performance_period_end\n\n inner join encounter_exclusion_codes\n on procedures.code = encounter_exclusion_codes.code\n and procedures.code_type = encounter_exclusion_codes.code_system\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n*/\n, patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , concept_name\nfrom raw.quality_measures._int_nqf0034__frailty\n\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\n*/\n, encounters_with_conditions 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 , med_claim_exclusions.concept_name\n || ' with '\n || condition_exclusions.concept_name\n as exclusion_reason\n , med_claim_exclusions.concept_category\n , med_claim_exclusions.qualifying_count\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\n\n union all\n\n/* -- observations temporarily removed until we get better testing data\n select distinct\n patients_with_frailty.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n , observation_exclusions.concept_category\n , observation_exclusions.qualifying_count\n from patients_with_frailty\n inner join observation_exclusions\n on patients_with_frailty.patient_id = observation_exclusions.patient_id\n inner join condition_exclusions\n on observation_exclusions.patient_id = condition_exclusions.patient_id\n and observation_exclusions.observation_date = condition_exclusions.recorded_date\n\n union all\n*/\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n , procedure_exclusions.concept_category\n , procedure_exclusions.qualifying_count\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\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND two outpatient, observation, ED or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\n/*\n Filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n\n\n, qualifying_encounters as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\nfrom encounters_with_conditions e\nqualify dense_rank() over(partition by patient_id,concept_category order by exclusion_date) >= qualifying_count\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom qualifying_encounters", "relation_name": "raw.quality_measures._int_nqf0034_exclude_advanced_illness"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.575706Z", "completed_at": "2024-02-20T20:47:52.597099Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.627863Z", "completed_at": "2024-02-20T20:47:52.627869Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.054328203201293945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period AND a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith\n __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , paid_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.pharmacy_claim\n\n\n), exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from raw.quality_measures._value_set_codes\n where 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\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 raw.quality_measures._int_nqf0034__performance_period pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 raw.quality_measures._int_nqf0034__performance_period pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 raw.quality_measures._int_nqf0034__performance_period pp\n on medications.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\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 raw.quality_measures._int_nqf0034__performance_period pp\n on pharmacy_claim.dispensing_date between pp.performance_period_begin_1yp and pp.performance_period_end\n or pharmacy_claim.paid_date between pp.performance_period_begin_1yp and pp.performance_period_end\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\n\n, patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , concept_name\nfrom raw.quality_measures._int_nqf0034__frailty\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.concept_name\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\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\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , patients_with_frailty.concept_name\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom frailty_with_dementia d", "relation_name": "raw.quality_measures._int_nqf0034_exclude_dementia"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.591364Z", "completed_at": "2024-02-20T20:47:52.628723Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.648361Z", "completed_at": "2024-02-20T20:47:52.648364Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.05891990661621094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness", "compiled": true, "compiled_code": "\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND either one acute inpatient encounter with a diagnosis of advanced\n illness\n\n OR two outpatient, observation, ED or nonacute inpatient encounters on\n different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.procedure\n), patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372__frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from raw.quality_measures._value_set_codes\n where 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\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/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND one acute inpatient encounter with a diagnosis of advanced illness\n during measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name = 'Acute Inpatient'\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n med_claim_exclusions.claim_start_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 procedure_exclusions.concept_name = 'Acute Inpatient'\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n procedure_exclusions.procedure_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for\n frailty during the measurement period\n\n AND two outpatient, observation, ED or nonacute inpatient encounters\n on different dates of service with an advanced illness diagnosis during\n measurement period or the year prior to measurement period\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\n || ' with '\n || med_claim_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 med_claim_exclusions.concept_name in (\n 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n med_claim_exclusions.claim_start_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or med_claim_exclusions.claim_end_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\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\n || ' with '\n || procedure_exclusions.concept_name\n || ' and '\n || condition_exclusions.concept_name\n as exclusion_reason\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 procedure_exclusions.concept_name in (\n 'Encounter Inpatient'\n , 'Outpatient'\n , 'Observation'\n , 'Emergency Department Visit'\n , 'Nonacute Inpatient'\n )\n and condition_exclusions.concept_name = 'Advanced Illness'\n and (\n procedure_exclusions.procedure_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\n\n)\n\n/*\n Filter to patients who have had one acute inpatient encounter or\n two nonacute outpatient encounters\n*/\n, acute_inpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient\n group by patient_id\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient\n group by patient_id\n\n)\n\n, eligible_acute_inpatient as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n from acute_inpatient\n left join acute_inpatient_counts\n on acute_inpatient.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n)\n\n, eligible_nonacute_outpatient as (\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n from nonacute_outpatient\n left join nonacute_outpatient_counts\n on nonacute_outpatient.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n\n, exclusions_unioned as (\n\n select\n eligible_acute_inpatient.patient_id\n , eligible_acute_inpatient.exclusion_date\n , eligible_acute_inpatient.exclusion_reason\n from eligible_acute_inpatient\n\n union all\n\n select\n eligible_nonacute_outpatient.patient_id\n , eligible_nonacute_outpatient.exclusion_date\n , eligible_nonacute_outpatient.exclusion_reason\n from eligible_nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom exclusions_unioned", "relation_name": "raw.quality_measures._int_nqf2372_exclude_advanced_illness"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.628909Z", "completed_at": "2024-02-20T20:47:52.648753Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.653389Z", "completed_at": "2024-02-20T20:47:52.653392Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.02682805061340332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia", "compiled": true, "compiled_code": "\n\n/*\n Patients greater than or equal to 66 with at least one claim/encounter for frailty\n during the measurement period AND a dispensed medication for dementia during the measurement period\n or year prior to measurement period\n*/\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.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 , paid_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.pharmacy_claim\n\n\n), patients_with_frailty as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372__frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from raw.quality_measures._value_set_codes\n where 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\n || ' with '\n || pharmacy_claim_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n where (\n pharmacy_claim_exclusions.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n or pharmacy_claim_exclusions.paid_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n )\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\n || ' with '\n || medication_exclusions.concept_name\n as exclusion_reason\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n where medication_exclusions.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n patients_with_frailty.performance_period_begin\n )\n\n\n and patients_with_frailty.performance_period_end\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom frailty_with_dementia", "relation_name": "raw.quality_measures._int_nqf2372_exclude_dementia"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.649353Z", "completed_at": "2024-02-20T20:47:52.653957Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.658125Z", "completed_at": "2024-02-20T20:47:52.658127Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.010748147964477539, "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_npi,\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom\n raw.readmissions._int_encounter aa\n left join raw.readmissions._int_index_admission bb\n on aa.encounter_id = bb.encounter_id\n left join raw.readmissions._int_planned_encounter cc\n on aa.encounter_id = cc.encounter_id \n left join raw.readmissions._int_encounter_specialty_cohort dd\n on aa.encounter_id = dd.encounter_id\n left join raw.readmissions._int_encounter_data_quality ee\n on aa.encounter_id = ee.encounter_id", "relation_name": "raw.readmissions.encounter_augmented"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.655092Z", "completed_at": "2024-02-20T20:47:52.659205Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.663490Z", "completed_at": "2024-02-20T20:47:52.663493Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.010611772537231445, "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 , 'Prior coding history' as reason\n , icd_10_cm_code\n || case\n when last_billed is not null then ' last billed on ' || last_billed\n when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded\n else ' (missing recorded and billing dates) '\n end as contributing_factor\n from raw.hcc_suspecting._int_patient_hcc_history\n where current_year_billed = false\n\n)\n\n, unioned as (\n\n select * from hcc_history_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 from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.hcc_suspecting.list"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.659664Z", "completed_at": "2024-02-20T20:47:52.663893Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.668995Z", "completed_at": "2024-02-20T20:47:52.668999Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011359930038452148, "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 raw.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 raw.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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc._int_disabled_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.664522Z", "completed_at": "2024-02-20T20:47:52.669932Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.674582Z", "completed_at": "2024-02-20T20:47:52.674585Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.012038707733154297, "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 raw.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 raw.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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc._int_disease_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.670730Z", "completed_at": "2024-02-20T20:47:52.680394Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.683931Z", "completed_at": "2024-02-20T20:47:52.683938Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.015553951263427734, "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 raw.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 raw.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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc._int_disease_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.675405Z", "completed_at": "2024-02-20T20:47:52.682684Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.687465Z", "completed_at": "2024-02-20T20:47:52.687468Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01386880874633789, "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 raw.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 raw.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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc._int_hcc_count_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.685050Z", "completed_at": "2024-02-20T20:47:52.688925Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.692482Z", "completed_at": "2024-02-20T20:47:52.692485Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.013109922409057617, "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_visit_paid) / COUNT(1) AS office_visit_paid,\n SUM(ancillary_paid) / COUNT(1) AS ancillary_paid,\n SUM(pharmacy_paid) / COUNT(1) AS pharmacy_paid,\n SUM(other_paid) / COUNT(1) AS other_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_paid) / COUNT(1) AS ambulatory_surgery_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(hospice_paid) / COUNT(1) AS 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(office_visit_paid_2) / COUNT(1) AS office_visit_paid_2,\n SUM(outpatient_hospital_or_clinic_paid) / COUNT(1) AS outpatient_hospital_or_clinic_paid,\n SUM(outpatient_psychiatric_paid) / COUNT(1) AS outpatient_psychiatric_paid,\n SUM(outpatient_rehabilitation_paid) / COUNT(1) AS outpatient_rehabilitation_paid,\n SUM(skilled_nursing_paid) / COUNT(1) AS skilled_nursing_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_visit_allowed) / COUNT(1) AS office_visit_allowed,\n SUM(ancillary_allowed) / COUNT(1) AS ancillary_allowed,\n SUM(pharmacy_allowed) / COUNT(1) AS pharmacy_allowed,\n SUM(other_allowed) / COUNT(1) AS other_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_allowed) / COUNT(1) AS ambulatory_surgery_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(hospice_allowed) / COUNT(1) AS 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(office_visit_allowed_2) / COUNT(1) AS office_visit_allowed_2,\n SUM(outpatient_hospital_or_clinic_allowed) / COUNT(1) AS outpatient_hospital_or_clinic_allowed,\n SUM(outpatient_psychiatric_allowed) / COUNT(1) AS outpatient_psychiatric_allowed,\n SUM(outpatient_rehabilitation_allowed) / COUNT(1) AS outpatient_rehabilitation_allowed,\n SUM(skilled_nursing_allowed) / COUNT(1) AS skilled_nursing_allowed,\n SUM(urgent_care_allowed) / COUNT(1) AS urgent_care_allowed,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nFROM raw.financial_pmpm.pmpm_prep a\nGROUP BY 1,2,3", "relation_name": "raw.financial_pmpm.pmpm_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.689821Z", "completed_at": "2024-02-20T20:47:52.694950Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.696060Z", "completed_at": "2024-02-20T20:47:52.696062Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.008306026458740234, "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_visit_paid) / COUNT(1) AS office_visit_paid,\n SUM(ancillary_paid) / COUNT(1) AS ancillary_paid,\n SUM(pharmacy_paid) / COUNT(1) AS pharmacy_paid,\n SUM(other_paid) / COUNT(1) AS other_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_paid) / COUNT(1) AS ambulatory_surgery_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(hospice_paid) / COUNT(1) AS 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(office_visit_paid_2) / COUNT(1) AS office_visit_paid_2,\n SUM(outpatient_hospital_or_clinic_paid) / COUNT(1) AS outpatient_hospital_or_clinic_paid,\n SUM(outpatient_psychiatric_paid) / COUNT(1) AS outpatient_psychiatric_paid,\n SUM(outpatient_rehabilitation_paid) / COUNT(1) AS outpatient_rehabilitation_paid,\n SUM(skilled_nursing_paid) / COUNT(1) AS skilled_nursing_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_visit_allowed) / COUNT(1) AS office_visit_allowed,\n SUM(ancillary_allowed) / COUNT(1) AS ancillary_allowed,\n SUM(pharmacy_allowed) / COUNT(1) AS pharmacy_allowed,\n SUM(other_allowed) / COUNT(1) AS other_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_allowed) / COUNT(1) AS ambulatory_surgery_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(hospice_allowed) / COUNT(1) AS 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(office_visit_allowed_2) / COUNT(1) AS office_visit_allowed_2,\n SUM(outpatient_hospital_or_clinic_allowed) / COUNT(1) AS outpatient_hospital_or_clinic_allowed,\n SUM(outpatient_psychiatric_allowed) / COUNT(1) AS outpatient_psychiatric_allowed,\n SUM(outpatient_rehabilitation_allowed) / COUNT(1) AS outpatient_rehabilitation_allowed,\n SUM(skilled_nursing_allowed) / COUNT(1) AS skilled_nursing_allowed,\n SUM(urgent_care_allowed) / COUNT(1) AS urgent_care_allowed,\n '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nFROM raw.financial_pmpm.pmpm_prep a\nGROUP BY 1,2,3,4", "relation_name": "raw.financial_pmpm.pmpm_payer_plan"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.692732Z", "completed_at": "2024-02-20T20:47:52.695856Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.699741Z", "completed_at": "2024-02-20T20:47:52.699743Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011180877685546875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id || '_' || year_month || '_' || plan) as unique_field,\n count(*) as n_records\n\nfrom raw.financial_pmpm.pmpm_prep\nwhere (patient_id || '_' || year_month || '_' || plan) is not null\ngroup by (patient_id || '_' || year_month || '_' || plan)\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.702108Z", "completed_at": "2024-02-20T20:47:52.706130Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.706715Z", "completed_at": "2024-02-20T20:47:52.706717Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.006574153900146484, "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 raw.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-02-20T20:47:52.704161Z", "completed_at": "2024-02-20T20:47:52.706912Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.707960Z", "completed_at": "2024-02-20T20:47:52.707961Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006762981414794922, "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 raw.chronic_conditions.cms_chronic_conditions_long\nwhere condition is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.709485Z", "completed_at": "2024-02-20T20:47:52.713669Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.714073Z", "completed_at": "2024-02-20T20:47:52.714076Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.006440877914428711, "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 raw.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-02-20T20:47:52.711865Z", "completed_at": "2024-02-20T20:47:52.714267Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.715473Z", "completed_at": "2024-02-20T20:47:52.715475Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006014108657836914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320", "compiled": true, "compiled_code": "\n \n \n\nselect\n (patient_id || claim_id || start_date || condition) as unique_field,\n count(*) as n_records\n\nfrom raw.chronic_conditions.cms_chronic_conditions_long\nwhere (patient_id || claim_id || start_date || condition) is not null\ngroup by (patient_id || claim_id || start_date || condition)\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.718415Z", "completed_at": "2024-02-20T20:47:52.726571Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.726996Z", "completed_at": "2024-02-20T20:47:52.726999Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.011822223663330078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "compiled": true, "compiled_code": "\n\nwith exclusions as (\nselect *\nFrom raw.quality_measures._int_nqf0034_exclude_advanced_illness\n\nunion all\n\nselect *\nFrom raw.quality_measures._int_nqf0034_exclude_colectomy_cancer\n\nunion all\n\nselect *\nFrom raw.quality_measures._int_nqf0034_exclude_dementia\n\nunion all\n\nselect *\nFrom raw.quality_measures._int_nqf0034_exclude_hospice_palliative\n\nunion all\n\nselect *\nFrom raw.quality_measures._int_nqf0034_exclude_institutional_snp\n)\n\nselect exclusions.*\nfrom exclusions\ninner join raw.quality_measures._int_nqf0034_denominator p\n on exclusions.patient_id = p.patient_id", "relation_name": "raw.quality_measures._int_nqf0034_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.722626Z", "completed_at": "2024-02-20T20:47:52.727178Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.728291Z", "completed_at": "2024-02-20T20:47:52.728293Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.006831169128417969, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "compiled": true, "compiled_code": "\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 , measure_id\n , measure_name\n , measure_version\n from raw.quality_measures._int_nqf2372_denominator\n\n)\n\n, advanced_illness as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_advanced_illness\n\n)\n\n, dementia as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_dementia\n\n)\n\n, hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_hospice\n\n)\n\n, institutional as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_institutional\n\n)\n\n, mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_mastectomy\n\n)\n\n, palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from raw.quality_measures._int_nqf2372_exclude_palliative\n\n)\n\n, denominator_with_advanced_illness 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 , case\n when advanced_illness.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , advanced_illness.exclusion_date\n , advanced_illness.exclusion_reason\n from denominator\n left join advanced_illness\n on denominator.patient_id = advanced_illness.patient_id\n\n)\n\n, denominator_with_dementia 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 , case\n when dementia.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , dementia.exclusion_date\n , dementia.exclusion_reason\n from denominator\n left join dementia\n on denominator.patient_id = dementia.patient_id\n\n)\n\n, denominator_with_hospice 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 , case\n when hospice.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , hospice.exclusion_date\n , hospice.exclusion_reason\n from denominator\n left join hospice\n on denominator.patient_id = hospice.patient_id\n\n)\n\n, denominator_with_institutional 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 , case\n when institutional.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , institutional.exclusion_date\n , institutional.exclusion_reason\n from denominator\n left join institutional\n on denominator.patient_id = institutional.patient_id\n\n)\n\n, denominator_with_mastectomy 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 , case\n when mastectomy.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , mastectomy.exclusion_date\n , mastectomy.exclusion_reason\n from denominator\n left join mastectomy\n on denominator.patient_id = mastectomy.patient_id\n\n)\n\n, denominator_with_palliative 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 , case\n when palliative.patient_id is not null then 1\n else 0\n end as exclusion_flag\n , palliative.exclusion_date\n , palliative.exclusion_reason\n from denominator\n left join palliative\n on denominator.patient_id = palliative.patient_id\n\n)\n\n, exclusions_unioned as (\n\n select * from denominator_with_advanced_illness\n union all\n select * from denominator_with_dementia\n union all\n select * from denominator_with_hospice\n union all\n select * from denominator_with_institutional\n union all\n select * from denominator_with_mastectomy\n union all\n select * from denominator_with_palliative\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 , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(exclusion_flag as integer) as exclusion_flag\n from exclusions_unioned\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 , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.quality_measures._int_nqf2372_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.729511Z", "completed_at": "2024-02-20T20:47:52.740030Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.740458Z", "completed_at": "2024-02-20T20:47:52.740461Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.012320756912231445, "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 raw.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_npi,\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_npi 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-02-20 20:47:44.615990+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": "raw.readmissions.readmission_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.732837Z", "completed_at": "2024-02-20T20:47:52.741234Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.742053Z", "completed_at": "2024-02-20T20:47:52.742055Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.013370037078857422, "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\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), patients as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8766.0) as age\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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.hcc_suspecting.summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.742238Z", "completed_at": "2024-02-20T20:47:52.746466Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.769106Z", "completed_at": "2024-02-20T20:47:52.769110Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.02826714515686035, "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 , 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 as description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 raw.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 , 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 , 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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc.patient_risk_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.746999Z", "completed_at": "2024-02-20T20:47:52.770519Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.790012Z", "completed_at": "2024-02-20T20:47:52.790017Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.04430103302001953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_long", "compiled": true, "compiled_code": "/* selecting the full patient population as the grain of this table */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, denominator as (\n\n select\n patient_id\n from raw.quality_measures._int_nqf0034_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n from raw.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 raw.quality_measures._int_nqf0034_exclusions\n\n)\n\n, measure_flags as (\n\n select\n patient.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 raw.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n ) as measure_id\n , (\n\n select name\nfrom raw.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_name\n , (\n select version\nfrom raw.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_version\n from patient\n inner join raw.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 evidence_date desc nulls last\n , exclusion_date desc nulls last\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 , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.quality_measures._int_nqf0034_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.771143Z", "completed_at": "2024-02-20T20:47:52.791325Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.796653Z", "completed_at": "2024-02-20T20:47:52.796657Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.026820898056030273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_long", "compiled": true, "compiled_code": "\n\n/* selecting the full patient population as the grain of this table */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\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 , denominator_flag\n from raw.quality_measures._int_nqf2372_denominator\n\n)\n\n, numerator 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 , numerator_flag\n from raw.quality_measures._int_nqf2372_numerator\n\n)\n\n, exclusions 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 , exclusion_date\n , exclusion_reason\n , exclusion_flag\n from raw.quality_measures._int_nqf2372_exclusions\n\n)\n\n, measure_flags as (\n\n select\n patient.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 patient\n left join denominator\n on patient.patient_id = denominator.patient_id\n left join numerator\n on patient.patient_id = numerator.patient_id\n left join exclusions\n on patient.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 evidence_date desc nulls last\n , exclusion_date desc nulls last\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 , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.quality_measures._int_nqf2372_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.791857Z", "completed_at": "2024-02-20T20:47:52.797560Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.798337Z", "completed_at": "2024-02-20T20:47:52.798339Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011303901672363281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_scores", "compiled": true, "compiled_code": "\nwith seed_adjustment_rates as (\n\n select\n model_version\n , payment_year\n , normalization_factor\n , ma_coding_pattern_adjustment\n from raw.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 raw.cms_hcc.patient_risk_factors\n\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, 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 , cast(payment_year as integer) as payment_year\n from payment\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_year\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.cms_hcc.patient_risk_scores"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.798533Z", "completed_at": "2024-02-20T20:47:52.803164Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.805500Z", "completed_at": "2024-02-20T20:47:52.805503Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.008136987686157227, "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 measures_unioned as (\n\n select * from raw.quality_measures._int_nqf2372_long\n union all\n\n select * from raw.quality_measures._int_nqf0034_long\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 measures_unioned\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , case\n when exclusion_flag = 1 then null\n when numerator_flag = 1 then 1\n when denominator_flag = 1 then 0\n else null end as performance_flag\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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.quality_measures.summary_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.803704Z", "completed_at": "2024-02-20T20:47:52.806206Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.807053Z", "completed_at": "2024-02-20T20:47:52.807056Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.0047032833099365234, "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 raw.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-02-20T20:47:52.807834Z", "completed_at": "2024-02-20T20:47:52.815344Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.815761Z", "completed_at": "2024-02-20T20:47:52.815765Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.009353876113891602, "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 raw.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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.quality_measures.summary_counts"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.811912Z", "completed_at": "2024-02-20T20:47:52.816339Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.816748Z", "completed_at": "2024-02-20T20:47:52.816750Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.00562596321105957, "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 raw.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, nqf_0034 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0034'\n\n)\n, joined as (\n\n select\n measures_long.patient_id\n , nqf_2372.performance_flag as nqf_2372\n , nqf_0034.performance_flag as nqf_0034\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\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 from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "raw.quality_measures.summary_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:52.168129Z", "completed_at": "2024-02-20T20:47:52.918746Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:52.919138Z", "completed_at": "2024-02-20T20:47:52.919141Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.8930461406707764, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__tuva_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), condition_columns as (\n\n select distinct\n condition\n , condition_column_name\n from raw.chronic_conditions._value_set_tuva_chronic_conditions_hierarchy\n\n)\n\nselect\n p.patient_id\n , \n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'ALCOHOL'\n then 1\n else 0\n end\n )\n \n \n as alcohol\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'AMYOTROPHIC_LATERAL_SCLEROSIS'\n then 1\n else 0\n end\n )\n \n \n as amyotrophic_lateral_sclerosis\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ANXIETY'\n then 1\n else 0\n end\n )\n \n \n as anxiety\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'ATHEROSCLEROSIS'\n then 1\n else 0\n end\n )\n \n \n as atherosclerosis\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ATRIAL_FIBRILLATION'\n then 1\n else 0\n end\n )\n \n \n as atrial_fibrillation\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ATTENTION_DEFICIT_HYPERACTIVITY_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as attention_deficit_hyperactivity_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'BIPOLAR'\n then 1\n else 0\n end\n )\n \n \n as bipolar\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'BREAST_CANCER'\n then 1\n else 0\n end\n )\n \n \n as breast_cancer\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.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 cc.condition_column_name = 'COCAINE'\n then 1\n else 0\n end\n )\n \n \n as cocaine\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'COLORECTAL_CANCER'\n then 1\n else 0\n end\n )\n \n \n as colorectal_cancer\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'CROHNS_DISEASE'\n then 1\n else 0\n end\n )\n \n \n as crohns_disease\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'CYSTIC_FIBROSIS'\n then 1\n else 0\n end\n )\n \n \n as cystic_fibrosis\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'DEMENTIA'\n then 1\n else 0\n end\n )\n \n \n as dementia\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'DEPRESSION'\n then 1\n else 0\n end\n )\n \n \n as depression\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'HEART_FAILURE'\n then 1\n else 0\n end\n )\n \n \n as heart_failure\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.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 cc.condition_column_name = 'LUNG_CANCER'\n then 1\n else 0\n end\n )\n \n \n as lung_cancer\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'LUPUS'\n then 1\n else 0\n end\n )\n \n \n as lupus\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'METABOLIC_SYNDROME'\n then 1\n else 0\n end\n )\n \n \n as metabolic_syndrome\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'MULTIPLE_SCLEROSIS'\n then 1\n else 0\n end\n )\n \n \n as multiple_sclerosis\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.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 cc.condition_column_name = 'OBSESSIVE_COMPULSIVE_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as obsessive_compulsive_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'OPIOID'\n then 1\n else 0\n end\n )\n \n \n as opioid\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'PARKINSONS_DISEASE'\n then 1\n else 0\n end\n )\n \n \n as parkinsons_disease\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'PERSONALITY_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as personality_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'POST_TRAUMATIC_STRESS_DISORDER'\n then 1\n else 0\n end\n )\n \n \n as post_traumatic_stress_disorder\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'RHEUMATOID_ARTHRITIS'\n then 1\n else 0\n end\n )\n \n \n as rheumatoid_arthritis\n \n \n ,\n \n max(\n \n case\n when cc.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 cc.condition_column_name = 'STROKE'\n then 1\n else 0\n end\n )\n \n \n as stroke\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'TOBACCO'\n then 1\n else 0\n end\n )\n \n \n as tobacco\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'TYPE_1_DIABETES'\n then 1\n else 0\n end\n )\n \n \n as type_1_diabetes\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'TYPE_2_DIABETES'\n then 1\n else 0\n end\n )\n \n \n as type_2_diabetes\n \n \n ,\n \n max(\n \n case\n when cc.condition_column_name = 'ULCERATIVE_COLITIS'\n then 1\n else 0\n end\n )\n \n \n as ulcerative_colitis\n \n \n \n \n\n , '2024-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom __dbt__cte__tuva_chronic_conditions__stg_core__patient p\n left join raw.chronic_conditions.tuva_chronic_conditions_long l\n on p.patient_id = l.patient_id\n left join condition_columns cc\n on l.condition = cc.condition\ngroup by\n p.patient_id", "relation_name": "raw.chronic_conditions.tuva_chronic_conditions_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:53.070010Z", "completed_at": "2024-02-20T20:47:53.075035Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:53.076416Z", "completed_at": "2024-02-20T20:47:53.076421Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.015494108200073242, "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 raw.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-02-20T20:47:53.064805Z", "completed_at": "2024-02-20T20:47:53.075421Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:53.076778Z", "completed_at": "2024-02-20T20:47:53.076780Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.0169069766998291, "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 raw.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-02-20T20:47:52.696959Z", "completed_at": "2024-02-20T20:47:53.342357Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:53.342737Z", "completed_at": "2024-02-20T20:47:53.342740Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.965944766998291, "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-02-20 20:47:44.615990+00:00' as tuva_last_run\nfrom raw.core.patient\n), chronic_conditions as (\n\n select distinct\n condition\n , condition_column_name\n from raw.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 raw.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-02-20 20:47:44.615990+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": "raw.chronic_conditions.cms_chronic_conditions_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-20T20:47:53.668455Z", "completed_at": "2024-02-20T20:47:53.680129Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:53.681535Z", "completed_at": "2024-02-20T20:47:53.681544Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.017112016677856445, "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 raw.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-02-20T20:47:53.675260Z", "completed_at": "2024-02-20T20:47:53.680459Z"}, {"name": "execute", "started_at": "2024-02-20T20:47:53.682212Z", "completed_at": "2024-02-20T20:47:53.682216Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.016711950302124023, "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 raw.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}], "elapsed_time": 8.646313905715942, "args": {"use_colors_file": true, "log_format_file": "debug", "invocation_command": "dbt docs generate", "strict_mode": false, "partial_parse_file_diff": true, "favor_state": false, "project_dir": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/docs_generate", "version_check": true, "macro_debugging": false, "use_colors": true, "log_level": "info", "partial_parse": true, "show_resource_report": false, "populate_cache": true, "cache_selected_only": false, "select": [], "send_anonymous_usage_stats": true, "static": false, "quiet": false, "static_parser": true, "exclude": [], "log_file_max_bytes": 10485760, "write_json": true, "compile": true, "vars": {}, "warn_error_options": {"include": [], "exclude": []}, "log_format": "default", "enable_legacy_logger": false, "profiles_dir": "/Users/tomsherwood/.dbt", "printer_width": 80, "which": "generate", "empty_catalog": false, "defer": false, "log_path": "/Users/tomsherwood/Documents/01-Projects/tuva-onboarding/tuva/integration_tests/docs_generate/../logs", "print": true, "introspect": true, "log_level_file": "debug", "indirect_selection": "eager"}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v4.json", "dbt_version": "1.4.9", "generated_at": "2024-02-21T19:58:37.337997Z", "invocation_id": "3b251ac3-6e0f-4d2f-8097-c3e7333acc05", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.591783Z", "completed_at": "2024-02-21T19:58:31.662745Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.663084Z", "completed_at": "2024-02-21T19:58:31.663093Z"}], "thread_id": "Thread-1", "execution_time": 0.07355523109436035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.598916Z", "completed_at": "2024-02-21T19:58:31.665016Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.672361Z", "completed_at": "2024-02-21T19:58:31.672368Z"}], "thread_id": "Thread-2", "execution_time": 0.0825340747833252, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.650096Z", "completed_at": "2024-02-21T19:58:31.665249Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.672509Z", "completed_at": "2024-02-21T19:58:31.672512Z"}], "thread_id": "Thread-3", "execution_time": 0.08260703086853027, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.658064Z", "completed_at": "2024-02-21T19:58:31.665337Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.672624Z", "completed_at": "2024-02-21T19:58:31.672627Z"}], "thread_id": "Thread-4", "execution_time": 0.08243298530578613, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.665561Z", "completed_at": "2024-02-21T19:58:31.673092Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.674989Z", "completed_at": "2024-02-21T19:58:31.674993Z"}], "thread_id": "Thread-1", "execution_time": 0.011206865310668945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.676297Z", "completed_at": "2024-02-21T19:58:31.696223Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.696894Z", "completed_at": "2024-02-21T19:58:31.696901Z"}], "thread_id": "Thread-2", "execution_time": 0.022716999053955078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.683035Z", "completed_at": "2024-02-21T19:58:31.696336Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.697075Z", "completed_at": "2024-02-21T19:58:31.697078Z"}], "thread_id": "Thread-3", "execution_time": 0.02270984649658203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.687565Z", "completed_at": "2024-02-21T19:58:31.696420Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.697159Z", "completed_at": "2024-02-21T19:58:31.697161Z"}], "thread_id": "Thread-4", "execution_time": 0.022768020629882812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.691291Z", "completed_at": "2024-02-21T19:58:31.696622Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.697561Z", "completed_at": "2024-02-21T19:58:31.697564Z"}], "thread_id": "Thread-1", "execution_time": 0.007938861846923828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.706852Z", "completed_at": "2024-02-21T19:58:31.707851Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.711055Z", "completed_at": "2024-02-21T19:58:31.711063Z"}], "thread_id": "Thread-3", "execution_time": 0.011698007583618164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.eligibility_seed"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.707985Z", "completed_at": "2024-02-21T19:58:31.709513Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.711240Z", "completed_at": "2024-02-21T19:58:31.711243Z"}], "thread_id": "Thread-4", "execution_time": 0.011816263198852539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.lab_result_seed"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.709682Z", "completed_at": "2024-02-21T19:58:31.710485Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.711322Z", "completed_at": "2024-02-21T19:58:31.711325Z"}], "thread_id": "Thread-1", "execution_time": 0.011809110641479492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.medical_claim_seed"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.700919Z", "completed_at": "2024-02-21T19:58:31.710757Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.711739Z", "completed_at": "2024-02-21T19:58:31.711741Z"}], "thread_id": "Thread-2", "execution_time": 0.013451099395751953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.715272Z", "completed_at": "2024-02-21T19:58:31.716392Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.721066Z", "completed_at": "2024-02-21T19:58:31.721075Z"}], "thread_id": "Thread-3", "execution_time": 0.008236885070800781, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.pharmacy_claim_seed"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.716712Z", "completed_at": "2024-02-21T19:58:31.717660Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.721327Z", "completed_at": "2024-02-21T19:58:31.721331Z"}], "thread_id": "Thread-4", "execution_time": 0.008113861083984375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.717829Z", "completed_at": "2024-02-21T19:58:31.718803Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.721423Z", "completed_at": "2024-02-21T19:58:31.721428Z"}], "thread_id": "Thread-1", "execution_time": 0.008287906646728516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.719129Z", "completed_at": "2024-02-21T19:58:31.720072Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.721930Z", "completed_at": "2024-02-21T19:58:31.721934Z"}], "thread_id": "Thread-2", "execution_time": 0.008555173873901367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.725639Z", "completed_at": "2024-02-21T19:58:31.727365Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.732896Z", "completed_at": "2024-02-21T19:58:31.732903Z"}], "thread_id": "Thread-3", "execution_time": 0.009479999542236328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.727744Z", "completed_at": "2024-02-21T19:58:31.728674Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.733090Z", "completed_at": "2024-02-21T19:58:31.733093Z"}], "thread_id": "Thread-4", "execution_time": 0.009353876113891602, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.728812Z", "completed_at": "2024-02-21T19:58:31.730981Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.733180Z", "completed_at": "2024-02-21T19:58:31.733182Z"}], "thread_id": "Thread-1", "execution_time": 0.009348154067993164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__adjustment_rates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.731613Z", "completed_at": "2024-02-21T19:58:31.732532Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.733639Z", "completed_at": "2024-02-21T19:58:31.733642Z"}], "thread_id": "Thread-2", "execution_time": 0.009387016296386719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__cpt_hcpcs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.736833Z", "completed_at": "2024-02-21T19:58:31.737938Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.741503Z", "completed_at": "2024-02-21T19:58:31.741512Z"}], "thread_id": "Thread-3", "execution_time": 0.006798982620239258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__demographic_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.738228Z", "completed_at": "2024-02-21T19:58:31.739034Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.741694Z", "completed_at": "2024-02-21T19:58:31.741697Z"}], "thread_id": "Thread-4", "execution_time": 0.006897926330566406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disabled_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.739198Z", "completed_at": "2024-02-21T19:58:31.740049Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.741779Z", "completed_at": "2024-02-21T19:58:31.741781Z"}], "thread_id": "Thread-1", "execution_time": 0.006867885589599609, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disease_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.740308Z", "completed_at": "2024-02-21T19:58:31.741172Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.742333Z", "completed_at": "2024-02-21T19:58:31.742337Z"}], "thread_id": "Thread-2", "execution_time": 0.006978034973144531, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disease_hierarchy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.745576Z", "completed_at": "2024-02-21T19:58:31.746632Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.752188Z", "completed_at": "2024-02-21T19:58:31.752198Z"}], "thread_id": "Thread-3", "execution_time": 0.00911092758178711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disease_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.747089Z", "completed_at": "2024-02-21T19:58:31.749161Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.752450Z", "completed_at": "2024-02-21T19:58:31.752454Z"}], "thread_id": "Thread-4", "execution_time": 0.009549856185913086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.749406Z", "completed_at": "2024-02-21T19:58:31.750311Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.752716Z", "completed_at": "2024-02-21T19:58:31.752723Z"}], "thread_id": "Thread-1", "execution_time": 0.009788036346435547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.750620Z", "completed_at": "2024-02-21T19:58:31.751647Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.753407Z", "completed_at": "2024-02-21T19:58:31.753413Z"}], "thread_id": "Thread-2", "execution_time": 0.010274171829223633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.757786Z", "completed_at": "2024-02-21T19:58:31.759465Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.763063Z", "completed_at": "2024-02-21T19:58:31.763075Z"}], "thread_id": "Thread-3", "execution_time": 0.007905006408691406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__test_catalog"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.759895Z", "completed_at": "2024-02-21T19:58:31.760771Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.763490Z", "completed_at": "2024-02-21T19:58:31.763495Z"}], "thread_id": "Thread-4", "execution_time": 0.007962226867675781, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__categories"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.760896Z", "completed_at": "2024-02-21T19:58:31.761704Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.763594Z", "completed_at": "2024-02-21T19:58:31.763597Z"}], "thread_id": "Thread-1", "execution_time": 0.007874011993408203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.761933Z", "completed_at": "2024-02-21T19:58:31.762717Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.764176Z", "completed_at": "2024-02-21T19:58:31.764180Z"}], "thread_id": "Thread-2", "execution_time": 0.008047819137573242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd10"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.768112Z", "completed_at": "2024-02-21T19:58:31.769451Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.774817Z", "completed_at": "2024-02-21T19:58:31.774825Z"}], "thread_id": "Thread-3", "execution_time": 0.009286880493164062, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd9"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.769780Z", "completed_at": "2024-02-21T19:58:31.772025Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.775075Z", "completed_at": "2024-02-21T19:58:31.775079Z"}], "thread_id": "Thread-4", "execution_time": 0.008999824523925781, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.772280Z", "completed_at": "2024-02-21T19:58:31.773119Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.775173Z", "completed_at": "2024-02-21T19:58:31.775176Z"}], "thread_id": "Thread-1", "execution_time": 0.008972883224487305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.773457Z", "completed_at": "2024-02-21T19:58:31.774361Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.775634Z", "completed_at": "2024-02-21T19:58:31.775637Z"}], "thread_id": "Thread-2", "execution_time": 0.009005069732666016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.quality_measures__concepts"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.778999Z", "completed_at": "2024-02-21T19:58:31.780132Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.783815Z", "completed_at": "2024-02-21T19:58:31.783823Z"}], "thread_id": "Thread-3", "execution_time": 0.007005214691162109, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.quality_measures__measures"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.780402Z", "completed_at": "2024-02-21T19:58:31.781288Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.784047Z", "completed_at": "2024-02-21T19:58:31.784051Z"}], "thread_id": "Thread-4", "execution_time": 0.007071971893310547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.quality_measures__value_sets"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.781412Z", "completed_at": "2024-02-21T19:58:31.782333Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.784162Z", "completed_at": "2024-02-21T19:58:31.784165Z"}], "thread_id": "Thread-1", "execution_time": 0.00701904296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.782625Z", "completed_at": "2024-02-21T19:58:31.783443Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.784687Z", "completed_at": "2024-02-21T19:58:31.784691Z"}], "thread_id": "Thread-2", "execution_time": 0.007296085357666016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.788712Z", "completed_at": "2024-02-21T19:58:31.791070Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.795186Z", "completed_at": "2024-02-21T19:58:31.795195Z"}], "thread_id": "Thread-3", "execution_time": 0.009432077407836914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.791462Z", "completed_at": "2024-02-21T19:58:31.792452Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.795428Z", "completed_at": "2024-02-21T19:58:31.795431Z"}], "thread_id": "Thread-4", "execution_time": 0.009015083312988281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.792717Z", "completed_at": "2024-02-21T19:58:31.793645Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.795520Z", "completed_at": "2024-02-21T19:58:31.795522Z"}], "thread_id": "Thread-1", "execution_time": 0.008949041366577148, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.793940Z", "completed_at": "2024-02-21T19:58:31.794806Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.796046Z", "completed_at": "2024-02-21T19:58:31.796049Z"}], "thread_id": "Thread-2", "execution_time": 0.009196996688842773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.799361Z", "completed_at": "2024-02-21T19:58:31.800933Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.804767Z", "completed_at": "2024-02-21T19:58:31.804775Z"}], "thread_id": "Thread-3", "execution_time": 0.007568836212158203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.801331Z", "completed_at": "2024-02-21T19:58:31.802358Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.804951Z", "completed_at": "2024-02-21T19:58:31.804954Z"}], "thread_id": "Thread-4", "execution_time": 0.007537841796875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.802498Z", "completed_at": "2024-02-21T19:58:31.803345Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.805036Z", "completed_at": "2024-02-21T19:58:31.805039Z"}], "thread_id": "Thread-1", "execution_time": 0.007569074630737305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.803595Z", "completed_at": "2024-02-21T19:58:31.804444Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.805555Z", "completed_at": "2024-02-21T19:58:31.805559Z"}], "thread_id": "Thread-2", "execution_time": 0.007841110229492188, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__specialty_cohort"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.809098Z", "completed_at": "2024-02-21T19:58:31.811687Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.814894Z", "completed_at": "2024-02-21T19:58:31.814901Z"}], "thread_id": "Thread-3", "execution_time": 0.008069038391113281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__surgery_gynecology_cohort"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.812001Z", "completed_at": "2024-02-21T19:58:31.812781Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.815071Z", "completed_at": "2024-02-21T19:58:31.815074Z"}], "thread_id": "Thread-4", "execution_time": 0.007790088653564453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.service_category__service_categories"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.812885Z", "completed_at": "2024-02-21T19:58:31.813632Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.815151Z", "completed_at": "2024-02-21T19:58:31.815153Z"}], "thread_id": "Thread-1", "execution_time": 0.007781267166137695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__admit_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.813853Z", "completed_at": "2024-02-21T19:58:31.814607Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.815551Z", "completed_at": "2024-02-21T19:58:31.815554Z"}], "thread_id": "Thread-2", "execution_time": 0.007813692092895508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__admit_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.818645Z", "completed_at": "2024-02-21T19:58:31.819477Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.823383Z", "completed_at": "2024-02-21T19:58:31.823387Z"}], "thread_id": "Thread-3", "execution_time": 0.006676912307739258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ansi_fips_state"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.819673Z", "completed_at": "2024-02-21T19:58:31.820467Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.823559Z", "completed_at": "2024-02-21T19:58:31.823562Z"}], "thread_id": "Thread-4", "execution_time": 0.0066449642181396484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__apr_drg"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.820563Z", "completed_at": "2024-02-21T19:58:31.821284Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.823641Z", "completed_at": "2024-02-21T19:58:31.823644Z"}], "thread_id": "Thread-1", "execution_time": 0.006596088409423828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__bill_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.821478Z", "completed_at": "2024-02-21T19:58:31.823095Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.824020Z", "completed_at": "2024-02-21T19:58:31.824023Z"}], "thread_id": "Thread-2", "execution_time": 0.006669759750366211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__calendar"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.827088Z", "completed_at": "2024-02-21T19:58:31.828059Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.831102Z", "completed_at": "2024-02-21T19:58:31.831108Z"}], "thread_id": "Thread-3", "execution_time": 0.005949974060058594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.828272Z", "completed_at": "2024-02-21T19:58:31.829041Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.831282Z", "completed_at": "2024-02-21T19:58:31.831285Z"}], "thread_id": "Thread-4", "execution_time": 0.005947113037109375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.829131Z", "completed_at": "2024-02-21T19:58:31.829864Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.831366Z", "completed_at": "2024-02-21T19:58:31.831369Z"}], "thread_id": "Thread-1", "execution_time": 0.005933046340942383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__discharge_disposition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.830058Z", "completed_at": "2024-02-21T19:58:31.830815Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.831750Z", "completed_at": "2024-02-21T19:58:31.831753Z"}], "thread_id": "Thread-2", "execution_time": 0.00619196891784668, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__encounter_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.834905Z", "completed_at": "2024-02-21T19:58:31.835766Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.841177Z", "completed_at": "2024-02-21T19:58:31.841186Z"}], "thread_id": "Thread-3", "execution_time": 0.008277177810668945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ethnicity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.835954Z", "completed_at": "2024-02-21T19:58:31.836686Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.841371Z", "completed_at": "2024-02-21T19:58:31.841374Z"}], "thread_id": "Thread-4", "execution_time": 0.008216142654418945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__fips_county"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.836781Z", "completed_at": "2024-02-21T19:58:31.837533Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.841457Z", "completed_at": "2024-02-21T19:58:31.841459Z"}], "thread_id": "Thread-1", "execution_time": 0.008229255676269531, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__gender"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.837725Z", "completed_at": "2024-02-21T19:58:31.840736Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.841896Z", "completed_at": "2024-02-21T19:58:31.841899Z"}], "thread_id": "Thread-2", "execution_time": 0.008316993713378906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__hcpcs_level_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.845192Z", "completed_at": "2024-02-21T19:58:31.846099Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.849409Z", "completed_at": "2024-02-21T19:58:31.849415Z"}], "thread_id": "Thread-3", "execution_time": 0.006354808807373047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_10_cm"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.846299Z", "completed_at": "2024-02-21T19:58:31.847091Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.849618Z", "completed_at": "2024-02-21T19:58:31.849622Z"}], "thread_id": "Thread-4", "execution_time": 0.006232023239135742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_10_pcs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.847223Z", "completed_at": "2024-02-21T19:58:31.848016Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.849706Z", "completed_at": "2024-02-21T19:58:31.849709Z"}], "thread_id": "Thread-1", "execution_time": 0.0061719417572021484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_9_cm"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.848251Z", "completed_at": "2024-02-21T19:58:31.849096Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.850114Z", "completed_at": "2024-02-21T19:58:31.850117Z"}], "thread_id": "Thread-2", "execution_time": 0.006237030029296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_9_pcs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.853160Z", "completed_at": "2024-02-21T19:58:31.854149Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.858004Z", "completed_at": "2024-02-21T19:58:31.858009Z"}], "thread_id": "Thread-3", "execution_time": 0.006811857223510742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__loinc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.854353Z", "completed_at": "2024-02-21T19:58:31.855097Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.858182Z", "completed_at": "2024-02-21T19:58:31.858185Z"}], "thread_id": "Thread-4", "execution_time": 0.006776094436645508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__loinc_deprecated_mapping"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.855191Z", "completed_at": "2024-02-21T19:58:31.856820Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.858265Z", "completed_at": "2024-02-21T19:58:31.858268Z"}], "thread_id": "Thread-1", "execution_time": 0.0067288875579833984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__mdc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.857015Z", "completed_at": "2024-02-21T19:58:31.857726Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.858644Z", "completed_at": "2024-02-21T19:58:31.858646Z"}], "thread_id": "Thread-2", "execution_time": 0.006988048553466797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__medicare_dual_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.861749Z", "completed_at": "2024-02-21T19:58:31.862662Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.865795Z", "completed_at": "2024-02-21T19:58:31.865800Z"}], "thread_id": "Thread-3", "execution_time": 0.0059967041015625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__medicare_orec"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.862856Z", "completed_at": "2024-02-21T19:58:31.863587Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.865978Z", "completed_at": "2024-02-21T19:58:31.865981Z"}], "thread_id": "Thread-4", "execution_time": 0.0059549808502197266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__medicare_status"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.863676Z", "completed_at": "2024-02-21T19:58:31.864421Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.866060Z", "completed_at": "2024-02-21T19:58:31.866063Z"}], "thread_id": "Thread-1", "execution_time": 0.006006002426147461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ms_drg"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.864691Z", "completed_at": "2024-02-21T19:58:31.865493Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.866500Z", "completed_at": "2024-02-21T19:58:31.866503Z"}], "thread_id": "Thread-2", "execution_time": 0.006098747253417969, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ndc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.869492Z", "completed_at": "2024-02-21T19:58:31.870370Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.874326Z", "completed_at": "2024-02-21T19:58:31.874330Z"}], "thread_id": "Thread-3", "execution_time": 0.0067059993743896484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__other_provider_taxonomy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.870568Z", "completed_at": "2024-02-21T19:58:31.871342Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.874501Z", "completed_at": "2024-02-21T19:58:31.874504Z"}], "thread_id": "Thread-4", "execution_time": 0.006777048110961914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__payer_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.871436Z", "completed_at": "2024-02-21T19:58:31.873074Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.874584Z", "completed_at": "2024-02-21T19:58:31.874586Z"}], "thread_id": "Thread-1", "execution_time": 0.006752967834472656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__place_of_service"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.873282Z", "completed_at": "2024-02-21T19:58:31.874046Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.874953Z", "completed_at": "2024-02-21T19:58:31.874956Z"}], "thread_id": "Thread-2", "execution_time": 0.006847858428955078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__present_on_admission"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.877958Z", "completed_at": "2024-02-21T19:58:31.878807Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.882649Z", "completed_at": "2024-02-21T19:58:31.882656Z"}], "thread_id": "Thread-3", "execution_time": 0.0066030025482177734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__provider"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.879004Z", "completed_at": "2024-02-21T19:58:31.879783Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.882828Z", "completed_at": "2024-02-21T19:58:31.882831Z"}], "thread_id": "Thread-4", "execution_time": 0.006622791290283203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__race"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.879876Z", "completed_at": "2024-02-21T19:58:31.880919Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.882910Z", "completed_at": "2024-02-21T19:58:31.882912Z"}], "thread_id": "Thread-1", "execution_time": 0.006591081619262695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__revenue_center"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.881418Z", "completed_at": "2024-02-21T19:58:31.882306Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.883344Z", "completed_at": "2024-02-21T19:58:31.883347Z"}], "thread_id": "Thread-2", "execution_time": 0.006694793701171875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__rxnorm_to_atc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.886330Z", "completed_at": "2024-02-21T19:58:31.887308Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.905506Z", "completed_at": "2024-02-21T19:58:31.905514Z"}], "thread_id": "Thread-3", "execution_time": 0.021142959594726562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__snomed_icd_10_map"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.887510Z", "completed_at": "2024-02-21T19:58:31.888274Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.905695Z", "completed_at": "2024-02-21T19:58:31.905700Z"}], "thread_id": "Thread-4", "execution_time": 0.02109813690185547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ssa_fips_state"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.896403Z", "completed_at": "2024-02-21T19:58:31.906485Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.908029Z", "completed_at": "2024-02-21T19:58:31.908034Z"}], "thread_id": "Thread-2", "execution_time": 0.02262091636657715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.888378Z", "completed_at": "2024-02-21T19:58:31.906742Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.908215Z", "completed_at": "2024-02-21T19:58:31.908218Z"}], "thread_id": "Thread-1", "execution_time": 0.03173089027404785, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.908668Z", "completed_at": "2024-02-21T19:58:31.925925Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.943335Z", "completed_at": "2024-02-21T19:58:31.943343Z"}], "thread_id": "Thread-3", "execution_time": 0.03645181655883789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.917471Z", "completed_at": "2024-02-21T19:58:31.926014Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.943457Z", "completed_at": "2024-02-21T19:58:31.943460Z"}], "thread_id": "Thread-4", "execution_time": 0.036544084548950195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.926226Z", "completed_at": "2024-02-21T19:58:31.944033Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.945522Z", "completed_at": "2024-02-21T19:58:31.945526Z"}], "thread_id": "Thread-2", "execution_time": 0.020978927612304688, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.936062Z", "completed_at": "2024-02-21T19:58:31.944881Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.946363Z", "completed_at": "2024-02-21T19:58:31.946367Z"}], "thread_id": "Thread-1", "execution_time": 0.027623891830444336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.946571Z", "completed_at": "2024-02-21T19:58:31.958224Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.966465Z", "completed_at": "2024-02-21T19:58:31.966471Z"}], "thread_id": "Thread-3", "execution_time": 0.0231170654296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.953432Z", "completed_at": "2024-02-21T19:58:31.958798Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.968082Z", "completed_at": "2024-02-21T19:58:31.968087Z"}], "thread_id": "Thread-4", "execution_time": 0.022995948791503906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.958996Z", "completed_at": "2024-02-21T19:58:31.968858Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.970195Z", "completed_at": "2024-02-21T19:58:31.970198Z"}], "thread_id": "Thread-2", "execution_time": 0.012995004653930664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.966599Z", "completed_at": "2024-02-21T19:58:31.969342Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.970477Z", "completed_at": "2024-02-21T19:58:31.970480Z"}], "thread_id": "Thread-1", "execution_time": 0.016241788864135742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.970854Z", "completed_at": "2024-02-21T19:58:31.976184Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.984090Z", "completed_at": "2024-02-21T19:58:31.984099Z"}], "thread_id": "Thread-3", "execution_time": 0.015000104904174805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.973172Z", "completed_at": "2024-02-21T19:58:31.976290Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.984219Z", "completed_at": "2024-02-21T19:58:31.984224Z"}], "thread_id": "Thread-4", "execution_time": 0.015084981918334961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.976922Z", "completed_at": "2024-02-21T19:58:31.985508Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.986891Z", "completed_at": "2024-02-21T19:58:31.986897Z"}], "thread_id": "Thread-2", "execution_time": 0.018613100051879883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__dx_vertical_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.981241Z", "completed_at": "2024-02-21T19:58:31.985722Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:31.987109Z", "completed_at": "2024-02-21T19:58:31.987115Z"}], "thread_id": "Thread-1", "execution_time": 0.02349090576171875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__procedure_category_map"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.987224Z", "completed_at": "2024-02-21T19:58:32.000973Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.006496Z", "completed_at": "2024-02-21T19:58:32.006504Z"}], "thread_id": "Thread-3", "execution_time": 0.021064281463623047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:31.994429Z", "completed_at": "2024-02-21T19:58:32.001219Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.006654Z", "completed_at": "2024-02-21T19:58:32.006657Z"}], "thread_id": "Thread-4", "execution_time": 0.021065950393676758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.001510Z", "completed_at": "2024-02-21T19:58:32.007163Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.008632Z", "completed_at": "2024-02-21T19:58:32.008636Z"}], "thread_id": "Thread-2", "execution_time": 0.008900880813598633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.004343Z", "completed_at": "2024-02-21T19:58:32.007732Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.009061Z", "completed_at": "2024-02-21T19:58:32.009064Z"}], "thread_id": "Thread-1", "execution_time": 0.014982938766479492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.009529Z", "completed_at": "2024-02-21T19:58:32.023144Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.030391Z", "completed_at": "2024-02-21T19:58:32.030399Z"}], "thread_id": "Thread-3", "execution_time": 0.022626876831054688, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.016152Z", "completed_at": "2024-02-21T19:58:32.023467Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.030595Z", "completed_at": "2024-02-21T19:58:32.030599Z"}], "thread_id": "Thread-4", "execution_time": 0.02251267433166504, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.023663Z", "completed_at": "2024-02-21T19:58:32.031735Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.032934Z", "completed_at": "2024-02-21T19:58:32.032939Z"}], "thread_id": "Thread-2", "execution_time": 0.01293802261352539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.028411Z", "completed_at": "2024-02-21T19:58:32.031823Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.033036Z", "completed_at": "2024-02-21T19:58:32.033040Z"}], "thread_id": "Thread-1", "execution_time": 0.012876749038696289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.033236Z", "completed_at": "2024-02-21T19:58:32.038428Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.039452Z", "completed_at": "2024-02-21T19:58:32.039457Z"}], "thread_id": "Thread-3", "execution_time": 0.013010025024414062, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.035927Z", "completed_at": "2024-02-21T19:58:32.039168Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.045311Z", "completed_at": "2024-02-21T19:58:32.045317Z"}], "thread_id": "Thread-4", "execution_time": 0.013485193252563477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.047881Z", "completed_at": "2024-02-21T19:58:32.054529Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.059983Z", "completed_at": "2024-02-21T19:58:32.059992Z"}], "thread_id": "Thread-3", "execution_time": 0.014513731002807617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.medical_claim_expanded"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.097434Z", "completed_at": "2024-02-21T19:58:32.115657Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.117246Z", "completed_at": "2024-02-21T19:58:32.117251Z"}], "thread_id": "Thread-2", "execution_time": 0.04308295249938965, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.104822Z", "completed_at": "2024-02-21T19:58:32.116939Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.127838Z", "completed_at": "2024-02-21T19:58:32.127843Z"}], "thread_id": "Thread-1", "execution_time": 0.049508094787597656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.117689Z", "completed_at": "2024-02-21T19:58:32.140902Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.152064Z", "completed_at": "2024-02-21T19:58:32.152072Z"}], "thread_id": "Thread-4", "execution_time": 0.036441802978515625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.128288Z", "completed_at": "2024-02-21T19:58:32.147843Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.164997Z", "completed_at": "2024-02-21T19:58:32.165015Z"}], "thread_id": "Thread-3", "execution_time": 0.07451009750366211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.141990Z", "completed_at": "2024-02-21T19:58:32.177920Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.192925Z", "completed_at": "2024-02-21T19:58:32.192931Z"}], "thread_id": "Thread-2", "execution_time": 0.06379914283752441, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.152872Z", "completed_at": "2024-02-21T19:58:32.193361Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.213835Z", "completed_at": "2024-02-21T19:58:32.213845Z"}], "thread_id": "Thread-1", "execution_time": 0.07292795181274414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.193437Z", "completed_at": "2024-02-21T19:58:32.214332Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.222190Z", "completed_at": "2024-02-21T19:58:32.222197Z"}], "thread_id": "Thread-4", "execution_time": 0.030915021896362305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.205113Z", "completed_at": "2024-02-21T19:58:32.221558Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.223237Z", "completed_at": "2024-02-21T19:58:32.223241Z"}], "thread_id": "Thread-3", "execution_time": 0.040407657623291016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.215396Z", "completed_at": "2024-02-21T19:58:32.223318Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.234276Z", "completed_at": "2024-02-21T19:58:32.234281Z"}], "thread_id": "Thread-2", "execution_time": 0.021101713180541992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_medical_npi_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.223662Z", "completed_at": "2024-02-21T19:58:32.234636Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.240381Z", "completed_at": "2024-02-21T19:58:32.240388Z"}], "thread_id": "Thread-1", "execution_time": 0.05170297622680664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.235226Z", "completed_at": "2024-02-21T19:58:32.259307Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.287366Z", "completed_at": "2024-02-21T19:58:32.287378Z"}], "thread_id": "Thread-4", "execution_time": 0.07879090309143066, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_place_of_service_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.240521Z", "completed_at": "2024-02-21T19:58:32.293719Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.313952Z", "completed_at": "2024-02-21T19:58:32.313958Z"}], "thread_id": "Thread-3", "execution_time": 0.11379003524780273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.274757Z", "completed_at": "2024-02-21T19:58:32.331607Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.349202Z", "completed_at": "2024-02-21T19:58:32.349208Z"}], "thread_id": "Thread-2", "execution_time": 0.10211896896362305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.314095Z", "completed_at": "2024-02-21T19:58:32.354844Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.378964Z", "completed_at": "2024-02-21T19:58:32.378973Z"}], "thread_id": "Thread-1", "execution_time": 0.08720707893371582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.349492Z", "completed_at": "2024-02-21T19:58:32.355403Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.381501Z", "completed_at": "2024-02-21T19:58:32.381506Z"}], "thread_id": "Thread-4", "execution_time": 0.0656590461730957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_revenue_center_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.355535Z", "completed_at": "2024-02-21T19:58:32.397649Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.398987Z", "completed_at": "2024-02-21T19:58:32.398994Z"}], "thread_id": "Thread-3", "execution_time": 0.058114051818847656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_undetermined_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.381602Z", "completed_at": "2024-02-21T19:58:32.398558Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.412464Z", "completed_at": "2024-02-21T19:58:32.412469Z"}], "thread_id": "Thread-2", "execution_time": 0.043424129486083984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.399109Z", "completed_at": "2024-02-21T19:58:32.416865Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.418216Z", "completed_at": "2024-02-21T19:58:32.418221Z"}], "thread_id": "Thread-1", "execution_time": 0.028491735458374023, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ed_classification__int_map_primary_dx"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.412661Z", "completed_at": "2024-02-21T19:58:32.417645Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.426428Z", "completed_at": "2024-02-21T19:58:32.426433Z"}], "thread_id": "Thread-4", "execution_time": 0.032462120056152344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.418417Z", "completed_at": "2024-02-21T19:58:32.431283Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.432468Z", "completed_at": "2024-02-21T19:58:32.432474Z"}], "thread_id": "Thread-3", "execution_time": 0.019104957580566406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.426588Z", "completed_at": "2024-02-21T19:58:32.432035Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.436284Z", "completed_at": "2024-02-21T19:58:32.436289Z"}], "thread_id": "Thread-2", "execution_time": 0.03618192672729492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.432662Z", "completed_at": "2024-02-21T19:58:32.454437Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.455813Z", "completed_at": "2024-02-21T19:58:32.455818Z"}], "thread_id": "Thread-1", "execution_time": 0.027753114700317383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.436423Z", "completed_at": "2024-02-21T19:58:32.455459Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.459387Z", "completed_at": "2024-02-21T19:58:32.459392Z"}], "thread_id": "Thread-4", "execution_time": 0.030333280563354492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.455905Z", "completed_at": "2024-02-21T19:58:32.462317Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.463649Z", "completed_at": "2024-02-21T19:58:32.463653Z"}], "thread_id": "Thread-3", "execution_time": 0.012885093688964844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.459502Z", "completed_at": "2024-02-21T19:58:32.463539Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.467884Z", "completed_at": "2024-02-21T19:58:32.467889Z"}], "thread_id": "Thread-2", "execution_time": 0.016788244247436523, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.463977Z", "completed_at": "2024-02-21T19:58:32.472055Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.473290Z", "completed_at": "2024-02-21T19:58:32.473295Z"}], "thread_id": "Thread-1", "execution_time": 0.015209197998046875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.468278Z", "completed_at": "2024-02-21T19:58:32.473379Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.478745Z", "completed_at": "2024-02-21T19:58:32.478750Z"}], "thread_id": "Thread-4", "execution_time": 0.018330097198486328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.473714Z", "completed_at": "2024-02-21T19:58:32.481567Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.482813Z", "completed_at": "2024-02-21T19:58:32.482817Z"}], "thread_id": "Thread-3", "execution_time": 0.014362335205078125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.478865Z", "completed_at": "2024-02-21T19:58:32.482649Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.487168Z", "completed_at": "2024-02-21T19:58:32.487172Z"}], "thread_id": "Thread-2", "execution_time": 0.01690959930419922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.482905Z", "completed_at": "2024-02-21T19:58:32.490758Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.495203Z", "completed_at": "2024-02-21T19:58:32.495210Z"}], "thread_id": "Thread-1", "execution_time": 0.014115095138549805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_medical_date_aggregation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.487549Z", "completed_at": "2024-02-21T19:58:32.491316Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.495928Z", "completed_at": "2024-02-21T19:58:32.495931Z"}], "thread_id": "Thread-4", "execution_time": 0.013684988021850586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.491636Z", "completed_at": "2024-02-21T19:58:32.499661Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.501052Z", "completed_at": "2024-02-21T19:58:32.501057Z"}], "thread_id": "Thread-3", "execution_time": 0.016021728515625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.496034Z", "completed_at": "2024-02-21T19:58:32.500759Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.507811Z", "completed_at": "2024-02-21T19:58:32.507867Z"}], "thread_id": "Thread-2", "execution_time": 0.020723342895507812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.501518Z", "completed_at": "2024-02-21T19:58:32.512595Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.516717Z", "completed_at": "2024-02-21T19:58:32.516725Z"}], "thread_id": "Thread-1", "execution_time": 0.01710367202758789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.508527Z", "completed_at": "2024-02-21T19:58:32.513481Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.521538Z", "completed_at": "2024-02-21T19:58:32.521545Z"}], "thread_id": "Thread-4", "execution_time": 0.02115464210510254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_duplicates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.513560Z", "completed_at": "2024-02-21T19:58:32.521945Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.523260Z", "completed_at": "2024-02-21T19:58:32.523263Z"}], "thread_id": "Thread-3", "execution_time": 0.015495061874389648, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_line_numbers"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.517499Z", "completed_at": "2024-02-21T19:58:32.523072Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.528119Z", "completed_at": "2024-02-21T19:58:32.528125Z"}], "thread_id": "Thread-2", "execution_time": 0.01760101318359375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_claim_missing_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.523692Z", "completed_at": "2024-02-21T19:58:32.530978Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.532122Z", "completed_at": "2024-02-21T19:58:32.532127Z"}], "thread_id": "Thread-1", "execution_time": 0.013235092163085938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_pharmacy_header_fail_details"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.528550Z", "completed_at": "2024-02-21T19:58:32.532049Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.539768Z", "completed_at": "2024-02-21T19:58:32.539775Z"}], "thread_id": "Thread-4", "execution_time": 0.017172813415527344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.532218Z", "completed_at": "2024-02-21T19:58:32.540242Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.541609Z", "completed_at": "2024-02-21T19:58:32.541613Z"}], "thread_id": "Thread-3", "execution_time": 0.014075994491577148, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_overlap"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.535925Z", "completed_at": "2024-02-21T19:58:32.540970Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.544865Z", "completed_at": "2024-02-21T19:58:32.544871Z"}], "thread_id": "Thread-2", "execution_time": 0.013777017593383789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_with_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.541933Z", "completed_at": "2024-02-21T19:58:32.552035Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.553356Z", "completed_at": "2024-02-21T19:58:32.553363Z"}], "thread_id": "Thread-1", "execution_time": 0.019873857498168945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__index_discharge_requirement"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.547743Z", "completed_at": "2024-02-21T19:58:32.553154Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.560793Z", "completed_at": "2024-02-21T19:58:32.560799Z"}], "thread_id": "Thread-4", "execution_time": 0.01981186866760254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__index_time_requirement"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.563407Z", "completed_at": "2024-02-21T19:58:32.580235Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.580809Z", "completed_at": "2024-02-21T19:58:32.580817Z"}], "thread_id": "Thread-1", "execution_time": 0.019540786743164062, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_duplicates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.567709Z", "completed_at": "2024-02-21T19:58:32.580709Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.581545Z", "completed_at": "2024-02-21T19:58:32.581549Z"}], "thread_id": "Thread-4", "execution_time": 0.0190122127532959, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_invalid_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.576392Z", "completed_at": "2024-02-21T19:58:32.580900Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.581894Z", "completed_at": "2024-02-21T19:58:32.581897Z"}], "thread_id": "Thread-3", "execution_time": 0.0162351131439209, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_missing_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.583676Z", "completed_at": "2024-02-21T19:58:32.595083Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.595399Z", "completed_at": "2024-02-21T19:58:32.595407Z"}], "thread_id": "Thread-1", "execution_time": 0.013424158096313477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_plausibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.592428Z", "completed_at": "2024-02-21T19:58:32.596165Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.597365Z", "completed_at": "2024-02-21T19:58:32.597369Z"}], "thread_id": "Thread-3", "execution_time": 0.011271953582763672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.597457Z", "completed_at": "2024-02-21T19:58:32.603908Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.604540Z", "completed_at": "2024-02-21T19:58:32.604544Z"}], "thread_id": "Thread-1", "execution_time": 0.012368917465209961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.601157Z", "completed_at": "2024-02-21T19:58:32.604629Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.609210Z", "completed_at": "2024-02-21T19:58:32.609215Z"}], "thread_id": "Thread-4", "execution_time": 0.009603023529052734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.604697Z", "completed_at": "2024-02-21T19:58:32.609585Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.655078Z", "completed_at": "2024-02-21T19:58:32.655086Z"}], "thread_id": "Thread-3", "execution_time": 0.05193614959716797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.610381Z", "completed_at": "2024-02-21T19:58:32.660002Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.660754Z", "completed_at": "2024-02-21T19:58:32.660760Z"}], "thread_id": "Thread-1", "execution_time": 0.05571484565734863, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.656569Z", "completed_at": "2024-02-21T19:58:32.660841Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.665636Z", "completed_at": "2024-02-21T19:58:32.665641Z"}], "thread_id": "Thread-4", "execution_time": 0.010968923568725586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__readmission_crude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.661021Z", "completed_at": "2024-02-21T19:58:32.666298Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.670695Z", "completed_at": "2024-02-21T19:58:32.670705Z"}], "thread_id": "Thread-3", "execution_time": 0.011007070541381836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_data_quality"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.666799Z", "completed_at": "2024-02-21T19:58:32.673838Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.674755Z", "completed_at": "2024-02-21T19:58:32.674760Z"}], "thread_id": "Thread-1", "execution_time": 0.009453058242797852, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__exclusion"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.671362Z", "completed_at": "2024-02-21T19:58:32.674848Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.700983Z", "completed_at": "2024-02-21T19:58:32.700996Z"}], "thread_id": "Thread-4", "execution_time": 0.0374300479888916, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.721094Z", "completed_at": "2024-02-21T19:58:32.766997Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.779041Z", "completed_at": "2024-02-21T19:58:32.779051Z"}], "thread_id": "Thread-4", "execution_time": 0.06499290466308594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__index_admission"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.675464Z", "completed_at": "2024-02-21T19:58:32.852024Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.852292Z", "completed_at": "2024-02-21T19:58:32.852300Z"}], "thread_id": "Thread-3", "execution_time": 0.1781771183013916, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.860188Z", "completed_at": "2024-02-21T19:58:32.864617Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.871739Z", "completed_at": "2024-02-21T19:58:32.871747Z"}], "thread_id": "Thread-3", "execution_time": 0.018108844757080078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_unmapped"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.857405Z", "completed_at": "2024-02-21T19:58:32.864703Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.871872Z", "completed_at": "2024-02-21T19:58:32.871876Z"}], "thread_id": "Thread-4", "execution_time": 0.018784046173095703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_claim_type_mapping_failures"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.865108Z", "completed_at": "2024-02-21T19:58:32.872951Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.873933Z", "completed_at": "2024-02-21T19:58:32.873937Z"}], "thread_id": "Thread-1", "execution_time": 0.015944957733154297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_institutional_header_fail_details"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.874111Z", "completed_at": "2024-02-21T19:58:32.884837Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.891315Z", "completed_at": "2024-02-21T19:58:32.891323Z"}], "thread_id": "Thread-3", "execution_time": 0.018732070922851562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.880508Z", "completed_at": "2024-02-21T19:58:32.890337Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.891564Z", "completed_at": "2024-02-21T19:58:32.891568Z"}], "thread_id": "Thread-4", "execution_time": 0.01869988441467285, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_dates_inst"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.897068Z", "completed_at": "2024-02-21T19:58:32.902340Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.902564Z", "completed_at": "2024-02-21T19:58:32.902571Z"}], "thread_id": "Thread-4", "execution_time": 0.00925302505493164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_inst_missing_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.894056Z", "completed_at": "2024-02-21T19:58:32.903092Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.904031Z", "completed_at": "2024-02-21T19:58:32.904036Z"}], "thread_id": "Thread-3", "execution_time": 0.016209125518798828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_duplicates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.904307Z", "completed_at": "2024-02-21T19:58:32.916723Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.923316Z", "completed_at": "2024-02-21T19:58:32.923322Z"}], "thread_id": "Thread-4", "execution_time": 0.02030324935913086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.910381Z", "completed_at": "2024-02-21T19:58:32.927846Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.928057Z", "completed_at": "2024-02-21T19:58:32.928062Z"}], "thread_id": "Thread-3", "execution_time": 0.01832890510559082, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_invalid_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.925044Z", "completed_at": "2024-02-21T19:58:32.928447Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.929093Z", "completed_at": "2024-02-21T19:58:32.929097Z"}], "thread_id": "Thread-4", "execution_time": 0.004828691482543945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_line_numbers"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.929579Z", "completed_at": "2024-02-21T19:58:32.940735Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.941024Z", "completed_at": "2024-02-21T19:58:32.941031Z"}], "thread_id": "Thread-3", "execution_time": 0.012458086013793945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_plausibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.937196Z", "completed_at": "2024-02-21T19:58:32.941453Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.942129Z", "completed_at": "2024-02-21T19:58:32.942133Z"}], "thread_id": "Thread-4", "execution_time": 0.005667686462402344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_prof_missing_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.942631Z", "completed_at": "2024-02-21T19:58:32.951711Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.952010Z", "completed_at": "2024-02-21T19:58:32.952016Z"}], "thread_id": "Thread-3", "execution_time": 0.01069498062133789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_professional_header_fail_details"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.956407Z", "completed_at": "2024-02-21T19:58:32.958831Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.959046Z", "completed_at": "2024-02-21T19:58:32.959051Z"}], "thread_id": "Thread-3", "execution_time": 0.005892038345336914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_normalized_input__medical_claim__claim_id_claim_line_number_.7102b4fe4f"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.960706Z", "completed_at": "2024-02-21T19:58:32.978090Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.978355Z", "completed_at": "2024-02-21T19:58:32.978363Z"}], "thread_id": "Thread-3", "execution_time": 0.018945693969726562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail_stage_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.965835Z", "completed_at": "2024-02-21T19:58:32.983496Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.983758Z", "completed_at": "2024-02-21T19:58:32.983763Z"}], "thread_id": "Thread-4", "execution_time": 0.01864767074584961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.979308Z", "completed_at": "2024-02-21T19:58:32.986205Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.990528Z", "completed_at": "2024-02-21T19:58:32.990534Z"}], "thread_id": "Thread-3", "execution_time": 0.011862993240356445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.986296Z", "completed_at": "2024-02-21T19:58:32.991456Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:32.995615Z", "completed_at": "2024-02-21T19:58:32.995620Z"}], "thread_id": "Thread-4", "execution_time": 0.011468648910522461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulance_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.991761Z", "completed_at": "2024-02-21T19:58:32.996703Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.002459Z", "completed_at": "2024-02-21T19:58:33.002469Z"}], "thread_id": "Thread-3", "execution_time": 0.011649847030639648, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dialysis_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.996797Z", "completed_at": "2024-02-21T19:58:33.003286Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.004129Z", "completed_at": "2024-02-21T19:58:33.004133Z"}], "thread_id": "Thread-4", "execution_time": 0.012154102325439453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dialysis_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.004256Z", "completed_at": "2024-02-21T19:58:33.009362Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.026139Z", "completed_at": "2024-02-21T19:58:33.026153Z"}], "thread_id": "Thread-3", "execution_time": 0.02948474884033203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dme_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.033591Z", "completed_at": "2024-02-21T19:58:33.042757Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.043089Z", "completed_at": "2024-02-21T19:58:33.043095Z"}], "thread_id": "Thread-3", "execution_time": 0.010265111923217773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__duplicate_bill_types"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.009457Z", "completed_at": "2024-02-21T19:58:33.043006Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.043653Z", "completed_at": "2024-02-21T19:58:33.043656Z"}], "thread_id": "Thread-4", "execution_time": 0.03510904312133789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dq_input_layer_tests"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.045090Z", "completed_at": "2024-02-21T19:58:33.052664Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.053025Z", "completed_at": "2024-02-21T19:58:33.053031Z"}], "thread_id": "Thread-3", "execution_time": 0.009151935577392578, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__emergency_department_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.048968Z", "completed_at": "2024-02-21T19:58:33.052930Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.053562Z", "completed_at": "2024-02-21T19:58:33.053566Z"}], "thread_id": "Thread-4", "execution_time": 0.009181976318359375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__home_health_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.054948Z", "completed_at": "2024-02-21T19:58:33.062849Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.063434Z", "completed_at": "2024-02-21T19:58:33.063444Z"}], "thread_id": "Thread-3", "execution_time": 0.009694814682006836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__hospice_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.059000Z", "completed_at": "2024-02-21T19:58:33.062973Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.063548Z", "completed_at": "2024-02-21T19:58:33.063553Z"}], "thread_id": "Thread-4", "execution_time": 0.00947713851928711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__hospice_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.065611Z", "completed_at": "2024-02-21T19:58:33.074108Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.074534Z", "completed_at": "2024-02-21T19:58:33.074540Z"}], "thread_id": "Thread-3", "execution_time": 0.01016998291015625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.069497Z", "completed_at": "2024-02-21T19:58:33.074212Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.074642Z", "completed_at": "2024-02-21T19:58:33.074646Z"}], "thread_id": "Thread-4", "execution_time": 0.010223150253295898, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.080619Z", "completed_at": "2024-02-21T19:58:33.084388Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.084849Z", "completed_at": "2024-02-21T19:58:33.084855Z"}], "thread_id": "Thread-4", "execution_time": 0.00911712646484375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__lab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.076542Z", "completed_at": "2024-02-21T19:58:33.084484Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.084947Z", "completed_at": "2024-02-21T19:58:33.084951Z"}], "thread_id": "Thread-3", "execution_time": 0.009673118591308594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__lab_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.086791Z", "completed_at": "2024-02-21T19:58:33.094947Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.095190Z", "completed_at": "2024-02-21T19:58:33.095198Z"}], "thread_id": "Thread-4", "execution_time": 0.009517908096313477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_visit_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.090392Z", "completed_at": "2024-02-21T19:58:33.095270Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.096148Z", "completed_at": "2024-02-21T19:58:33.096152Z"}], "thread_id": "Thread-3", "execution_time": 0.010339736938476562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.097174Z", "completed_at": "2024-02-21T19:58:33.105523Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.105742Z", "completed_at": "2024-02-21T19:58:33.105749Z"}], "thread_id": "Thread-4", "execution_time": 0.009795188903808594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.101621Z", "completed_at": "2024-02-21T19:58:33.106887Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.112394Z", "completed_at": "2024-02-21T19:58:33.112401Z"}], "thread_id": "Thread-3", "execution_time": 0.016321897506713867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.106975Z", "completed_at": "2024-02-21T19:58:33.117625Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.124643Z", "completed_at": "2024-02-21T19:58:33.124653Z"}], "thread_id": "Thread-4", "execution_time": 0.019320964813232422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.126027Z", "completed_at": "2024-02-21T19:58:33.135854Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.136386Z", "completed_at": "2024-02-21T19:58:33.136395Z"}], "thread_id": "Thread-3", "execution_time": 0.018267154693603516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__skilled_nursing_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.131520Z", "completed_at": "2024-02-21T19:58:33.135999Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.136497Z", "completed_at": "2024-02-21T19:58:33.136501Z"}], "thread_id": "Thread-4", "execution_time": 0.006723165512084961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__urgent_care_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.139059Z", "completed_at": "2024-02-21T19:58:33.148124Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.148554Z", "completed_at": "2024-02-21T19:58:33.148561Z"}], "thread_id": "Thread-3", "execution_time": 0.010919809341430664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_detail"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.142854Z", "completed_at": "2024-02-21T19:58:33.148230Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.148648Z", "completed_at": "2024-02-21T19:58:33.148652Z"}], "thread_id": "Thread-4", "execution_time": 0.01088404655456543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__emergency_department_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.150757Z", "completed_at": "2024-02-21T19:58:33.162401Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.162842Z", "completed_at": "2024-02-21T19:58:33.162849Z"}], "thread_id": "Thread-3", "execution_time": 0.013220071792602539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.156648Z", "completed_at": "2024-02-21T19:58:33.162521Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.162937Z", "completed_at": "2024-02-21T19:58:33.162940Z"}], "thread_id": "Thread-4", "execution_time": 0.013261079788208008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__home_health_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.165026Z", "completed_at": "2024-02-21T19:58:33.175260Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.175657Z", "completed_at": "2024-02-21T19:58:33.175664Z"}], "thread_id": "Thread-3", "execution_time": 0.011883020401000977, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__skilled_nursing_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.170183Z", "completed_at": "2024-02-21T19:58:33.175557Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.176258Z", "completed_at": "2024-02-21T19:58:33.176261Z"}], "thread_id": "Thread-4", "execution_time": 0.012135028839111328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dq_input_layer_results"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.177814Z", "completed_at": "2024-02-21T19:58:33.201221Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.201727Z", "completed_at": "2024-02-21T19:58:33.201735Z"}], "thread_id": "Thread-3", "execution_time": 0.02521800994873047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.191291Z", "completed_at": "2024-02-21T19:58:33.201346Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.201830Z", "completed_at": "2024-02-21T19:58:33.201834Z"}], "thread_id": "Thread-4", "execution_time": 0.025947093963623047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.208727Z", "completed_at": "2024-02-21T19:58:33.218531Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.218971Z", "completed_at": "2024-02-21T19:58:33.218979Z"}], "thread_id": "Thread-3", "execution_time": 0.015128850936889648, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_use_case"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.215676Z", "completed_at": "2024-02-21T19:58:33.218651Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.219069Z", "completed_at": "2024-02-21T19:58:33.219072Z"}], "thread_id": "Thread-4", "execution_time": 0.015133857727050781, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_source_table.cf991d30ab"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.221156Z", "completed_at": "2024-02-21T19:58:33.226263Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.226690Z", "completed_at": "2024-02-21T19:58:33.226695Z"}], "thread_id": "Thread-3", "execution_time": 0.006745815277099609, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_category.ced96217c6"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.223694Z", "completed_at": "2024-02-21T19:58:33.226363Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.226787Z", "completed_at": "2024-02-21T19:58:33.226791Z"}], "thread_id": "Thread-4", "execution_time": 0.006803035736083984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_detail_test_name.dba1927ba6"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.233656Z", "completed_at": "2024-02-21T19:58:33.238549Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.238888Z", "completed_at": "2024-02-21T19:58:33.238896Z"}], "thread_id": "Thread-4", "execution_time": 0.011111974716186523, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__combined_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.228689Z", "completed_at": "2024-02-21T19:58:33.238799Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.239445Z", "completed_at": "2024-02-21T19:58:33.239449Z"}], "thread_id": "Thread-3", "execution_time": 0.01206517219543457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__urgent_care_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.240975Z", "completed_at": "2024-02-21T19:58:33.252606Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.252905Z", "completed_at": "2024-02-21T19:58:33.252911Z"}], "thread_id": "Thread-4", "execution_time": 0.013263225555419922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.246848Z", "completed_at": "2024-02-21T19:58:33.252822Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.253904Z", "completed_at": "2024-02-21T19:58:33.253910Z"}], "thread_id": "Thread-3", "execution_time": 0.013984918594360352, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.258066Z", "completed_at": "2024-02-21T19:58:33.268082Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.268329Z", "completed_at": "2024-02-21T19:58:33.268336Z"}], "thread_id": "Thread-4", "execution_time": 0.013418912887573242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.265314Z", "completed_at": "2024-02-21T19:58:33.272418Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.272936Z", "completed_at": "2024-02-21T19:58:33.272943Z"}], "thread_id": "Thread-3", "execution_time": 0.015610218048095703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.claims_preprocessing_pipeline_checks_data_quality__claims_preprocessing_summary_.b6e0d43468"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.269647Z", "completed_at": "2024-02-21T19:58:33.273693Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.274333Z", "completed_at": "2024-02-21T19:58:33.274337Z"}], "thread_id": "Thread-4", "execution_time": 0.008999109268188477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_source_table.69a94b9930"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.274427Z", "completed_at": "2024-02-21T19:58:33.279144Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.282412Z", "completed_at": "2024-02-21T19:58:33.282420Z"}], "thread_id": "Thread-3", "execution_time": 0.008945941925048828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_summary_test_category.096fbc6a15"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.556726Z", "completed_at": "2024-02-21T19:58:33.118459Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.125923Z", "completed_at": "2024-02-21T19:58:33.125927Z"}], "thread_id": "Thread-2", "execution_time": 0.7305641174316406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_eligibility_denominators"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.279238Z", "completed_at": "2024-02-21T19:58:33.283690Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.286924Z", "completed_at": "2024-02-21T19:58:33.286931Z"}], "thread_id": "Thread-4", "execution_time": 0.008700370788574219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_source_table.aa47c26a47"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.284465Z", "completed_at": "2024-02-21T19:58:33.290140Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.290851Z", "completed_at": "2024-02-21T19:58:33.290856Z"}], "thread_id": "Thread-3", "execution_time": 0.010544061660766602, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_test_name.d9661e41fa"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.287559Z", "completed_at": "2024-02-21T19:58:33.290751Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.294192Z", "completed_at": "2024-02-21T19:58:33.294195Z"}], "thread_id": "Thread-2", "execution_time": 0.010474920272827148, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_use_case_use_case.50708d3a7d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.290945Z", "completed_at": "2024-02-21T19:58:33.294817Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.295875Z", "completed_at": "2024-02-21T19:58:33.295880Z"}], "thread_id": "Thread-4", "execution_time": 0.011295080184936523, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dq_multiple_service_categories_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.295964Z", "completed_at": "2024-02-21T19:58:33.303881Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.304566Z", "completed_at": "2024-02-21T19:58:33.304571Z"}], "thread_id": "Thread-3", "execution_time": 0.015208005905151367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.301766Z", "completed_at": "2024-02-21T19:58:33.304369Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.310315Z", "completed_at": "2024-02-21T19:58:33.310320Z"}], "thread_id": "Thread-2", "execution_time": 0.015310049057006836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.304756Z", "completed_at": "2024-02-21T19:58:33.311438Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.314566Z", "completed_at": "2024-02-21T19:58:33.314573Z"}], "thread_id": "Thread-4", "execution_time": 0.011070966720581055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.312311Z", "completed_at": "2024-02-21T19:58:33.319852Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.324061Z", "completed_at": "2024-02-21T19:58:33.324069Z"}], "thread_id": "Thread-3", "execution_time": 0.013349294662475586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.315189Z", "completed_at": "2024-02-21T19:58:33.320150Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.324216Z", "completed_at": "2024-02-21T19:58:33.324220Z"}], "thread_id": "Thread-2", "execution_time": 0.01285409927368164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.320428Z", "completed_at": "2024-02-21T19:58:33.324990Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.326142Z", "completed_at": "2024-02-21T19:58:33.326146Z"}], "thread_id": "Thread-4", "execution_time": 0.007192134857177734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__combined_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.371484Z", "completed_at": "2024-02-21T19:58:33.407797Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.408605Z", "completed_at": "2024-02-21T19:58:33.408609Z"}], "thread_id": "Thread-2", "execution_time": 0.03839421272277832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dq_multiple_service_categories_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.375837Z", "completed_at": "2024-02-21T19:58:33.408259Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.409186Z", "completed_at": "2024-02-21T19:58:33.409189Z"}], "thread_id": "Thread-4", "execution_time": 0.045326948165893555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__service_category_grouper"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.409273Z", "completed_at": "2024-02-21T19:58:33.417148Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.428799Z", "completed_at": "2024-02-21T19:58:33.428807Z"}], "thread_id": "Thread-3", "execution_time": 0.0323030948638916, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__member_months"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.417485Z", "completed_at": "2024-02-21T19:58:33.483510Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.491770Z", "completed_at": "2024-02-21T19:58:33.491777Z"}], "thread_id": "Thread-2", "execution_time": 0.07576608657836914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ed_classification__summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.460366Z", "completed_at": "2024-02-21T19:58:33.489883Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.492429Z", "completed_at": "2024-02-21T19:58:33.492433Z"}], "thread_id": "Thread-3", "execution_time": 0.04566001892089844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.428922Z", "completed_at": "2024-02-21T19:58:33.492760Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.493786Z", "completed_at": "2024-02-21T19:58:33.493790Z"}], "thread_id": "Thread-4", "execution_time": 0.08134198188781738, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_members"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.494114Z", "completed_at": "2024-02-21T19:58:33.502597Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.506148Z", "completed_at": "2024-02-21T19:58:33.506206Z"}], "thread_id": "Thread-2", "execution_time": 0.014317035675048828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.499174Z", "completed_at": "2024-02-21T19:58:33.505696Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.507661Z", "completed_at": "2024-02-21T19:58:33.507665Z"}], "thread_id": "Thread-3", "execution_time": 0.014438867568969727, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.502950Z", "completed_at": "2024-02-21T19:58:33.507137Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.508466Z", "completed_at": "2024-02-21T19:58:33.508470Z"}], "thread_id": "Thread-4", "execution_time": 0.007094144821166992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.516582Z", "completed_at": "2024-02-21T19:58:33.523740Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.527035Z", "completed_at": "2024-02-21T19:58:33.527041Z"}], "thread_id": "Thread-4", "execution_time": 0.014259099960327148, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_demographic_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.524500Z", "completed_at": "2024-02-21T19:58:33.531016Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.531782Z", "completed_at": "2024-02-21T19:58:33.531787Z"}], "thread_id": "Thread-2", "execution_time": 0.03945207595825195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.527645Z", "completed_at": "2024-02-21T19:58:33.531688Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.580517Z", "completed_at": "2024-02-21T19:58:33.580530Z"}], "thread_id": "Thread-3", "execution_time": 0.05727505683898926, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.531885Z", "completed_at": "2024-02-21T19:58:33.582363Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.608134Z", "completed_at": "2024-02-21T19:58:33.608146Z"}], "thread_id": "Thread-4", "execution_time": 0.10753369331359863, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__institutional_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.627054Z", "completed_at": "2024-02-21T19:58:33.642616Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.643122Z", "completed_at": "2024-02-21T19:58:33.643129Z"}], "thread_id": "Thread-3", "execution_time": 0.060923099517822266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.583059Z", "completed_at": "2024-02-21T19:58:33.642776Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.643305Z", "completed_at": "2024-02-21T19:58:33.643308Z"}], "thread_id": "Thread-2", "execution_time": 0.06214785575866699, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_institutional_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.639902Z", "completed_at": "2024-02-21T19:58:33.643225Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.644424Z", "completed_at": "2024-02-21T19:58:33.644429Z"}], "thread_id": "Thread-4", "execution_time": 0.005775928497314453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_cms_hcc__int_demographic_factors__patient_id_model_version_.21c6216400"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.646099Z", "completed_at": "2024-02-21T19:58:33.662444Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.662969Z", "completed_at": "2024-02-21T19:58:33.662988Z"}], "thread_id": "Thread-3", "execution_time": 0.01874685287475586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__data_quality_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.653958Z", "completed_at": "2024-02-21T19:58:33.662851Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.663692Z", "completed_at": "2024-02-21T19:58:33.663696Z"}], "thread_id": "Thread-2", "execution_time": 0.01881694793701172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__institutional_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.658074Z", "completed_at": "2024-02-21T19:58:33.663220Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.664346Z", "completed_at": "2024-02-21T19:58:33.664350Z"}], "thread_id": "Thread-4", "execution_time": 0.011487007141113281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_institutional_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.665615Z", "completed_at": "2024-02-21T19:58:33.673351Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.673613Z", "completed_at": "2024-02-21T19:58:33.673621Z"}], "thread_id": "Thread-3", "execution_time": 0.00898289680480957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__encounter_start_and_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.669968Z", "completed_at": "2024-02-21T19:58:33.673697Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.674420Z", "completed_at": "2024-02-21T19:58:33.674425Z"}], "thread_id": "Thread-2", "execution_time": 0.005362272262573242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_encounter_start_and_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.675608Z", "completed_at": "2024-02-21T19:58:33.711093Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.711382Z", "completed_at": "2024-02-21T19:58:33.711389Z"}], "thread_id": "Thread-4", "execution_time": 0.03672194480895996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__professional_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.693902Z", "completed_at": "2024-02-21T19:58:33.711840Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.712340Z", "completed_at": "2024-02-21T19:58:33.712344Z"}], "thread_id": "Thread-3", "execution_time": 0.025970935821533203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_professional_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.713350Z", "completed_at": "2024-02-21T19:58:33.726743Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.726963Z", "completed_at": "2024-02-21T19:58:33.726970Z"}], "thread_id": "Thread-2", "execution_time": 0.014785051345825195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.720895Z", "completed_at": "2024-02-21T19:58:33.728250Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.732415Z", "completed_at": "2024-02-21T19:58:33.732423Z"}], "thread_id": "Thread-4", "execution_time": 0.01877117156982422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.728332Z", "completed_at": "2024-02-21T19:58:33.738544Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.739839Z", "completed_at": "2024-02-21T19:58:33.739845Z"}], "thread_id": "Thread-3", "execution_time": 0.012786865234375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__claims_with_encounter_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.732545Z", "completed_at": "2024-02-21T19:58:33.740268Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.745806Z", "completed_at": "2024-02-21T19:58:33.745811Z"}], "thread_id": "Thread-2", "execution_time": 0.014596223831176758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__first_claim_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.741062Z", "completed_at": "2024-02-21T19:58:33.753168Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.759538Z", "completed_at": "2024-02-21T19:58:33.759545Z"}], "thread_id": "Thread-4", "execution_time": 0.05749702453613281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__last_claim_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.746905Z", "completed_at": "2024-02-21T19:58:33.817312Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.829494Z", "completed_at": "2024-02-21T19:58:33.829505Z"}], "thread_id": "Thread-3", "execution_time": 0.08413481712341309, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.798245Z", "completed_at": "2024-02-21T19:58:33.837298Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.837561Z", "completed_at": "2024-02-21T19:58:33.837568Z"}], "thread_id": "Thread-4", "execution_time": 0.040060997009277344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.759644Z", "completed_at": "2024-02-21T19:58:33.837673Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.838565Z", "completed_at": "2024-02-21T19:58:33.838569Z"}], "thread_id": "Thread-2", "execution_time": 0.08025598526000977, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.830741Z", "completed_at": "2024-02-21T19:58:33.838260Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.839370Z", "completed_at": "2024-02-21T19:58:33.839374Z"}], "thread_id": "Thread-3", "execution_time": 0.00958704948425293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_first_claim_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.840122Z", "completed_at": "2024-02-21T19:58:33.855229Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.887103Z", "completed_at": "2024-02-21T19:58:33.887112Z"}], "thread_id": "Thread-4", "execution_time": 0.048692941665649414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__int_last_claim_values"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.874327Z", "completed_at": "2024-02-21T19:58:33.892348Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.892974Z", "completed_at": "2024-02-21T19:58:33.892981Z"}], "thread_id": "Thread-2", "execution_time": 0.046350717544555664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__encounter_data_for_medical_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.849860Z", "completed_at": "2024-02-21T19:58:33.892490Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.893233Z", "completed_at": "2024-02-21T19:58:33.893237Z"}], "thread_id": "Thread-3", "execution_time": 0.04516100883483887, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.888130Z", "completed_at": "2024-02-21T19:58:33.892770Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.893703Z", "completed_at": "2024-02-21T19:58:33.893706Z"}], "thread_id": "Thread-4", "execution_time": 0.006677150726318359, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.896027Z", "completed_at": "2024-02-21T19:58:33.907197Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.908885Z", "completed_at": "2024-02-21T19:58:33.908894Z"}], "thread_id": "Thread-2", "execution_time": 0.014503955841064453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.899929Z", "completed_at": "2024-02-21T19:58:33.909006Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.910032Z", "completed_at": "2024-02-21T19:58:33.910036Z"}], "thread_id": "Thread-3", "execution_time": 0.015286922454833984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.901791Z", "completed_at": "2024-02-21T19:58:33.909446Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.910377Z", "completed_at": "2024-02-21T19:58:33.910381Z"}], "thread_id": "Thread-4", "execution_time": 0.015347957611083984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.911386Z", "completed_at": "2024-02-21T19:58:33.923400Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.926336Z", "completed_at": "2024-02-21T19:58:33.926344Z"}], "thread_id": "Thread-2", "execution_time": 0.016605854034423828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.917875Z", "completed_at": "2024-02-21T19:58:33.926424Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.927321Z", "completed_at": "2024-02-21T19:58:33.927324Z"}], "thread_id": "Thread-3", "execution_time": 0.011229991912841797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.951679Z", "completed_at": "2024-02-21T19:58:33.954913Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.956016Z", "completed_at": "2024-02-21T19:58:33.956022Z"}], "thread_id": "Thread-2", "execution_time": 0.010987043380737305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.972297Z", "completed_at": "2024-02-21T19:58:33.978370Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.979179Z", "completed_at": "2024-02-21T19:58:33.979184Z"}], "thread_id": "Thread-3", "execution_time": 0.010920047760009766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.984418Z", "completed_at": "2024-02-21T19:58:33.996488Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:33.997280Z", "completed_at": "2024-02-21T19:58:33.997285Z"}], "thread_id": "Thread-3", "execution_time": 0.0174560546875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__count_claim_by_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.986883Z", "completed_at": "2024-02-21T19:58:33.997091Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.001185Z", "completed_at": "2024-02-21T19:58:34.001189Z"}], "thread_id": "Thread-2", "execution_time": 0.017858028411865234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__count_claim_by_date_column"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:33.997483Z", "completed_at": "2024-02-21T19:58:34.002135Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.006993Z", "completed_at": "2024-02-21T19:58:34.006998Z"}], "thread_id": "Thread-4", "execution_time": 0.010737895965576172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__count_claim_by_service_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.002848Z", "completed_at": "2024-02-21T19:58:34.009784Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.010467Z", "completed_at": "2024-02-21T19:58:34.010472Z"}], "thread_id": "Thread-3", "execution_time": 0.011059999465942383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__orphan_claim_by_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.007562Z", "completed_at": "2024-02-21T19:58:34.010562Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.013399Z", "completed_at": "2024-02-21T19:58:34.013403Z"}], "thread_id": "Thread-2", "execution_time": 0.011427879333496094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__sum_amount_by_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.010641Z", "completed_at": "2024-02-21T19:58:34.013797Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.017511Z", "completed_at": "2024-02-21T19:58:34.017516Z"}], "thread_id": "Thread-4", "execution_time": 0.008111238479614258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__sum_amount_by_service_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.014554Z", "completed_at": "2024-02-21T19:58:34.018483Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.023247Z", "completed_at": "2024-02-21T19:58:34.023254Z"}], "thread_id": "Thread-3", "execution_time": 0.01603984832763672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.018604Z", "completed_at": "2024-02-21T19:58:34.029243Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.030140Z", "completed_at": "2024-02-21T19:58:34.030145Z"}], "thread_id": "Thread-2", "execution_time": 0.013081073760986328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__trend_count_claim_by_service_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.023364Z", "completed_at": "2024-02-21T19:58:34.030235Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.031239Z", "completed_at": "2024-02-21T19:58:34.031242Z"}], "thread_id": "Thread-4", "execution_time": 0.013365030288696289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.031332Z", "completed_at": "2024-02-21T19:58:34.042699Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.043466Z", "completed_at": "2024-02-21T19:58:34.043473Z"}], "thread_id": "Thread-3", "execution_time": 0.01584911346435547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.insights__trend_sum_amount_by_service_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.043636Z", "completed_at": "2024-02-21T19:58:34.047549Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.051830Z", "completed_at": "2024-02-21T19:58:34.051836Z"}], "thread_id": "Thread-4", "execution_time": 0.013301849365234375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__medical_claim__claim_id_claim_line_number_.b9ab42f1f0"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.048210Z", "completed_at": "2024-02-21T19:58:34.056903Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.066001Z", "completed_at": "2024-02-21T19:58:34.066012Z"}], "thread_id": "Thread-3", "execution_time": 0.01938009262084961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.051940Z", "completed_at": "2024-02-21T19:58:34.057239Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.066723Z", "completed_at": "2024-02-21T19:58:34.066726Z"}], "thread_id": "Thread-2", "execution_time": 0.019681215286254883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.057330Z", "completed_at": "2024-02-21T19:58:34.067077Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.068168Z", "completed_at": "2024-02-21T19:58:34.068172Z"}], "thread_id": "Thread-4", "execution_time": 0.02426004409790039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__long_condition_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.068507Z", "completed_at": "2024-02-21T19:58:34.110019Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.119154Z", "completed_at": "2024-02-21T19:58:34.119162Z"}], "thread_id": "Thread-3", "execution_time": 0.05194592475891113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.083880Z", "completed_at": "2024-02-21T19:58:34.123276Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.123712Z", "completed_at": "2024-02-21T19:58:34.123717Z"}], "thread_id": "Thread-2", "execution_time": 0.055930137634277344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.103734Z", "completed_at": "2024-02-21T19:58:34.123366Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.123899Z", "completed_at": "2024-02-21T19:58:34.123904Z"}], "thread_id": "Thread-4", "execution_time": 0.028199195861816406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.120253Z", "completed_at": "2024-02-21T19:58:34.123798Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.124984Z", "completed_at": "2024-02-21T19:58:34.124988Z"}], "thread_id": "Thread-3", "execution_time": 0.005860090255737305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.138217Z", "completed_at": "2024-02-21T19:58:34.167852Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.169031Z", "completed_at": "2024-02-21T19:58:34.169038Z"}], "thread_id": "Thread-4", "execution_time": 0.0435938835144043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.126498Z", "completed_at": "2024-02-21T19:58:34.167994Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.169140Z", "completed_at": "2024-02-21T19:58:34.169144Z"}], "thread_id": "Thread-2", "execution_time": 0.044619083404541016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.161559Z", "completed_at": "2024-02-21T19:58:34.169649Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.170966Z", "completed_at": "2024-02-21T19:58:34.170971Z"}], "thread_id": "Thread-3", "execution_time": 0.033660888671875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__long_procedure_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.171787Z", "completed_at": "2024-02-21T19:58:34.199720Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.203777Z", "completed_at": "2024-02-21T19:58:34.203787Z"}], "thread_id": "Thread-4", "execution_time": 0.03362607955932617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.175298Z", "completed_at": "2024-02-21T19:58:34.203598Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.204467Z", "completed_at": "2024-02-21T19:58:34.204471Z"}], "thread_id": "Thread-2", "execution_time": 0.03396034240722656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__procedure_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.181869Z", "completed_at": "2024-02-21T19:58:34.204562Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.205756Z", "completed_at": "2024-02-21T19:58:34.205760Z"}], "thread_id": "Thread-3", "execution_time": 0.02497100830078125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_eligible_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.206472Z", "completed_at": "2024-02-21T19:58:34.255546Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.276076Z", "completed_at": "2024-02-21T19:58:34.276085Z"}], "thread_id": "Thread-4", "execution_time": 0.07141900062561035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.223516Z", "completed_at": "2024-02-21T19:58:34.283679Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.311665Z", "completed_at": "2024-02-21T19:58:34.311673Z"}], "thread_id": "Thread-2", "execution_time": 0.10625982284545898, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.236735Z", "completed_at": "2024-02-21T19:58:34.283816Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.311850Z", "completed_at": "2024-02-21T19:58:34.311855Z"}], "thread_id": "Thread-3", "execution_time": 0.07633280754089355, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.277705Z", "completed_at": "2024-02-21T19:58:34.312764Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.313979Z", "completed_at": "2024-02-21T19:58:34.313983Z"}], "thread_id": "Thread-4", "execution_time": 0.03713107109069824, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_hospice_palliative"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.314582Z", "completed_at": "2024-02-21T19:58:34.399614Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.411881Z", "completed_at": "2024-02-21T19:58:34.411893Z"}], "thread_id": "Thread-2", "execution_time": 0.10848093032836914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.332675Z", "completed_at": "2024-02-21T19:58:34.411768Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.422162Z", "completed_at": "2024-02-21T19:58:34.422167Z"}], "thread_id": "Thread-3", "execution_time": 0.10892796516418457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclude_hospice_palliative"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.387007Z", "completed_at": "2024-02-21T19:58:34.422811Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.424026Z", "completed_at": "2024-02-21T19:58:34.424030Z"}], "thread_id": "Thread-4", "execution_time": 0.05309700965881348, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.424121Z", "completed_at": "2024-02-21T19:58:34.431656Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.432365Z", "completed_at": "2024-02-21T19:58:34.432371Z"}], "thread_id": "Thread-2", "execution_time": 0.012372016906738281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__singular_condition_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.428652Z", "completed_at": "2024-02-21T19:58:34.432280Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.435469Z", "completed_at": "2024-02-21T19:58:34.435473Z"}], "thread_id": "Thread-3", "execution_time": 0.012394905090332031, "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"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.432466Z", "completed_at": "2024-02-21T19:58:34.435836Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.436872Z", "completed_at": "2024-02-21T19:58:34.436876Z"}], "thread_id": "Thread-4", "execution_time": 0.008399248123168945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.437217Z", "completed_at": "2024-02-21T19:58:34.443342Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.448272Z", "completed_at": "2024-02-21T19:58:34.448280Z"}], "thread_id": "Thread-2", "execution_time": 0.012491941452026367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.440706Z", "completed_at": "2024-02-21T19:58:34.448177Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.448912Z", "completed_at": "2024-02-21T19:58:34.448916Z"}], "thread_id": "Thread-3", "execution_time": 0.012497901916503906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.443712Z", "completed_at": "2024-02-21T19:58:34.449007Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.450174Z", "completed_at": "2024-02-21T19:58:34.450178Z"}], "thread_id": "Thread-4", "execution_time": 0.007719278335571289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.450937Z", "completed_at": "2024-02-21T19:58:34.488071Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.488336Z", "completed_at": "2024-02-21T19:58:34.488342Z"}], "thread_id": "Thread-2", "execution_time": 0.03888583183288574, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.482492Z", "completed_at": "2024-02-21T19:58:34.491669Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.492161Z", "completed_at": "2024-02-21T19:58:34.492165Z"}], "thread_id": "Thread-3", "execution_time": 0.042218923568725586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.485643Z", "completed_at": "2024-02-21T19:58:34.491775Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.492259Z", "completed_at": "2024-02-21T19:58:34.492262Z"}], "thread_id": "Thread-4", "execution_time": 0.007858037948608398, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.489213Z", "completed_at": "2024-02-21T19:58:34.492086Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.493137Z", "completed_at": "2024-02-21T19:58:34.493141Z"}], "thread_id": "Thread-2", "execution_time": 0.004821062088012695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.502454Z", "completed_at": "2024-02-21T19:58:34.509507Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.510120Z", "completed_at": "2024-02-21T19:58:34.510129Z"}], "thread_id": "Thread-4", "execution_time": 0.016430139541625977, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_long__patient_id___condition_.c9509bb46f"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.506076Z", "completed_at": "2024-02-21T19:58:34.510238Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.511144Z", "completed_at": "2024-02-21T19:58:34.511148Z"}], "thread_id": "Thread-2", "execution_time": 0.016969919204711914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_specialty_cohort"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.512653Z", "completed_at": "2024-02-21T19:58:34.523465Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.523931Z", "completed_at": "2024-02-21T19:58:34.523938Z"}], "thread_id": "Thread-4", "execution_time": 0.012949943542480469, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__planned_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.518992Z", "completed_at": "2024-02-21T19:58:34.527621Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.527847Z", "completed_at": "2024-02-21T19:58:34.527852Z"}], "thread_id": "Thread-2", "execution_time": 0.00978994369506836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_mapping"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.524838Z", "completed_at": "2024-02-21T19:58:34.528520Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.529221Z", "completed_at": "2024-02-21T19:58:34.529225Z"}], "thread_id": "Thread-4", "execution_time": 0.009210824966430664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.529314Z", "completed_at": "2024-02-21T19:58:34.539836Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.540073Z", "completed_at": "2024-02-21T19:58:34.540079Z"}], "thread_id": "Thread-2", "execution_time": 0.011690139770507812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.534589Z", "completed_at": "2024-02-21T19:58:34.540481Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.541184Z", "completed_at": "2024-02-21T19:58:34.541188Z"}], "thread_id": "Thread-4", "execution_time": 0.007443904876708984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.541680Z", "completed_at": "2024-02-21T19:58:34.554637Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.554885Z", "completed_at": "2024-02-21T19:58:34.554892Z"}], "thread_id": "Thread-2", "execution_time": 0.014225006103515625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.548423Z", "completed_at": "2024-02-21T19:58:34.555572Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.556135Z", "completed_at": "2024-02-21T19:58:34.556139Z"}], "thread_id": "Thread-4", "execution_time": 0.020972013473510742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.556224Z", "completed_at": "2024-02-21T19:58:34.661639Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.661899Z", "completed_at": "2024-02-21T19:58:34.661906Z"}], "thread_id": "Thread-2", "execution_time": 0.1066741943359375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__frailty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.587880Z", "completed_at": "2024-02-21T19:58:34.661988Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.662845Z", "completed_at": "2024-02-21T19:58:34.662850Z"}], "thread_id": "Thread-4", "execution_time": 0.08152198791503906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_institutional_snp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.663963Z", "completed_at": "2024-02-21T19:58:34.717551Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.737758Z", "completed_at": "2024-02-21T19:58:34.737767Z"}], "thread_id": "Thread-2", "execution_time": 0.07506990432739258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.698854Z", "completed_at": "2024-02-21T19:58:34.749311Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.749658Z", "completed_at": "2024-02-21T19:58:34.749665Z"}], "thread_id": "Thread-4", "execution_time": 0.05654311180114746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059__frailty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.738931Z", "completed_at": "2024-02-21T19:58:34.770174Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.786827Z", "completed_at": "2024-02-21T19:58:34.786836Z"}], "thread_id": "Thread-2", "execution_time": 0.04877638816833496, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclude_institutional_snp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.750573Z", "completed_at": "2024-02-21T19:58:34.825087Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.834048Z", "completed_at": "2024-02-21T19:58:34.834053Z"}], "thread_id": "Thread-4", "execution_time": 0.08423924446105957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.787800Z", "completed_at": "2024-02-21T19:58:34.842138Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.855127Z", "completed_at": "2024-02-21T19:58:34.855139Z"}], "thread_id": "Thread-2", "execution_time": 0.07350778579711914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__frailty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.835824Z", "completed_at": "2024-02-21T19:58:34.872470Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.872705Z", "completed_at": "2024-02-21T19:58:34.872712Z"}], "thread_id": "Thread-4", "execution_time": 0.03752589225769043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_hospice"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.862014Z", "completed_at": "2024-02-21T19:58:34.891180Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.908719Z", "completed_at": "2024-02-21T19:58:34.908728Z"}], "thread_id": "Thread-2", "execution_time": 0.04754209518432617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.873618Z", "completed_at": "2024-02-21T19:58:34.916278Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.934614Z", "completed_at": "2024-02-21T19:58:34.934626Z"}], "thread_id": "Thread-4", "execution_time": 0.06413078308105469, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.909951Z", "completed_at": "2024-02-21T19:58:34.962154Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.971783Z", "completed_at": "2024-02-21T19:58:34.971791Z"}], "thread_id": "Thread-2", "execution_time": 0.06261706352233887, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_palliative"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.938218Z", "completed_at": "2024-02-21T19:58:34.976392Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.976692Z", "completed_at": "2024-02-21T19:58:34.976698Z"}], "thread_id": "Thread-4", "execution_time": 0.039129018783569336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.972848Z", "completed_at": "2024-02-21T19:58:34.977751Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.981943Z", "completed_at": "2024-02-21T19:58:34.981950Z"}], "thread_id": "Thread-2", "execution_time": 0.009862899780273438, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_ccsr__singular_condition_category_claim_id.41e0e51ac8"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.977833Z", "completed_at": "2024-02-21T19:58:34.982807Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.983442Z", "completed_at": "2024-02-21T19:58:34.983446Z"}], "thread_id": "Thread-4", "execution_time": 0.011487960815429688, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_ccsr__singular_condition_category_claim_id.21b76e504b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.983537Z", "completed_at": "2024-02-21T19:58:34.989630Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.993014Z", "completed_at": "2024-02-21T19:58:34.993019Z"}], "thread_id": "Thread-2", "execution_time": 0.010347127914428711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.989718Z", "completed_at": "2024-02-21T19:58:34.993562Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.994200Z", "completed_at": "2024-02-21T19:58:34.994204Z"}], "thread_id": "Thread-4", "execution_time": 0.007756948471069336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.994293Z", "completed_at": "2024-02-21T19:58:34.997926Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.000360Z", "completed_at": "2024-02-21T19:58:35.000364Z"}], "thread_id": "Thread-2", "execution_time": 0.006891012191772461, "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"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.998007Z", "completed_at": "2024-02-21T19:58:35.000868Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.001438Z", "completed_at": "2024-02-21T19:58:35.001442Z"}], "thread_id": "Thread-4", "execution_time": 0.007150173187255859, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.001527Z", "completed_at": "2024-02-21T19:58:35.005478Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.009254Z", "completed_at": "2024-02-21T19:58:35.009260Z"}], "thread_id": "Thread-2", "execution_time": 0.008533954620361328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.005594Z", "completed_at": "2024-02-21T19:58:35.009811Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.010404Z", "completed_at": "2024-02-21T19:58:35.010408Z"}], "thread_id": "Thread-4", "execution_time": 0.009186983108520508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.010494Z", "completed_at": "2024-02-21T19:58:35.019153Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.019481Z", "completed_at": "2024-02-21T19:58:35.019488Z"}], "thread_id": "Thread-2", "execution_time": 0.009821891784667969, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_augmented"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.015038Z", "completed_at": "2024-02-21T19:58:35.019919Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.020741Z", "completed_at": "2024-02-21T19:58:35.020745Z"}], "thread_id": "Thread-4", "execution_time": 0.006433963775634766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_hierarchy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.021242Z", "completed_at": "2024-02-21T19:58:35.032248Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.051035Z", "completed_at": "2024-02-21T19:58:35.051044Z"}], "thread_id": "Thread-2", "execution_time": 0.03818202018737793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_prep"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:32.884959Z", "completed_at": "2024-02-21T19:58:34.818382Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:34.833904Z", "completed_at": "2024-02-21T19:58:34.833913Z"}], "thread_id": "Thread-1", "execution_time": 2.179995059967041, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_medical_claim_denominators"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.025936Z", "completed_at": "2024-02-21T19:58:35.108027Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.127450Z", "completed_at": "2024-02-21T19:58:35.127458Z"}], "thread_id": "Thread-4", "execution_time": 0.1090390682220459, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_advanced_illness"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.064925Z", "completed_at": "2024-02-21T19:58:35.148052Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.195950Z", "completed_at": "2024-02-21T19:58:35.195965Z"}], "thread_id": "Thread-2", "execution_time": 0.14229416847229004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_dementia"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.127615Z", "completed_at": "2024-02-21T19:58:35.226053Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.300062Z", "completed_at": "2024-02-21T19:58:35.300072Z"}], "thread_id": "Thread-1", "execution_time": 0.1923997402191162, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclude_advanced_illness"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.183809Z", "completed_at": "2024-02-21T19:58:35.232598Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.300245Z", "completed_at": "2024-02-21T19:58:35.300251Z"}], "thread_id": "Thread-4", "execution_time": 0.1533801555633545, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclude_dementia"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.206945Z", "completed_at": "2024-02-21T19:58:35.301272Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.302421Z", "completed_at": "2024-02-21T19:58:35.302425Z"}], "thread_id": "Thread-2", "execution_time": 0.10892820358276367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_advanced_illness"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.302614Z", "completed_at": "2024-02-21T19:58:35.335489Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.335944Z", "completed_at": "2024-02-21T19:58:35.335952Z"}], "thread_id": "Thread-1", "execution_time": 0.03472781181335449, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_dementia"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.325867Z", "completed_at": "2024-02-21T19:58:35.335631Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.336036Z", "completed_at": "2024-02-21T19:58:35.336039Z"}], "thread_id": "Thread-4", "execution_time": 0.03456711769104004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__list"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.341997Z", "completed_at": "2024-02-21T19:58:35.344549Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.344995Z", "completed_at": "2024-02-21T19:58:35.345003Z"}], "thread_id": "Thread-4", "execution_time": 0.00798797607421875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.338096Z", "completed_at": "2024-02-21T19:58:35.344650Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.345099Z", "completed_at": "2024-02-21T19:58:35.345103Z"}], "thread_id": "Thread-1", "execution_time": 0.00855708122253418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.347332Z", "completed_at": "2024-02-21T19:58:35.353045Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.353280Z", "completed_at": "2024-02-21T19:58:35.353287Z"}], "thread_id": "Thread-4", "execution_time": 0.0072481632232666016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.350426Z", "completed_at": "2024-02-21T19:58:35.353419Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.354113Z", "completed_at": "2024-02-21T19:58:35.354117Z"}], "thread_id": "Thread-1", "execution_time": 0.007916927337646484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_long__patient_id_claim_id_start_date_condition_.fba1518320"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.355244Z", "completed_at": "2024-02-21T19:58:35.364071Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.364295Z", "completed_at": "2024-02-21T19:58:35.364303Z"}], "thread_id": "Thread-4", "execution_time": 0.010391712188720703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__readmission_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.359632Z", "completed_at": "2024-02-21T19:58:35.364380Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.365101Z", "completed_at": "2024-02-21T19:58:35.365104Z"}], "thread_id": "Thread-1", "execution_time": 0.009268999099731445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.368937Z", "completed_at": "2024-02-21T19:58:35.381947Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.382188Z", "completed_at": "2024-02-21T19:58:35.382195Z"}], "thread_id": "Thread-4", "execution_time": 0.017342090606689453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_disease_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.376767Z", "completed_at": "2024-02-21T19:58:35.382273Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.382967Z", "completed_at": "2024-02-21T19:58:35.382971Z"}], "thread_id": "Thread-1", "execution_time": 0.008678197860717773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_disease_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.383878Z", "completed_at": "2024-02-21T19:58:35.393642Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.393876Z", "completed_at": "2024-02-21T19:58:35.393884Z"}], "thread_id": "Thread-4", "execution_time": 0.011095046997070312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_count_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.390202Z", "completed_at": "2024-02-21T19:58:35.398280Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.398520Z", "completed_at": "2024-02-21T19:58:35.398525Z"}], "thread_id": "Thread-1", "execution_time": 0.009511947631835938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.394806Z", "completed_at": "2024-02-21T19:58:35.398596Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.399318Z", "completed_at": "2024-02-21T19:58:35.399322Z"}], "thread_id": "Thread-4", "execution_time": 0.005355119705200195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer_plan"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.400274Z", "completed_at": "2024-02-21T19:58:35.406957Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.407210Z", "completed_at": "2024-02-21T19:58:35.407216Z"}], "thread_id": "Thread-1", "execution_time": 0.008154153823852539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_financial_pmpm__pmpm_prep__patient_id___year_month___plan_.b941ddaf9e"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.403287Z", "completed_at": "2024-02-21T19:58:35.407293Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.408232Z", "completed_at": "2024-02-21T19:58:35.408237Z"}], "thread_id": "Thread-4", "execution_time": 0.005889892578125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result_stage_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.409171Z", "completed_at": "2024-02-21T19:58:35.417035Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.417374Z", "completed_at": "2024-02-21T19:58:35.417381Z"}], "thread_id": "Thread-1", "execution_time": 0.009434700012207031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.413521Z", "completed_at": "2024-02-21T19:58:35.417274Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.417931Z", "completed_at": "2024-02-21T19:58:35.417935Z"}], "thread_id": "Thread-4", "execution_time": 0.0053560733795166016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.419470Z", "completed_at": "2024-02-21T19:58:35.436192Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.436433Z", "completed_at": "2024-02-21T19:58:35.436441Z"}], "thread_id": "Thread-1", "execution_time": 0.018173933029174805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.424867Z", "completed_at": "2024-02-21T19:58:35.437459Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.442942Z", "completed_at": "2024-02-21T19:58:35.442949Z"}], "thread_id": "Thread-4", "execution_time": 0.024106264114379883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.437780Z", "completed_at": "2024-02-21T19:58:35.444020Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.447643Z", "completed_at": "2024-02-21T19:58:35.447649Z"}], "thread_id": "Thread-1", "execution_time": 0.010871171951293945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.444127Z", "completed_at": "2024-02-21T19:58:35.448629Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.474116Z", "completed_at": "2024-02-21T19:58:35.474129Z"}], "thread_id": "Thread-4", "execution_time": 0.03585100173950195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claims_preprocessing_test_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.448706Z", "completed_at": "2024-02-21T19:58:35.499615Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.506024Z", "completed_at": "2024-02-21T19:58:35.506031Z"}], "thread_id": "Thread-1", "execution_time": 0.05813407897949219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.480759Z", "completed_at": "2024-02-21T19:58:35.537595Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.537910Z", "completed_at": "2024-02-21T19:58:35.537916Z"}], "thread_id": "Thread-4", "execution_time": 0.05827617645263672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.506963Z", "completed_at": "2024-02-21T19:58:35.538397Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.539033Z", "completed_at": "2024-02-21T19:58:35.539037Z"}], "thread_id": "Thread-1", "execution_time": 0.032772064208984375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.539534Z", "completed_at": "2024-02-21T19:58:35.547309Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.547566Z", "completed_at": "2024-02-21T19:58:35.547573Z"}], "thread_id": "Thread-4", "execution_time": 0.009071111679077148, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_scores"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.544664Z", "completed_at": "2024-02-21T19:58:35.547976Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.548628Z", "completed_at": "2024-02-21T19:58:35.548632Z"}], "thread_id": "Thread-1", "execution_time": 0.004686117172241211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_source_table.6995ae2e57"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.549105Z", "completed_at": "2024-02-21T19:58:35.554431Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.554637Z", "completed_at": "2024-02-21T19:58:35.554642Z"}], "thread_id": "Thread-4", "execution_time": 0.0065920352935791016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_category.70042a7a27"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.552171Z", "completed_at": "2024-02-21T19:58:35.554714Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.555361Z", "completed_at": "2024-02-21T19:58:35.555364Z"}], "thread_id": "Thread-1", "execution_time": 0.0040400028228759766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__claims_preprocessing_test_result_test_name.745065a5e9"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.556216Z", "completed_at": "2024-02-21T19:58:35.564504Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.564752Z", "completed_at": "2024-02-21T19:58:35.564760Z"}], "thread_id": "Thread-4", "execution_time": 0.009670019149780273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__summary_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.561883Z", "completed_at": "2024-02-21T19:58:35.564833Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.565465Z", "completed_at": "2024-02-21T19:58:35.565469Z"}], "thread_id": "Thread-1", "execution_time": 0.0044078826904296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.566800Z", "completed_at": "2024-02-21T19:58:35.575115Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.575369Z", "completed_at": "2024-02-21T19:58:35.575376Z"}], "thread_id": "Thread-4", "execution_time": 0.009713888168334961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__summary_counts"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.571669Z", "completed_at": "2024-02-21T19:58:35.575455Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:35.576092Z", "completed_at": "2024-02-21T19:58:35.576096Z"}], "thread_id": "Thread-1", "execution_time": 0.009786128997802734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__summary_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:35.330992Z", "completed_at": "2024-02-21T19:58:36.036418Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:36.036666Z", "completed_at": "2024-02-21T19:58:36.036673Z"}], "thread_id": "Thread-2", "execution_time": 1.6132299900054932, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:36.952282Z", "completed_at": "2024-02-21T19:58:36.955739Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:36.956291Z", "completed_at": "2024-02-21T19:58:36.956301Z"}], "thread_id": "Thread-1", "execution_time": 0.010042667388916016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:36.947970Z", "completed_at": "2024-02-21T19:58:36.955899Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:36.956412Z", "completed_at": "2024-02-21T19:58:36.956416Z"}], "thread_id": "Thread-4", "execution_time": 0.011274099349975586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:34.494964Z", "completed_at": "2024-02-21T19:58:37.178409Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:37.178656Z", "completed_at": "2024-02-21T19:58:37.178663Z"}], "thread_id": "Thread-3", "execution_time": 2.8323497772216797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:37.331718Z", "completed_at": "2024-02-21T19:58:37.334996Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:37.335628Z", "completed_at": "2024-02-21T19:58:37.335636Z"}], "thread_id": "Thread-1", "execution_time": 0.008423089981079102, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-02-21T19:58:37.328322Z", "completed_at": "2024-02-21T19:58:37.335137Z"}, {"name": "execute", "started_at": "2024-02-21T19:58:37.335760Z", "completed_at": "2024-02-21T19:58:37.335764Z"}], "thread_id": "Thread-2", "execution_time": 0.009198904037475586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561"}], "elapsed_time": 9.638108968734741, "args": {"write_json": true, "use_colors": true, "printer_width": 80, "version_check": true, "partial_parse": false, "static_parser": true, "profiles_dir": "/Users/sarah/.dbt", "send_anonymous_usage_stats": true, "quiet": false, "no_print": false, "cache_selected_only": false, "compile": true, "which": "generate", "rpc_method": "docs.generate", "indirect_selection": "eager"}} \ No newline at end of file