Skip to content

Commit

Permalink
cohort characteristics should be for ONLY encounters with an **ED NOTE**
Browse files Browse the repository at this point in the history
  • Loading branch information
comorbidity committed Apr 9, 2024
1 parent a954496 commit 627da40
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--create table suicide_icd10__thesis_table1 as
--select
--count(distinct P.subject_ref) as cnt_subject,
-- P.dx_suicidality,
-- P.dx_subtype,
-- P.age_group,
-- P.gender
--from suicide_icd10__prevalence P, suicide_icd10__study_period S
--where P.encounter_ref = S.encounter_ref
--group by cube (
-- P.dx_suicidality,
-- P.dx_subtype,
-- P.age_group,
-- P.gender)
--order by
-- P.dx_suicidality,
-- P.dx_subtype,
-- P.age_group,
-- P.gender;

create table suicide_icd10__count_demographics as
select
dx_suicidality, dx_subtype, age_group, gender,
count(distinct encounter_ref) as cnt_encounter,
count(distinct subject_ref) as cnt_subject
from suicide_icd10__prevalence
where doc_ed_note
group by cube(dx_suicidality, dx_subtype, age_group, gender)
order by cnt_encounter desc, cnt_subject desc

0 comments on commit 627da40

Please sign in to comment.