diff --git a/DESCRIPTION b/DESCRIPTION index 0dc4a71..659dc1b 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: fbcheck Title: Web Interface for Data Quality and Processing -Version: 2.0.4 +Version: 2.0.5 Authors@R: c( person("Omar","Benites",,"obacc07@gmail.com",c("aut","cre")) ) diff --git a/R/fbcheck_server_sbase.R b/R/fbcheck_server_sbase.R index d6bfbc1..9de541c 100755 --- a/R/fbcheck_server_sbase.R +++ b/R/fbcheck_server_sbase.R @@ -73,6 +73,7 @@ fbcheck_server_sbase <- function(input, output, session, values) { } ####### Show Warnings to users ####### + #ToDo: Include plot_id if(!is.element("plot_name", names(dt))){ shinysky::showshinyalert(session, "alert_fbapp_warning_sbase", paste("ERROR: The file imported does not has 'plot_name' header."), styleclass = "danger") } else if(nrow(dt)==1){ @@ -175,6 +176,20 @@ fbcheck_server_sbase <- function(input, output, session, values) { incProgress(2/6, detail = paste("Formatting hidap file...")) fb<- DF #hidap2fbApp(fieldbook = DF) + exportFormat <- input$fbcheck_fbapp_ExportFormat_sbase + if(exportFormat=="Simple"){ + names(fb)[1] <- "observationunit_name" + #Remove unncesary columns for simple format + #ToDo: ask if user need 'plot_id' column in 'simple' format for sweetpotatobase + fb$accession_name <- fb$plot_id <- fb$plot_number <- fb$block_number <- fb$is_a_control <- fb$rep_number <- fb$row_number <- fb$col_number <- NULL + fb <- fb + + } else { + fb + } + + + incProgress(3/6, detail = paste("Downloading FieldBookApp-SPBase file...")) incProgress(4/6, detail = paste("Refreshing HIDAP...")) Sys.sleep(3) @@ -251,6 +266,7 @@ fbcheck_server_sbase <- function(input, output, session, values) { xdate <- Sys.time() v_study <- input$file_fbapp_sbase$name + v_study <- gsub(".csv", "", v_study) uploadDate <- as.character(xdate, "%Y%m%d%H%M%S") uploadDate_s <- as.character(xdate, "%Y-%m-%d %H:%M:%S") diff --git a/R/fbcheck_ui_sbase.R b/R/fbcheck_ui_sbase.R index e6fe983..408eb60 100755 --- a/R/fbcheck_ui_sbase.R +++ b/R/fbcheck_ui_sbase.R @@ -49,14 +49,22 @@ fbcheck_ui_sbase <- function(type="tab", title="Data Quality and Processing", na # condition = "input.fbdesign_dsource_sbase == 'FieldBookApp-SPBase'", column(6, shiny::fileInput(inputId = "file_fbapp_sbase", label = "Choose CSV File", multiple = FALSE, - accept = c("text/csv","text/comma-separated-values,text/plain", ".csv")) + accept = c("text/csv","text/comma-separated-values,text/plain", ".csv")), + + selectInput(inputId = "fbcheck_fbapp_ExportFormat_sbase",label = "Spreadsheet format download",choices = c("Simple","Standard"), selected = 2) + + ), column(6, # HTML('
'), HTML('
'), br(), shiny::downloadButton('downloadData', 'Download', class = "btn-primary",style="color: #fff;"), - actionButton('saveData', 'Save', icon=icon("save"), width = 100), + + ################## HIDAP REGISTRY ######################################### + #actionButton('saveData', 'Save', icon=icon("save"), width = 100), + ######################################### ################################## + HTML('
') ),