-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename to person_id_crosswalk and add data types
- Loading branch information
1 parent
24039c1
commit a312b58
Showing
3 changed files
with
52 additions
and
52 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
This file was deleted.
Oops, something went wrong.
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,49 @@ | ||
{{ config( | ||
enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))) | ||
| as_bool | ||
) | ||
}} | ||
|
||
{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%} | ||
|
||
select distinct | ||
cast(person_id as {{ dbt.type_string() }}) as person_id | ||
, cast(null as {{ dbt.type_string() }}) as patient_id | ||
, cast(member_id as {{ dbt.type_string() }}) as member_id | ||
, cast(payer as {{ dbt.type_string() }}) as payer | ||
, cast({{ quote_column('plan') }} as {{ dbt.type_string() }}) as {{ quote_column('plan') }} | ||
, cast(data_source as {{ dbt.type_string() }}) as data_source | ||
from {{ ref('normalized_input__eligibility')}} | ||
union all | ||
select distinct | ||
cast(person_id as {{ dbt.type_string() }}) as person_id | ||
, cast(patient_id 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 {{ quote_column('plan') }} | ||
, cast(data_source as {{ dbt.type_string() }}) as data_source | ||
from {{ ref('patient') }} | ||
|
||
{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%} | ||
|
||
select distinct | ||
cast(person_id as {{ dbt.type_string() }}) as person_id | ||
, cast(patient_id 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 {{ quote_column('plan') }} | ||
, cast(data_source as {{ dbt.type_string() }}) as data_source | ||
from {{ ref('patient') }}from {{ ref('patient') }} | ||
|
||
{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%} | ||
|
||
select distinct | ||
cast(person_id as {{ dbt.type_string() }}) as person_id | ||
, cast(null as {{ dbt.type_string() }}) as patient_id | ||
, cast(member_id as {{ dbt.type_string() }}) as member_id | ||
, cast(payer as {{ dbt.type_string() }}) as payer | ||
, cast({{ quote_column('plan') }} as {{ dbt.type_string() }}) as {{ quote_column('plan') }} | ||
, cast(data_source as {{ dbt.type_string() }}) as data_source | ||
from {{ ref('normalized_input__eligibility') }} | ||
|
||
{%- endif %} |