You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jsonb_array_elements(o.resource->'component') AS component
19
+
where o.resource->'code'->'coding'->0->>'code' like 'SIOrgP%'
20
+
),
21
+
t2 AS (
22
+
select t.value as pat_pseudonym,
23
+
t2.value as gender,
24
+
t6.value::numeric as age_at_enrollment
25
+
from t
26
+
left join t t2 on t.pat_ref = t2.pat_ref and t2.code='SIOP_GENDER'
27
+
left join t t6 on t.pat_ref = t6.pat_ref and t6.code='SIOP_AGE_STUDY_ENROLLMENT'
28
+
left join patient p on t.pat_ref = 'Patient/' || (p.resource->>'id')::text
29
+
where t.crf like 'SIOrgP - NeoMatch - Visite 1%' and t.code = 'SIOP_PATIENT_PSEUDONYM'
30
+
)
31
+
-- the total number of patients
32
+
select 'NeoMatch' as project, 'n_patients' as field, (select count(distinct pat_pseudonym) from t2) as value
33
+
union
34
+
select 'NeoMatch' as project, 'gender_male' as field, (select count(distinct pat_pseudonym) from t2 where gender = 'MALE') as value
35
+
union
36
+
select 'NeoMatch' as project, 'gender_female' as field, (select count(distinct pat_pseudonym) from t2 where gender = 'FEMALE') as value
37
+
union
38
+
select 'NeoMatch' as project, '<=30' as field, (select count(distinct pat_pseudonym) from t2 where age_at_enrollment <= 30) as value
39
+
union
40
+
select 'NeoMatch' as project, '31-40' as field, (select count(distinct pat_pseudonym) from t2 where age_at_enrollment >= 31 and age_at_enrollment <= 40) as value
41
+
union
42
+
select 'NeoMatch' as project, '41-50' as field, (select count(distinct pat_pseudonym) from t2 where age_at_enrollment >= 41 and age_at_enrollment <= 50) as value
43
+
union
44
+
select 'NeoMatch' as project, '51-60' as field, (select count(distinct pat_pseudonym) from t2 where age_at_enrollment >= 51 and age_at_enrollment <= 60) as value
45
+
union
46
+
select 'NeoMatch' as project, '>=61' as field, (select count(distinct pat_pseudonym) from t2 where age_at_enrollment >= 61) as value;
0 commit comments