From d17ba1ee2fbb86394585d16684d1f27e8a250347 Mon Sep 17 00:00:00 2001 From: Jamie Gilbert Date: Thu, 5 Oct 2023 09:48:36 -0700 Subject: [PATCH] fixed db warnings and other minor annoyances --- R/cohort-diagnostics-cohort-overlap.R | 9 ++++----- R/cohort-diagnostics-main-ui.R | 2 +- R/cohort-diagnostics-main.R | 18 +----------------- .../resources/cdDatabase/databaseFile.sqlite | Bin 3399680 -> 3911680 bytes tests/testthat/setup.R | 4 ---- tests/testthat/test-cohort-diagnostics-main.R | 1 + 6 files changed, 7 insertions(+), 27 deletions(-) diff --git a/R/cohort-diagnostics-cohort-overlap.R b/R/cohort-diagnostics-cohort-overlap.R index 164593ff..e493f832 100644 --- a/R/cohort-diagnostics-cohort-overlap.R +++ b/R/cohort-diagnostics-cohort-overlap.R @@ -211,10 +211,8 @@ cohortOverlapView <- function(id) { id = ns("overlapPlotContainer"), plotly::plotlyOutput(ns("overlapPlot"), width = "100%", height = "300px") ) - ) - ), - - # complicated way of setting plot height based on number of rows and selection type + ), + # complicated way of setting plot height based on number of rows and selection type # Note that this code is only used because renderUI/ uiOutput didn't seem to update with plotly shiny::tags$script(sprintf(" Shiny.addCustomMessageHandler('%s', function(height) { @@ -222,7 +220,8 @@ cohortOverlapView <- function(id) { plotSpace.querySelector('.svg-container').style.height = height; plotSpace.querySelector('.js-plotly-plot').style.height = height; }); - ", ns("overlapPlotHeight"), ns("overlapPlotContainer"))), + ", ns("overlapPlotHeight"), ns("overlapPlotContainer"))) + ), shiny::tabPanel( title = "Table", shiny::fluidRow( diff --git a/R/cohort-diagnostics-main-ui.R b/R/cohort-diagnostics-main-ui.R index efb7cbe6..99c78108 100644 --- a/R/cohort-diagnostics-main-ui.R +++ b/R/cohort-diagnostics-main-ui.R @@ -182,7 +182,7 @@ cohortDiagnosticsView <- function(id = "DiagnosticsExplorer") { ) ) ), - shiny::fluidPage( + shiny::tagList( shiny::conditionalPanel( ns = ns, condition = "input.tabs == 'cohortDefinitions'", diff --git a/R/cohort-diagnostics-main.R b/R/cohort-diagnostics-main.R index f653f213..cc9578f4 100644 --- a/R/cohort-diagnostics-main.R +++ b/R/cohort-diagnostics-main.R @@ -273,24 +273,8 @@ createCdDatabaseDataSource <- function( return(dataSource) } -# SO much of the app requires this table in memory - it would be much better to re-write queries to not need it! getDatabaseTable <- function(dataSource) { - - # hot fix - if(tolower(paste0(dataSource$databaseTablePrefix, dataSource$databaseTable)) == 'database_meta_data'){ - databaseTable <- dataSource$connectionHandler$queryDb( - "SELECT *, cdm_source_abbreviation as database_name FROM @schema.@table_name", - schema = dataSource$schema, - table_name = paste0(dataSource$databaseTablePrefix, dataSource$databaseTable) - ) # end hot fix - } else{ - databaseTable <- loadResultsTable( - dataSource = dataSource, - tableName = paste0(dataSource$databaseTablePrefix, dataSource$databaseTable), - required = TRUE - ) - } - + databaseTable <- loadResultsTable(dataSource, dataSource$databaseTable, required = TRUE) if (nrow(databaseTable) > 0 & "vocabularyVersion" %in% colnames(databaseTable)) { databaseTable <- databaseTable %>% diff --git a/tests/resources/cdDatabase/databaseFile.sqlite b/tests/resources/cdDatabase/databaseFile.sqlite index ee076b8551f2b5daade764588d8454de3e83d9d8..462a614102c786882342b79724b2a38e117d7db0 100644 GIT binary patch delta 5422 zcmb7|30zfW+Q9GGw+rVYAfhA}aTgU(#~HM^h-kQiflF%aD!FhIa>Vym*z@ zGUVWb%ea6fPv$hDHed5)CFInM^Oa#*IpzYDe&*KqoP&{O-}g25_xm5tdERr*^FHhQ z9$fXOC|A=}%G)U*&0=AWSS%I^S%UO0jT*qES^DKrHMylKKNv-!k+ru~&RLA7#_t7W z3^EoOhm1#3kW^#>@-*@kf^W8@BNLHH$Yf*+G7XuIJcDE)nMf9rjpQJ?NFFi+nTpIr zW+BD-cz70>jm$yjA_a&Oc@CM66e2~)^T<480kRNTge*pk$s1_DoJoyaa@3cK-S5AsK3FR~BWj~qa%ks9P6Qj5HS975_4K;A?S zBX1!`kUt@BBY#GYBK62I8`%9$`psa@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