From b9b5454f37e1da12eb7e04368a590b104c2b2034 Mon Sep 17 00:00:00 2001 From: Spamhurts Date: Mon, 9 Feb 2026 13:49:47 -0600 Subject: [PATCH] 1. fixed issue where the milliseconds differ in the modified time causing pivoted rows to be displayed on mulitiple lines. 2. updated query source to match database view used on the production server. --- .../resources/queries/snprc_ehr/MhcDataPivot.sql | 15 ++++++++------- .../source_queries/create_v_MchStatus.sql | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/snprc_ehr/resources/queries/snprc_ehr/MhcDataPivot.sql b/snprc_ehr/resources/queries/snprc_ehr/MhcDataPivot.sql index b724529c4..f0f3165c0 100644 --- a/snprc_ehr/resources/queries/snprc_ehr/MhcDataPivot.sql +++ b/snprc_ehr/resources/queries/snprc_ehr/MhcDataPivot.sql @@ -1,11 +1,12 @@ SELECT b.Id, + b.modified, b.Haplotype, b.Ocid, b.DataFileSource, - b.modified, group_concat(b.MhcValue) as MhcValue + FROM ( SELECT b.Id, @@ -13,13 +14,13 @@ FROM ( b.Ocid, b.MhcValue, b.DataFileSource, - b.Modified + cast(b.modified as varchar) as modified FROM snprc_ehr.MhcData as b - ) as b + ) as b GROUP BY b.id, b.ocid, b.DataFileSource, b.haplotype, b.modified -PIVOT MhcValue BY Haplotype IN -(select distinct Haplotype from snprc_ehr.MhcData order by Haplotype - -) + PIVOT MhcValue BY Haplotype IN +( + select distinct Haplotype from snprc_ehr.MhcData order by Haplotype +) \ No newline at end of file diff --git a/snprc_ehr/resources/source_queries/create_v_MchStatus.sql b/snprc_ehr/resources/source_queries/create_v_MchStatus.sql index bc55df595..bbda2ff6c 100644 --- a/snprc_ehr/resources/source_queries/create_v_MchStatus.sql +++ b/snprc_ehr/resources/source_queries/create_v_MchStatus.sql @@ -44,7 +44,7 @@ SELECT m.[Animal ID] AS id , FROM dbo.MhcStatus AS m -- select primates only from the TxBiomed colony INNER JOIN labkey_etl.V_DEMOGRAPHICS AS d ON d.id = RIGHT(SPACE(6) + m.[Animal ID], 6) -WHERE [A001 Status] IS NOT NULL AND [B008 Status] IS NOT NULL AND [B017 Status] IS NOT NULL AND [B003 Status] IS NOT NULL +WHERE [A001 Status] IS NOT NULL OR [B008 Status] IS NOT NULL OR [B017 Status] IS NOT NULL OR [B003 Status] IS NOT NULL GO