Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Data model changes issue279 #56

Merged
merged 4 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ profile: default
vars:

## Set the database and schema where raw CCLF data is stored
input_database: default
input_schema: default
thutuva marked this conversation as resolved.
Show resolved Hide resolved
input_database: dev_ci_testing
input_schema: cclf

claims_enabled: true

Expand Down
1 change: 1 addition & 0 deletions models/final/eligibility.sql
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ joined as (
, enrollment_span.enrollment_end_date_last as enrollment_end_date
, 'medicare' as payer
, 'medicare' as payer_type
, 'medicare' as plan
, cast(bene_orgnl_entlmt_rsn_cd as {{ dbt.type_string() }} ) as original_reason_entitlement_code
, cast(demographics.bene_dual_stus_cd as {{ dbt.type_string() }} ) as dual_status_code
, cast(demographics.bene_mdcr_stus_cd as {{ dbt.type_string() }} ) as medicare_status_code
Expand Down
5 changes: 5 additions & 0 deletions models/final/pharmacy_claim.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ select
,cast(null as {{ dbt.type_string() }}) as CLAIM_LINE_NUMBER
,cast(null as {{ dbt.type_string() }}) as PATIENT_ID
,cast(null as {{ dbt.type_string() }}) as MEMBER_ID
,cast(null as {{ dbt.type_string() }}) as PAYER
,cast(null as {{ dbt.type_string() }}) as PLAN
,cast(null as {{ dbt.type_string() }}) as PRESCRIBING_PROVIDER_NPI
,cast(null as {{ dbt.type_string() }}) as DISPENSING_PROVIDER_NPI
,cast(null as date ) as DISPENSING_DATE
Expand All @@ -13,5 +15,8 @@ select
,cast(null as date) as PAID_DATE
,cast(null as numeric) as PAID_AMOUNT
,cast(null as numeric) as ALLOWED_AMOUNT
,cast(null as numeric) as COPAYMENT_AMOUNT
,cast(null as numeric) as COINSURANCE_AMOUNT
,cast(null as numeric) as DEDUCTIBLE_AMOUNT
,cast(null as {{ dbt.type_string() }}) as DATA_SOURCE
limit 0
7 changes: 6 additions & 1 deletion models/intermediate/dme_claims.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ select
, 'professional' as claim_type
, cast(bene_mbi_id as {{ dbt.type_string() }} ) as patient_id
, cast(bene_mbi_id as {{ dbt.type_string() }} ) as member_id
, cast(NULL as {{ dbt.type_string() }} ) as payer
, cast(NULL as {{ dbt.type_string() }} ) as plan
, {{ try_to_cast_date('clm_from_dt', 'YYYY-MM-DD') }} as claim_start_date
, {{ try_to_cast_date('clm_thru_dt', 'YYYY-MM-DD') }} as claim_end_date
, {{ try_to_cast_date('clm_line_from_dt', 'YYYY-MM-DD') }} as claim_line_start_date
Expand All @@ -30,9 +32,12 @@ select
, cast(NULL as {{ dbt.type_string() }} ) as facility_npi
, cast(NULL as date) as paid_date
, {{ cast_numeric('clm_line_cvrd_pd_amt') }} as paid_amount
, {{ cast_numeric('NULL') }} as total_cost_amount
, {{ cast_numeric('clm_line_alowd_chrg_amt') }} as allowed_amount
, {{ cast_numeric('clm_line_alowd_chrg_amt') }} as charge_amount
, {{ cast_numeric('NULL') }} as coinsurance_amount
, {{ cast_numeric('NULL') }} as copayment_amount
, {{ cast_numeric('NULL') }} as deductible_amount
, {{ cast_numeric('NULL') }} as total_cost_amount
, cast(NULL as {{ dbt.type_string() }} ) as diagnosis_code_type
, cast(NULL as {{ dbt.type_string() }} ) as diagnosis_code_1
, cast(NULL as {{ dbt.type_string() }} ) as diagnosis_code_2
Expand Down
7 changes: 6 additions & 1 deletion models/intermediate/institutional_claims.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ select
, 'institutional' as claim_type
, cast(h.bene_mbi_id as {{ dbt.type_string() }} ) as patient_id
, cast(h.bene_mbi_id as {{ dbt.type_string() }} ) as member_id
, cast(NULL as {{ dbt.type_string() }} ) as payer
, cast(NULL as {{ dbt.type_string() }} ) as plan
, {{ try_to_cast_date('h.clm_from_dt', 'YYYY-MM-DD') }} as claim_start_date
, {{ try_to_cast_date('h.clm_thru_dt', 'YYYY-MM-DD') }} as claim_end_date
, cast(NULL as date) as claim_line_start_date
Expand Down Expand Up @@ -67,9 +69,12 @@ select
, cast(h.fac_prvdr_npi_num as {{ dbt.type_string() }} ) as facility_npi
, cast(NULL as date) as paid_date
, {{ cast_numeric('a.paid_amount') }} as paid_amount
, {{ cast_numeric('NULL') }} as total_cost_amount
, {{ cast_numeric('NULL') }} as allowed_amount
, {{ cast_numeric('h.clm_mdcr_instnl_tot_chrg_amt') }} as charge_amount
, {{ cast_numeric('NULL') }} as coinsurance_amount
, {{ cast_numeric('NULL') }} as copayment_amount
, {{ cast_numeric('NULL') }} as deductible_amount
, {{ cast_numeric('NULL') }} as total_cost_amount
, case
when cast(dx.dgns_prcdr_icd_ind as {{ dbt.type_string() }} ) = '0' then 'icd-10-cm'
when cast(dx.dgns_prcdr_icd_ind as {{ dbt.type_string() }} ) = '9' then 'icd-9-cm'
Expand Down
7 changes: 6 additions & 1 deletion models/intermediate/physician_claims.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ select
, 'professional' as claim_type
, cast(bene_mbi_id as {{ dbt.type_string() }} ) as patient_id
, cast(bene_mbi_id as {{ dbt.type_string() }} ) as member_id
, cast(NULL as {{ dbt.type_string() }} ) as payer
, cast(NULL as {{ dbt.type_string() }} ) as plan
, {{ try_to_cast_date('clm_from_dt', 'YYYY-MM-DD') }} as claim_start_date
, {{ try_to_cast_date('clm_thru_dt', 'YYYY-MM-DD') }} as claim_end_date
, {{ try_to_cast_date('clm_line_from_dt', 'YYYY-MM-DD') }} as claim_line_start_date
Expand All @@ -30,9 +32,12 @@ select
, cast(NULL as {{ dbt.type_string() }} ) as facility_npi
, cast(NULL as date) as paid_date
, {{ cast_numeric('clm_line_cvrd_pd_amt') }} as paid_amount
, {{ cast_numeric('NULL') }} as total_cost_amount
, {{ cast_numeric('clm_line_alowd_chrg_amt') }} as allowed_amount
, {{ cast_numeric('clm_line_alowd_chrg_amt') }} as charge_amount
, {{ cast_numeric('NULL') }} as coinsurance_amount
, {{ cast_numeric('NULL') }} as copayment_amount
, {{ cast_numeric('NULL') }} as deductible_amount
, {{ cast_numeric('NULL') }} as total_cost_amount
, case
when cast(dgns_prcdr_icd_ind as {{ dbt.type_string() }} ) = '0' then 'icd-10-pcs'
when cast(dgns_prcdr_icd_ind as {{ dbt.type_string() }} ) = '9' then 'icd-9-pcs'
Expand Down
2 changes: 1 addition & 1 deletion packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ packages:
- package: dbt-labs/dbt_utils
version: [">=0.9.2","<1.0.0"]
- package: tuva-health/the_tuva_project
version: [">=0.5.0","<1.0.0"]
thutuva marked this conversation as resolved.
Show resolved Hide resolved
version: [">=0.6.0","<7.0.0"]
Loading