|
16 | 16 | count(DISTINCT patient_unique_id) AS count |
17 | 17 | FROM clinical_event_derived |
18 | 18 | <where> |
| 19 | + <if test="studyViewFilterContext.customDataFilterCancerStudies != null and !studyViewFilterContext.customDataFilterCancerStudies.isEmpty()"> |
| 20 | + cancer_study_identifier IN |
| 21 | + <foreach item="studyId" collection="studyViewFilterContext.customDataFilterCancerStudies" open="(" separator="," close=")"> |
| 22 | + #{studyId} |
| 23 | + </foreach> |
| 24 | + AND |
| 25 | + </if> |
19 | 26 | lower(event_type) = 'treatment' |
20 | 27 | AND key = 'AGENT' |
21 | 28 | AND |
|
34 | 41 | patient_unique_id |
35 | 42 | FROM clinical_event_derived |
36 | 43 | <where> |
| 44 | + <if test="studyViewFilterContext.customDataFilterCancerStudies != null and !studyViewFilterContext.customDataFilterCancerStudies.isEmpty()"> |
| 45 | + cancer_study_identifier IN |
| 46 | + <foreach item="studyId" collection="studyViewFilterContext.customDataFilterCancerStudies" open="(" separator="," close=")"> |
| 47 | + #{studyId} |
| 48 | + </foreach> |
| 49 | + AND |
| 50 | + </if> |
37 | 51 | lower(event_type) = 'treatment' |
38 | 52 | AND key = 'AGENT' |
39 | 53 | AND |
|
48 | 62 | count(distinct ced.value) AS totalSamples |
49 | 63 | FROM clinical_event_derived ced |
50 | 64 | <where> |
| 65 | + <if test="studyViewFilterContext.customDataFilterCancerStudies != null and !studyViewFilterContext.customDataFilterCancerStudies.isEmpty()"> |
| 66 | + cancer_study_identifier IN |
| 67 | + <foreach item="studyId" collection="studyViewFilterContext.customDataFilterCancerStudies" open="(" separator="," close=")"> |
| 68 | + #{studyId} |
| 69 | + </foreach> |
| 70 | + AND |
| 71 | + </if> |
| 72 | + (event_type ILIKE 'Sample Acquisition' OR event_type ILIKE 'SPECIMEN') |
51 | 73 | AND key = 'SAMPLE_ID' |
52 | | - AND (event_type ILIKE 'Sample Acquisition' OR event_type ILIKE 'SPECIMEN') |
53 | 74 | AND |
54 | 75 | concat(ced.cancer_study_identifier, '_', ced.value) IN ( <include refid="org.cbioportal.infrastructure.repository.clickhouse.studyview.ClickhouseStudyViewFilterMapper.sampleUniqueIdsFromStudyViewFilter"/>) |
55 | 76 | AND |
|
58 | 79 | patient_unique_id |
59 | 80 | FROM clinical_event_derived |
60 | 81 | <where> |
| 82 | + <if test="studyViewFilterContext.customDataFilterCancerStudies != null and !studyViewFilterContext.customDataFilterCancerStudies.isEmpty()"> |
| 83 | + cancer_study_identifier IN |
| 84 | + <foreach item="studyId" collection="studyViewFilterContext.customDataFilterCancerStudies" open="(" separator="," close=")"> |
| 85 | + #{studyId} |
| 86 | + </foreach> |
| 87 | + AND |
| 88 | + </if> |
61 | 89 | lower(event_type) = 'treatment' |
62 | 90 | AND key = 'AGENT' |
63 | 91 | AND |
|
85 | 113 | ced.cancer_study_identifier AS cancer_study_identifier |
86 | 114 | FROM clinical_event_derived ced |
87 | 115 | <where> |
88 | | - key = 'SAMPLE_ID' |
89 | | - AND (event_type ILIKE 'Sample Acquisition' OR event_type ILIKE 'SPECIMEN') |
| 116 | + <if test="studyViewFilterContext.customDataFilterCancerStudies != null and !studyViewFilterContext.customDataFilterCancerStudies.isEmpty()"> |
| 117 | + cancer_study_identifier IN |
| 118 | + <foreach item="studyId" collection="studyViewFilterContext.customDataFilterCancerStudies" open="(" separator="," close=")"> |
| 119 | + #{studyId} |
| 120 | + </foreach> |
| 121 | + AND |
| 122 | + </if> |
| 123 | + (event_type ILIKE 'Sample Acquisition' OR event_type ILIKE 'SPECIMEN') |
| 124 | + AND key = 'SAMPLE_ID' |
90 | 125 | </where> |
91 | 126 | GROUP BY patient_unique_id, ced.value, cancer_study_identifier |
92 | 127 | </sql> |
|
98 | 133 | argMin(start_date, start_date) AS treatment_time_taken |
99 | 134 | FROM clinical_event_derived |
100 | 135 | <where> |
| 136 | + <if test="studyViewFilterContext.customDataFilterCancerStudies != null and !studyViewFilterContext.customDataFilterCancerStudies.isEmpty()"> |
| 137 | + cancer_study_identifier IN |
| 138 | + <foreach item="studyId" collection="studyViewFilterContext.customDataFilterCancerStudies" open="(" separator="," close=")"> |
| 139 | + #{studyId} |
| 140 | + </foreach> |
| 141 | + AND |
| 142 | + </if> |
101 | 143 | lower(event_type) = 'treatment' |
102 | 144 | AND key = 'AGENT' |
103 | 145 | </where> |
|
0 commit comments