-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from onefact/add-sydhr-models
Add sydhr models
- Loading branch information
Showing
9 changed files
with
741 additions
and
23 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
data_processing/models/ahrq.gov/syh_dr/person/syhdr_commercial_person.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
select | ||
*, | ||
'commercial' as insurance | ||
from {{ source('syh_dr', 'commercial_person') }} | ||
|
4 changes: 4 additions & 0 deletions
4
data_processing/models/ahrq.gov/syh_dr/person/syhdr_medicaid_person.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
select | ||
*, | ||
'medicaid' as insurance | ||
from {{ source('syh_dr', 'medicaid_person') }} |
4 changes: 4 additions & 0 deletions
4
data_processing/models/ahrq.gov/syh_dr/person/syhdr_medicare_person.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
select | ||
*, | ||
'medicare' as insurance | ||
from {{ source('syh_dr', 'medicare_person') }} |
12 changes: 12 additions & 0 deletions
12
data_processing/models/ahrq.gov/syh_dr/person/syhdr_person.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{ config( | ||
materialized = 'external', | ||
location = '../data/ahrq.gov/syh_dr/syhdr_person.parquet' | ||
) }} | ||
|
||
{{ dbt_utils.union_relations( | ||
relations = [ | ||
ref('syhdr_commercial_person'), | ||
ref('syhdr_medicaid_person'), | ||
ref('syhdr_medicare_person'), | ||
] | ||
) }} |
29 changes: 29 additions & 0 deletions
29
data_processing/models/ahrq.gov/syh_dr/syhdr_inpatient.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{ config( | ||
materialized = 'external', | ||
location = '../data/ahrq.gov/syh_dr/syhdr_inpatient.parquet' | ||
)}} | ||
|
||
select | ||
*, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as plan_payment_amount, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as total_charge_amount, | ||
'commercial' as insurance | ||
from {{ source('syh_dr', 'commercial_inpatient') }} | ||
|
||
union all | ||
|
||
select | ||
*, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as plan_payment_amount, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as total_charge_amount, | ||
'medicaid' as insurance | ||
from {{ source('syh_dr', 'medicaid_inpatient') }} | ||
|
||
union all | ||
|
||
select | ||
*, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as plan_payment_amount, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as total_charge_amount, | ||
'medicare' as insurance | ||
from {{ source('syh_dr', 'medicare_inpatient') }} |
29 changes: 29 additions & 0 deletions
29
data_processing/models/ahrq.gov/syh_dr/syhdr_outpatient.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{ config( | ||
materialized = 'external', | ||
location = '../data/ahrq.gov/syh_dr/syhdr_outpatient.parquet' | ||
)}} | ||
|
||
select | ||
*, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as plan_payment_amount, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as total_charge_amount, | ||
'commercial' as insurance | ||
from {{ source('syh_dr', 'commercial_outpatient') }} | ||
|
||
union all | ||
|
||
select | ||
*, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as plan_payment_amount, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as total_charge_amount, | ||
'medicaid' as insurance | ||
from {{ source('syh_dr', 'medicaid_outpatient') }} | ||
|
||
union all | ||
|
||
select | ||
*, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as plan_payment_amount, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as total_charge_amount, | ||
'medicare' as insurance | ||
from {{ source('syh_dr', 'medicare_outpatient') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{ config( | ||
materialized = 'external', | ||
location = '../data/ahrq.gov/syh_dr/syhdr_pharmacy.parquet' | ||
)}} | ||
|
||
select | ||
*, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as plan_payment_amount, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as total_charge_amount, | ||
'commercial' as insurance | ||
from {{ source('syh_dr', 'commercial_pharmacy') }} | ||
|
||
union all | ||
|
||
select | ||
*, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as plan_payment_amount, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as total_charge_amount, | ||
'medicaid' as insurance | ||
from {{ source('syh_dr', 'medicaid_pharmacy') }} | ||
|
||
union all | ||
|
||
select | ||
*, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as plan_payment_amount, | ||
replace(replace(PLAN_PMT_AMT, '$', ''), ',', '')::float as total_charge_amount, | ||
'medicare' as insurance | ||
from {{ source('syh_dr', 'medicare_pharmacy') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{ config( | ||
materialized = 'external', | ||
location = '../data/ahrq.gov/syh_dr/syhdr_provider.parquet' | ||
)}} | ||
|
||
select | ||
*, | ||
'medicaid' as insurance | ||
from {{ source('syh_dr', 'medicaid_provider') }} | ||
|
||
union all | ||
|
||
select | ||
*, | ||
'medicare' as insurance | ||
from {{ source('syh_dr', 'medicare_provider') }} |
Oops, something went wrong.