From 12d145485b90e944bb9e215a148e72d4d67b6761 Mon Sep 17 00:00:00 2001 From: Charles Haynes Date: Mon, 7 Oct 2024 14:12:22 -0400 Subject: [PATCH] Add Categorical Clinical Attribute NA filtering --- .../StudyViewFilterMapper.xml | 75 ++++++++++++++++--- 1 file changed, 63 insertions(+), 12 deletions(-) diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml index 468731e9bc1..6ae7aa8fd6f 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml @@ -370,20 +370,71 @@ + + SELECT sample_unique_id, patient_unique_id, attribute_value + FROM clinical_data_derived + WHERE attribute_name = '${clinicalDataFilter.attributeId}' AND type='${type}' + AND cancer_study_identifier IN + + #{studyId} + + - SELECT ${unique_id} - FROM ${table_name} - WHERE attribute_name = '${clinicalDataFilter.attributeId}' AND - type='${type}' - - - AND ( - - - - ) = '${dataFilterValue.value}' - + + + + + + + + + + + + + ( + + + SELECT DISTINCT ${unique_id} + FROM sample_derived sd + LEFT JOIN () AS categorical_clinical_data + ON + + + sd.sample_unique_id = categorical_clinical_data.sample_unique_id + + + sd.patient_unique_id = categorical_clinical_data.patient_unique_id + + + WHERE empty(attribute_value) + AND EXISTS () + + + + + UNION ALL + + + + + SELECT ${unique_id} + FROM ${table_name} + WHERE attribute_name = '${clinicalDataFilter.attributeId}' AND + type='${type}' + + + AND ( + + + + ) = '${dataFilterValue.value}' + + + + )