Skip to content

Commit

Permalink
Merge pull request #263 from tuva-health/ed-encounter-creation
Browse files Browse the repository at this point in the history
Creating Emergency Department Encounters
  • Loading branch information
cocozuloaga authored Oct 17, 2023
2 parents e53d53b + 8451be6 commit 82c145c
Show file tree
Hide file tree
Showing 55 changed files with 1,495 additions and 1,013 deletions.
3 changes: 0 additions & 3 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ profile: default
vars:

## CCSR data mart vars
# These vars enable the wide tables - disabling will exclude wide tables from dbt runs
wide_condition_enabled: True
wide_procedure_enabled: True

# Set to "ip" for inpatient data or "op" for outpatient data (More info in the README)
record_type: "ip"
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/run_results.json

Large diffs are not rendered by default.

26 changes: 17 additions & 9 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ vars:
## Update these vars to use your own data as input, do not comment out
# enabled logic has been added to the sources config
input_database: tuva
input_schema: tuva_claims
input_schema: _tuva_claims

tuva_last_run: '{{ run_started_at.astimezone(modules.pytz.timezone("UTC")) }}'

Expand All @@ -28,17 +28,25 @@ vars:
## The vars directly below enable a single data mart. See the Quickstart
# guide for instructions.

# ccsr_enabled: true
# cms_chronic_conditions_enabled: true
# tuva_chronic_conditions_enabled: true
# ccsr_enabled: false
# cms_chronic_conditions_enabled: false
# tuva_chronic_conditions_enabled: false
# claims_preprocessing_enabled: true
# cms_hcc_enabled: true
# ed_classification_enabled: true
# financial_pmpm_enabled: true
# quality_measures_enabled: true
# readmissions_enabled: true
# cms_hcc_enabled: false
# ed_classification_enabled: false
# financial_pmpm_enabled: false
# insights_enabled: false
# quality_measures_enabled: false
# readmissions_enabled: false


## CMS HCC data mart vars
# The payment_year variable has a default of the current year
cms_hcc_payment_year: 2023

# DO NOT CHANGE - Future logic to be added for selecting different HCC model versions
cms_hcc_model_version: CMS-HCC-V24

model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/docs_generate/models/eligibility.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ select patient_id,
zip_code,
phone,
data_source
from tuva._tuva_synthetic.eligibility_seed
from tuva._tuva_synthetic.eligibility_seed
1 change: 1 addition & 0 deletions integration_tests/docs_generate/models/encounter.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ null as encounter_id
, null as discharge_disposition_description
, null as attending_provider_id
, null as facility_npi
, null as primary_diagnosis_code_type
, null as primary_diagnosis_code
, null as primary_diagnosis_description
, null as ms_drg_code
Expand Down
65 changes: 0 additions & 65 deletions models/ccsr/ccsr_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,40 +132,6 @@ models:
- 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.


- name: ccsr__wide_condition_category
config:
schema: |
{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_ccsr
{% else %}ccsr{%- endif -%}
alias: wide_condition_category
tags:
- ccsr
materialized: table
enabled: "{{var('wide_condition_enabled', True)}}"
description: |
This model contains a row for each input record with a column for every CCSR condition category.
Each column contains a value of 0, 1, 2, or 3. These values indicate:
* 0 \- The CCSR was not triggered by any ICD-10-CM diagnosis code on the input record.
* 1 \- The CCSR was triggered by only the principal (or first-listed) diagnosis on the input record.
* 2 \- The CCSR was triggered by both the principal (or first-listed) diagnosis and any secondary diagnosis on the input record.
* 3 \- The CCSR was triggered by only secondary diagnosis code(s) on the input record.
This table doesn't include any category descriptions, but category and parent category descriptions
can be found by querying the target column name against the `ccsr__dx_vertical_pivot` intermediate model.
columns:
- name: encounter_id
description: Unique identifier for an encounter.
- name: claim_id
description: Unique claim_id for each claim.
- name: patient_id
description: Unique identifier for each patient.
- name: dxccsr_version
description: The version number of the CCSR program from which the dbt model was derived.
- 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.


- name: ccsr__singular_condition_category
config:
schema: |
Expand Down Expand Up @@ -246,37 +212,6 @@ models:
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.


- name: ccsr__wide_procedure_category
config:
schema: |
{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_ccsr
{% else %}ccsr{%- endif -%}
alias: wide_procedure_category
tags:
- ccsr
materialized: table
enabled: "{{var('wide_procedure_enabled', True)}}"
description: |
This model contains a row for each input record with a column for every CCSR procedure category.
Each column contains a value of 0 or 1. These values indicate:
* 0 \- The CCSR was not triggered by any ICD-10-PCS code on the input record.
* 1 \- The CCSR was triggered by a procedure on the input record.
While the CCSR maps to values 0-3, these values require a procedure rank, but no rank is
included in the TUVA procedure model.
This table doesn't include any category descriptions, but category and parent category descriptions
can be found by querying the target column name against the `ccsr_procedure_category_map` intermediate model.
columns:
- name: encounter_id
description: The encounter_id for the encounter where this procedure was performed.
- name: patient_id
description: Unique identifier for each patient.
- name: prccsr_version
description: The version number of the CCSR program from which the dbt model was derived.
- 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.

## Staging

- name: ccsr__stg_core__condition
Expand Down
59 changes: 0 additions & 59 deletions models/ccsr/final/ccsr__wide_condition_category.sql

This file was deleted.

33 changes: 0 additions & 33 deletions models/ccsr/final/ccsr__wide_procedure_category.sql

This file was deleted.

Loading

0 comments on commit 82c145c

Please sign in to comment.