-
Notifications
You must be signed in to change notification settings - Fork 58
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
J'aime Tue
committed
Dec 20, 2024
1 parent
d701616
commit 5b26814
Showing
12 changed files
with
550 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
models/medical_economics/data_visualization/medical_economics__dim_apr_drg.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,11 @@ | ||
with apr_drg as ( | ||
|
||
select | ||
apr_drg_code | ||
, apr_drg_description | ||
from {{ ref('terminology__apr_drg') }} | ||
|
||
) | ||
|
||
select * | ||
from apr_drg |
22 changes: 22 additions & 0 deletions
22
models/medical_economics/data_visualization/medical_economics__dim_calendar.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,22 @@ | ||
with calendar as ( | ||
|
||
select | ||
full_date | ||
, year | ||
, month | ||
, day | ||
, month_name | ||
, day_of_week_number | ||
, day_of_week_name | ||
, week_of_year | ||
, day_of_year | ||
, year_month | ||
, first_day_of_month | ||
, last_day_of_month | ||
, year_month_int | ||
from {{ ref('reference_data__calendar') }} | ||
|
||
) | ||
|
||
select * | ||
from calendar |
28 changes: 28 additions & 0 deletions
28
models/medical_economics/data_visualization/medical_economics__dim_condition_group.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,28 @@ | ||
with condition_group_distinct as ( | ||
|
||
select distinct | ||
condition_group_1 | ||
, condition_group_2 | ||
, condition_group_3 | ||
from {{ ref('medical_economics__specialty_condition_grouper_medical_claim') }} | ||
|
||
), | ||
|
||
condition_group_final as ( | ||
|
||
select | ||
condition_group_1 | ||
, condition_group_2 | ||
, condition_group_3 | ||
, row_number() over ( | ||
order by | ||
condition_group_1 | ||
, condition_group_2 | ||
, condition_group_3 | ||
) as condition_group_id | ||
from condition_group_distinct | ||
|
||
) | ||
|
||
select * | ||
from condition_group_final |
11 changes: 11 additions & 0 deletions
11
models/medical_economics/data_visualization/medical_economics__dim_hcpcs.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,11 @@ | ||
with hcpcs as ( | ||
|
||
select | ||
hcpcs_cd as hcpcs_code | ||
, rbcs_family_desc as hcpcs_description | ||
from {{ ref('terminology__hcpcs_to_rbcs') }} | ||
|
||
) | ||
|
||
select * | ||
from hcpcs |
11 changes: 11 additions & 0 deletions
11
models/medical_economics/data_visualization/medical_economics__dim_ms_drg.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,11 @@ | ||
with ms_drg as ( | ||
|
||
select | ||
ms_drg_code | ||
, ms_drg_description | ||
from {{ ref('terminology__ms_drg') }} | ||
|
||
) | ||
|
||
select * | ||
from ms_drg |
27 changes: 27 additions & 0 deletions
27
models/medical_economics/data_visualization/medical_economics__dim_patient.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,27 @@ | ||
with patient as ( | ||
|
||
select | ||
person_id | ||
, first_name | ||
, last_name | ||
, sex | ||
, race | ||
, birth_date | ||
, death_date | ||
, address | ||
, city | ||
, state | ||
, zip_code | ||
, county | ||
, latitude | ||
, longitude | ||
, phone | ||
, age | ||
, age_group | ||
, data_source | ||
from {{ ref('core__patient') }} | ||
|
||
) | ||
|
||
select * | ||
from patient |
24 changes: 24 additions & 0 deletions
24
models/medical_economics/data_visualization/medical_economics__dim_provider.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,24 @@ | ||
with provider as ( | ||
|
||
select | ||
npi | ||
, entity_type_description | ||
, primary_specialty_description | ||
, provider_first_name | ||
, provider_last_name | ||
, provider_organization_name | ||
, parent_organization_name | ||
, practice_address_line_1 | ||
, practice_address_line_2 | ||
, practice_city | ||
, practice_zip_code | ||
, mailing_telephone_number | ||
, location_telephone_number | ||
, official_telephone_number | ||
, last_updated | ||
from {{ ref('terminology__provider') }} | ||
|
||
) | ||
|
||
select * | ||
from provider |
28 changes: 28 additions & 0 deletions
28
models/medical_economics/data_visualization/medical_economics__dim_service_category.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,28 @@ | ||
with service_category_distinct as ( | ||
|
||
select distinct | ||
service_category_1 | ||
, service_category_2 | ||
, service_category_3 | ||
from {{ ref('medical_economics__specialty_condition_grouper_medical_claim') }} | ||
|
||
), | ||
|
||
service_category_final as ( | ||
|
||
select | ||
service_category_1 | ||
, service_category_2 | ||
, service_category_3 | ||
, row_number() over ( | ||
order by | ||
service_category_1 | ||
, service_category_2 | ||
, service_category_3 | ||
) as service_category_id | ||
from service_category_distinct | ||
|
||
) | ||
|
||
select * | ||
from service_category_final |
21 changes: 21 additions & 0 deletions
21
models/medical_economics/data_visualization/medical_economics__dim_specialty_provider.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,21 @@ | ||
with provider_distinct as ( | ||
|
||
select distinct | ||
primary_specialty_description as specialty_provider | ||
from {{ ref('terminology__provider') }} | ||
|
||
), | ||
|
||
provider as ( | ||
|
||
select | ||
specialty_provider | ||
, row_number() over ( | ||
order by specialty_provider | ||
) as specialty_provider_id | ||
from provider_distinct | ||
|
||
) | ||
|
||
select * | ||
from provider |
27 changes: 27 additions & 0 deletions
27
models/medical_economics/data_visualization/medical_economics__fact_medical_claim.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,27 @@ | ||
select | ||
aa.person_id | ||
, aa.claim_id | ||
, aa.payer | ||
, aa.claim_start_date | ||
, aa.claim_end_date | ||
, aa.claim_line_number | ||
, cc.service_category_id | ||
, aa.ms_drg_code | ||
, aa.apr_drg_code | ||
, aa.hcpcs_code | ||
, aa.rendering_id | ||
, aa.paid_amount | ||
, aa.allowed_amount | ||
, bb.condition_group_id | ||
, dd.specialty_provider_id | ||
from {{ ref('medical_economics__specialty_condition_grouper_medical_claim') }} aa | ||
left join {{ ref('medical_economics__dim_condition_group') }} bb | ||
on aa.condition_group_1 = bb.condition_group_1 | ||
on aa.condition_group_2 = bb.condition_group_2 | ||
on aa.condition_group_3 = bb.condition_group_3 | ||
left join {{ ref('medical_economics__dim_service_category') }} cc | ||
on aa.service_category_1 = cc.service_category_1 | ||
on aa.service_category_2 = cc.service_category_2 | ||
on aa.service_category_3 = cc.service_category_3 | ||
left join {{ ref('medical_economics__dim_service_category') }} dd | ||
on aa.specialty_provider = dd.specialty_provider |
8 changes: 8 additions & 0 deletions
8
models/medical_economics/data_visualization/medical_economics__fact_member_months.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,8 @@ | ||
select | ||
person_id | ||
, payer | ||
, year_month | ||
, member_month | ||
, payment_risk_score | ||
, risk_adjusted_member_months | ||
from {{ ref('medical_economics__risk_adjusted_member_months') }} |
Oops, something went wrong.