Skip to content

Commit

Permalink
Standardize syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah-tuva committed Aug 22, 2024
1 parent c2d77de commit 8234e4f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions models/intermediate/diagnosis_pivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ select
, poa.diagnosis_poa_24
, poa.diagnosis_poa_25
from diagnois_pivot as dx
inner join poa_pivot as poa
on dx.cur_clm_uniq_id = poa.cur_clm_uniq_id
inner join poa_pivot as poa
on dx.cur_clm_uniq_id = poa.cur_clm_uniq_id
/* filtering out null values from seed file */
where dx.cur_clm_uniq_id is not null
44 changes: 22 additions & 22 deletions models/intermediate/institutional_claims.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ with claim_line as (
a.cur_clm_uniq_id as claim_id
, b.clm_line_num as claim_line_number
, row_number() over(partition by a.cur_clm_uniq_id order by b.clm_line_num) as claim_row_number
from {{ ref('stg_parta_claims_header') }} a
left join {{ ref('stg_parta_claims_revenue_center_detail') }} b
on a.cur_clm_uniq_id = b.cur_clm_uniq_id
from {{ ref('stg_parta_claims_header') }} as a
left join {{ ref('stg_parta_claims_revenue_center_detail') }} as b
on a.cur_clm_uniq_id = b.cur_clm_uniq_id

)

Expand All @@ -17,9 +17,9 @@ with claim_line as (
, a.claim_line_number
, a.claim_row_number
, b.clm_pmt_amt as paid_amount
from claim_line a
inner join {{ ref('stg_parta_claims_header') }} b
on a.claim_id = b.cur_clm_uniq_id
from claim_line as a
inner join {{ ref('stg_parta_claims_header') }} as b
on a.claim_id = b.cur_clm_uniq_id
where a.claim_row_number = 1

)
Expand All @@ -31,10 +31,10 @@ with claim_line as (
, a.claim_line_number
, a.claim_row_number
, b.paid_amount
from claim_line a
left join add_header_paid_amount b
on a.claim_id = b.claim_id
and a.claim_row_number = b.claim_row_number
from claim_line as a
left join add_header_paid_amount as b
on a.claim_id = b.claim_id
and a.claim_row_number = b.claim_row_number

)

Expand Down Expand Up @@ -197,15 +197,15 @@ select
, {{ try_to_cast_date('px.procedure_date_25', 'YYYY-MM-DD') }} as procedure_date_25
, cast(1 as int) as in_network_flag
, 'medicare cclf' as data_source
, cast(a.file_name as {{ dbt.type_string() }} ) as file_name
, cast(a.ingest_datetime as {{ dbt.type_timestamp() }} ) as ingest_datetime
from claim_line_a a
left join {{ ref('stg_parta_claims_header') }} h
on a.claim_id = h.cur_clm_uniq_id
left join {{ ref('stg_parta_claims_revenue_center_detail') }} d
on a.claim_id = d.cur_clm_uniq_id
and a.claim_line_number = d.clm_line_num
left join {{ ref('procedure_pivot') }} px
on cast(a.claim_id as {{ dbt.type_string() }} ) = cast(px.cur_clm_uniq_id as {{ dbt.type_string() }} )
left join {{ ref('diagnosis_pivot') }} dx
on cast(a.claim_id as {{ dbt.type_string() }} ) = cast(dx.cur_clm_uniq_id as {{ dbt.type_string() }} )
, cast(h.file_name as {{ dbt.type_string() }} ) as file_name
, cast(h.ingest_datetime as {{ dbt.type_timestamp() }} ) as ingest_datetime
from claim_line_a as a
left join {{ ref('stg_parta_claims_header') }} as h
on a.claim_id = h.cur_clm_uniq_id
left join {{ ref('stg_parta_claims_revenue_center_detail') }} as d
on a.claim_id = d.cur_clm_uniq_id
and a.claim_line_number = d.clm_line_num
left join {{ ref('procedure_pivot') }} as px
on cast(a.claim_id as {{ dbt.type_string() }} ) = cast(px.cur_clm_uniq_id as {{ dbt.type_string() }} )
left join {{ ref('diagnosis_pivot') }} as dx
on cast(a.claim_id as {{ dbt.type_string() }} ) = cast(dx.cur_clm_uniq_id as {{ dbt.type_string() }} )
6 changes: 3 additions & 3 deletions models/intermediate/procedure_pivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ select
, d.procedure_date_23
, d.procedure_date_24
, d.procedure_date_25
from procedure_pivot px
inner join date_pivot d
on px.cur_clm_uniq_id = d.cur_clm_uniq_id
from procedure_pivot as px
inner join date_pivot as d
on px.cur_clm_uniq_id = d.cur_clm_uniq_id
/* filtering out null values from seed file */
where px.cur_clm_uniq_id is not null

0 comments on commit 8234e4f

Please sign in to comment.