Skip to content

Commit

Permalink
fix: visit encounter logic refactor cqm130
Browse files Browse the repository at this point in the history
  • Loading branch information
utsavpaudel committed Dec 31, 2024
1 parent 6d6ab7f commit 59bc3a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ with visit_codes as (
and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end
where lower(encounter_type) in (
'home health'
, 'office visit'
, 'outpatient'
, 'outpatient rehabilitation'
, 'telehealth'
)

or lower(encounter_group) in (
'office based'
, 'outpatient'
)

)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ select
person_id
, encounter_id
, encounter_type
, encounter_group
, length_of_stay
, encounter_start_date
, encounter_end_date
Expand All @@ -21,6 +22,7 @@ select
person_id
, encounter_id
, encounter_type
, encounter_group
, length_of_stay
, encounter_start_date
, encounter_end_date
Expand All @@ -34,6 +36,7 @@ from {{ ref('core__encounter') }}
cast(null as {{ dbt.type_string() }} ) as person_id
, cast(null as {{ dbt.type_string() }} ) as encounter_id
, cast(null as {{ dbt.type_string() }} ) as encounter_type
, cast(null as {{dbt.type_string()}} ) as encounter_group
, cast(null as {{dbt.type_numeric()}} ) as length_of_stay
, {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_start_date
, {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_end_date
Expand All @@ -43,6 +46,7 @@ from {{ ref('core__encounter') }}
cast(null as {{ dbt.type_string() }} ) as person_id
, cast(null as {{ dbt.type_string() }} ) as encounter_id
, cast(null as {{ dbt.type_string() }} ) as encounter_type
, cast(null as {{dbt.type_string()}} ) as encounter_group
, cast(null as {{dbt.type_numeric()}} ) as length_of_stay
, {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_start_date
, {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_end_date
Expand Down

0 comments on commit 59bc3a7

Please sign in to comment.