Skip to content

Commit

Permalink
fix: force removing duplicate encounters
Browse files Browse the repository at this point in the history
  • Loading branch information
TanookiVerde committed Aug 28, 2024
1 parent e817de4 commit 0a04536
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ with
-- Encounter Data
merged_data.*,
from merged_data
),
ranked as (
select
*,
row_number() over (partition by id_atendimento) as rank
from fingerprinted
)
select
*,
from fingerprinted
from ranked
where rank = 1
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,17 @@ with
array(
select descricao from unnest(condicoes) where descricao is not null
) as active_cids,
struct(
profissional_saude_responsavel[safe_offset(0)].nome as name,
profissional_saude_responsavel[safe_offset(0)].especialidade as role
) as responsible,
case
when
profissional_saude_responsavel[safe_offset(0)].nome is not null and
profissional_saude_responsavel[safe_offset(0)].especialidade is not null
then
struct(
profissional_saude_responsavel[safe_offset(0)].nome as name,
profissional_saude_responsavel[safe_offset(0)].especialidade as role
)
else null
end as responsible,
motivo_atendimento as clinical_motivation,
desfecho_atendimento as clinical_outcome,
case
Expand Down

0 comments on commit 0a04536

Please sign in to comment.