From 8909def57b872b33a4fab3c27d7d82dc48e1695b Mon Sep 17 00:00:00 2001 From: ruhanga Date: Thu, 16 May 2024 14:11:26 +0300 Subject: [PATCH] KH-502: Concept mappings to be properly concatenated in the concepts query --- analytics/dsl/flattening/queries/concepts.sql | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/analytics/dsl/flattening/queries/concepts.sql b/analytics/dsl/flattening/queries/concepts.sql index 5002990..dfdac9c 100755 --- a/analytics/dsl/flattening/queries/concepts.sql +++ b/analytics/dsl/flattening/queries/concepts.sql @@ -1,7 +1,12 @@ SELECT DISTINCT concept.concept_id AS concept_id, LISTAGG( - CONCAT_WS(': ', concept_reference_source.name, concept_reference_term.code), ', ' - ) AS concept_mappings_source_Codes, + CASE + WHEN concept_reference_source.name != '' AND concept_reference_term.code != '' + THEN CONCAT_WS(': ', concept_reference_source.name, concept_reference_term.code) + ELSE NULL + END + , ', ' + ) AS concept_mappings_source_Codes, concept_name.name AS name, concept_name.locale AS locale, concept_name.locale_preferred AS locale_preferred,