From 5a33d22e0f409cf5f410a380507b18868986d589 Mon Sep 17 00:00:00 2001 From: Gennadiy Anisimov Date: Tue, 29 Aug 2023 17:16:25 +0300 Subject: [PATCH] Fix DEVICES_BY_TYPE being always empty (#738) --- R/exportToAres.R | 4 ++-- inst/sql/sql_server/export/device/sqlDevicesByType.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/exportToAres.R b/R/exportToAres.R index a3e3b684..ed66471a 100644 --- a/R/exportToAres.R +++ b/R/exportToAres.R @@ -1473,10 +1473,10 @@ generateAODeviceReports <- function(connectionDetails, dataDevices, cdmDatabaseS dplyr::left_join( ( dataDevicesByType %>% - dplyr::select(c(3,4)) %>% + dplyr::select(c(1,4,5)) %>% tidyr::nest(DEVICES_BY_TYPE = c(-1)) ), - by = c("CONCEPT_ID" = "CONCEPT_ID") + by = c("CONCEPT_ID" = "DEVICE_CONCEPT_ID") ) %>% dplyr::left_join( ( diff --git a/inst/sql/sql_server/export/device/sqlDevicesByType.sql b/inst/sql/sql_server/export/device/sqlDevicesByType.sql index db735b82..d7c157f4 100644 --- a/inst/sql/sql_server/export/device/sqlDevicesByType.sql +++ b/inst/sql/sql_server/export/device/sqlDevicesByType.sql @@ -1,5 +1,5 @@ -select c1.concept_id as OBSERVATION_CONCEPT_ID, - c1.concept_name as OBSERVATION_CONCEPT_NAME, +select c1.concept_id as DEVICE_CONCEPT_ID, + c1.concept_name as DEVICE_CONCEPT_NAME, c2.concept_id as CONCEPT_ID, c2.concept_name as CONCEPT_NAME, ar1.count_value as COUNT_VALUE