-
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.
- Loading branch information
Showing
15 changed files
with
185 additions
and
128 deletions.
There are no files selected for viewing
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
39 changes: 39 additions & 0 deletions
39
healthcare_data/models/figures/insurance_plan_payment_histogram.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,39 @@ | ||
{{ config(materialized='external', location=var('output_path') + '/' + this.name + '.parquet') }} | ||
|
||
WITH commercial_data AS ( | ||
SELECT | ||
PLAN_PMT_AMT AS Payment, | ||
COUNT(*) AS count, | ||
'Commercial' AS Insurance | ||
FROM read_parquet('/Users/me/data/syh_dr/syhdr_commercial_inpatient_2016.parquet') | ||
GROUP BY PLAN_PMT_AMT | ||
), | ||
medicaid_data AS ( | ||
SELECT | ||
PLAN_PMT_AMT AS Payment, | ||
COUNT(*) AS count, | ||
'Medicaid' AS Insurance | ||
FROM read_parquet('/Users/me/data/syh_dr/syhdr_medicaid_inpatient_2016.parquet') | ||
GROUP BY PLAN_PMT_AMT | ||
), | ||
medicare_data AS ( | ||
SELECT | ||
PLAN_PMT_AMT AS Payment, | ||
COUNT(*) AS count, | ||
'Medicare' AS Insurance | ||
FROM read_parquet('/Users/me/data/syh_dr/syhdr_medicare_inpatient_2016.parquet') | ||
GROUP BY PLAN_PMT_AMT | ||
), | ||
combined_data AS ( | ||
SELECT * FROM commercial_data | ||
UNION ALL | ||
SELECT * FROM medicaid_data | ||
UNION ALL | ||
SELECT * FROM medicare_data | ||
) | ||
SELECT | ||
Payment, | ||
count, | ||
Insurance | ||
FROM combined_data | ||
ORDER BY Insurance, Payment |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.