diff --git a/src/main/resources/db-scripts/clickhouse/clickhouse.sql b/src/main/resources/db-scripts/clickhouse/clickhouse.sql
index 4b155562c08..c0ca2f37f5a 100644
--- a/src/main/resources/db-scripts/clickhouse/clickhouse.sql
+++ b/src/main/resources/db-scripts/clickhouse/clickhouse.sql
@@ -333,13 +333,13 @@ FROM
CREATE TABLE IF NOT EXISTS generic_assay_data_derived
(
sample_unique_id String,
+ patient_unique_id String,
genetic_entity_id String,
value String,
generic_assay_type String,
profile_stable_id String,
entity_stable_id String,
datatype String,
- patient_level NUMERIC,
profile_type String
)
ENGINE = MergeTree()
@@ -348,13 +348,13 @@ CREATE TABLE IF NOT EXISTS generic_assay_data_derived
INSERT INTO TABLE generic_assay_data_derived
SELECT
sd.sample_unique_id as sample_unique_id,
+ sd.patient_unique_id as patient_unique_id,
genetic_entity_id,
value,
generic_assay_type,
profile_stable_id,
entity_stable_id,
datatype,
- patient_level,
replaceOne(profile_stable_id, concat(cs.cancer_study_identifier, '_'), '') as profile_type
FROM
(SELECT
@@ -366,7 +366,6 @@ FROM
genetic_profile_id,
profile_stable_id,
entity_stable_id,
- patient_level,
datatype
FROM
(SELECT
@@ -378,7 +377,6 @@ FROM
gp.stable_id as profile_stable_id,
ge.stable_id as entity_stable_id,
gp.datatype as datatype,
- gp.patient_level as patient_level,
arrayMap(x -> (x = '' ? NULL : x), splitByString(',', assumeNotNull(substring(ga.values, 1, -1)))) AS value,
arrayMap(x -> (x = '' ? NULL : toInt64(x)), splitByString(',', assumeNotNull(substring(gps.ordered_sample_list, 1, -1)))) AS sample_id
FROM genetic_profile gp
diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml
index 1d1eff9d1f2..c83ea5d3f43 100644
--- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml
+++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml
@@ -565,7 +565,7 @@
SELECT sample_unique_id, patient_unique_id, value, datatype
- FROM generic_assay_data_derived_patient
+ FROM generic_assay_data_derived
WHERE profile_type = #{genericAssayDataFilter.profileType}
AND entity_stable_id = #{genericAssayDataFilter.stableId}
diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml
index 2ae5ced9a2b..d714eedfc20 100644
--- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml
+++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml
@@ -315,7 +315,7 @@
entity_stable_id AS stableId,
value,
cast(count(*) AS INTEGER) AS count
- FROM generic_assay_data_derived_patient
+ FROM generic_assay_data_derived
@@ -723,7 +723,7 @@
AS value,
cast(count(value) as INTEGER) AS count
- FROM generic_assay_data_derived_patient
+ FROM generic_assay_data_derived