From 350e76986e85def0a19d8d8fa2c9af6d57624a83 Mon Sep 17 00:00:00 2001 From: cristinamullin <46969696+cristinamullin@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:51:30 -0500 Subject: [PATCH] Update mod_query_data.R run autoclean and check required fields when data is uploaded in Option C on import tab --- R/mod_query_data.R | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/R/mod_query_data.R b/R/mod_query_data.R index f5b716bb..4cb6944c 100644 --- a/R/mod_query_data.R +++ b/R/mod_query_data.R @@ -267,8 +267,19 @@ mod_query_data_server <- function(id, tadat) { ) # user uploaded data - raw <- - suppressWarnings(readxl::read_excel(input$file$datapath, sheet = 1)) + raw <- suppressWarnings(readxl::read_excel(input$file$datapath, sheet = 1)) + + # run code included in TADA data retrieval + # need to specify this or throws error when trying to bind rows. Temporary fix for larger + # issue where data structure for all columns should be specified. + cols <- names(raw) + raw <- raw %>% dplyr::mutate_at(cols, as.character) + # # check that all TADA template columns are included, commented out for now. + # raw <- EPATADA::TADA_CheckRequiredFields(raw) + # run autoclean + raw <- EPATADA::TADA_AutoClean(raw) + + # other steps to prepare data for app raw$TADA.Remove <- NULL initializeTable(tadat, raw) if (!is.null(tadat$original_source)) {