From 1f32b5a1177e0dcc9cdeef84ac76a60d4c8abfc0 Mon Sep 17 00:00:00 2001 From: Tyler Slonecki Date: Fri, 12 Jan 2024 10:11:24 -0500 Subject: [PATCH 1/9] Removed ASReml from side bar Commented out ASReml ui code and home page box in addition to Jump card --- .idea/.gitignore | 3 + .idea/MrBeanApp.iml | 9 +++ .idea/misc.xml | 6 ++ .idea/modules.xml | 8 +++ .idea/vcs.xml | 6 ++ R/app_ui.R | 132 ++++++++++++++++++++++--------------------- R/mod_home_module1.R | 75 ++++++++++++------------ 7 files changed, 138 insertions(+), 101 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/MrBeanApp.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/MrBeanApp.iml b/.idea/MrBeanApp.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/MrBeanApp.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2017086 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/R/app_ui.R b/R/app_ui.R index 038506e..25685e9 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -125,71 +125,73 @@ app_ui <- function(request) { icon = shiny::icon("circle", verify_fa = FALSE) ) ), - bs4SidebarHeader("ASReml"), - # Single spatial analysis ASReml - bs4SidebarMenuItem( - text = "Single-Site", - icon = shiny::icon("braille"), - startExpanded = F, - bs4SidebarMenuSubItem( - text = "Model Specs", - tabName = "spats_asreml", - icon = shiny::icon("circle", verify_fa = FALSE) - ), - bs4SidebarMenuSubItem( - text = "BLUPs/BLUEs", - tabName = "spats_asreml_effects", - icon = shiny::icon("circle", verify_fa = FALSE) - ) - ), - # Un-replicated analysis - bs4SidebarMenuItem( - "Unreplicated", - icon = shiny::icon("crosshairs"), - startExpanded = F, - bs4SidebarMenuSubItem( - text = "Model Specs", - tabName = "aug_model", - icon = shiny::icon("circle", verify_fa = FALSE) - ), - bs4SidebarMenuSubItem( - text = "BLUPs/BLUEs", - tabName = "aug_result", - icon = shiny::icon("circle", verify_fa = FALSE) - ) - ), - # Model selector - bs4SidebarMenuItem( - text = "Model Selector", - icon = shiny::icon("hand-pointer"), - startExpanded = F, - bs4SidebarMenuSubItem( - HTML( - paste( - "Model Specs", - bs4Badge("new", - position = "right", - color = "success" - ) - ) - ), - tabName = "asreml_selector", - icon = shiny::icon("circle", verify_fa = FALSE) - ), - bs4SidebarMenuSubItem( - HTML( - paste( - "BLUPs/BLUEs", - bs4Badge("new", - position = "right", - color = "success" - ) - ) - ), - tabName = "asr_sel_selected", - icon = shiny::icon("circle", verify_fa = FALSE) - ) - ), + + ##Removed ASReml from Side bar +# bs4SidebarHeader("ASReml"), +# # Single spatial analysis ASReml +# bs4SidebarMenuItem( +# text = "Single-Site", +# icon = shiny::icon("braille"), +# startExpanded = F, +# bs4SidebarMenuSubItem( +# text = "Model Specs", +# tabName = "spats_asreml", +# icon = shiny::icon("circle", verify_fa = FALSE) +# ), +# bs4SidebarMenuSubItem( +# text = "BLUPs/BLUEs", +# tabName = "spats_asreml_effects", +# icon = shiny::icon("circle", verify_fa = FALSE) +# ) +# ), +# # Un-replicated analysis +# bs4SidebarMenuItem( +# "Unreplicated", +# icon = shiny::icon("crosshairs"), +# startExpanded = F, +# bs4SidebarMenuSubItem( +# text = "Model Specs", +# tabName = "aug_model", +# icon = shiny::icon("circle", verify_fa = FALSE) +# ), +# bs4SidebarMenuSubItem( +# text = "BLUPs/BLUEs", +# tabName = "aug_result", +# icon = shiny::icon("circle", verify_fa = FALSE) +# ) +# ), +# # Model selector +# bs4SidebarMenuItem( +# text = "Model Selector", +# icon = shiny::icon("hand-pointer"), +# startExpanded = F, +# bs4SidebarMenuSubItem( +# HTML( +# paste( +# "Model Specs", +# bs4Badge("new", +# position = "right", +# color = "success" +# ) +# ) +# ), +# tabName = "asreml_selector", +# icon = shiny::icon("circle", verify_fa = FALSE) +# ), +# bs4SidebarMenuSubItem( +# HTML( +# paste( +# "BLUPs/BLUEs", +# bs4Badge("new", +# position = "right", +# color = "success" +# ) +# ) +# ), +# tabName = "asr_sel_selected", +# icon = shiny::icon("circle", verify_fa = FALSE) +# ) +# ), bs4SidebarHeader("Two-Stage Analysis"), # Two-Stage MET bs4SidebarMenuItem( diff --git a/R/mod_home_module1.R b/R/mod_home_module1.R index c4b6051..3859855 100644 --- a/R/mod_home_module1.R +++ b/R/mod_home_module1.R @@ -39,15 +39,17 @@ mod_home_module1_ui <- function(id) { href = "https://cran.r-project.org/web/packages/SpATS/SpATS.pdf", icon = shiny::icon("braille") ), - bs4Dash::valueBox( - value = "ASReml-R", - subtitle = "AR1xAR1 Correlation", - width = 12, - color = "danger", - elevation = 3, - href = "https://asreml.kb.vsni.co.uk/wp-content/uploads/sites/3/2018/02/ASReml-R-Reference-Manual-4.pdf", - icon = shiny::icon("braille") - ), + + #removed ASReml from Home page +# bs4Dash::valueBox( +# value = "ASReml-R", +# subtitle = "AR1xAR1 Correlation", +# width = 12, +# color = "danger", +# elevation = 3, +# href = "https://asreml.kb.vsni.co.uk/wp-content/uploads/sites/3/2018/02/ASReml-R-Reference-Manual-4.pdf", +# icon = shiny::icon("braille") +# ), bs4Dash::valueBox( value = "Lme4", subtitle = "lmer", @@ -66,33 +68,34 @@ mod_home_module1_ui <- function(id) { elevation = 3, href = "https://www.frontiersin.org/articles/10.3389/fpls.2018.01511/full" ), - bs4Card( - title = "Jump", - status = "danger", - width = 12, - solidHeader = TRUE, - actionLink( - inputId = ns("toAwesome1"), - label = "Data", - icon = icon("database"), - style = "color: #d9534f" - ), - br(), - actionLink( - inputId = ns("toAwesome2"), - label = "Spatial", - icon = icon("braille"), - style = "color: #d9534f" - ), - br(), - actionLink( - inputId = ns("toAwesome3"), - label = "Lme4", - icon = icon("chart-column", verify_fa = FALSE), - style = "color: #d9534f" - ), - br() - ) + #remove Jump Card +# bs4Card( +# title = "Jump", +# status = "danger", +# width = 12, +# solidHeader = TRUE, +# actionLink( +# inputId = ns("toAwesome1"), +# label = "Data", +# icon = icon("database"), +# style = "color: #d9534f" +# ), +# br(), +# actionLink( +# inputId = ns("toAwesome2"), +# label = "Spatial", +# icon = icon("braille"), +# style = "color: #d9534f" +# ), +# br(), +# actionLink( +# inputId = ns("toAwesome3"), +# label = "Lme4", +# icon = icon("chart-column", verify_fa = FALSE), +# style = "color: #d9534f" +# ), +# br() +# ) ) ) ) From 40d0b608be674467f5af16926530d4bc98b8cb42 Mon Sep 17 00:00:00 2001 From: Tyler Slonecki Date: Thu, 18 Jan 2024 14:33:20 -0500 Subject: [PATCH 2/9] Configuration file addition and QBMS DeltaBreed Changes --- R/QBMS.R | 48 +++++++------- R/app_server.R | 1 + R/app_ui.R | 148 +++++++++++++++++++++++------------------- R/mod_import_dt.R | 160 ++++++++++++++++++---------------------------- inst/config.yml | 2 + 5 files changed, 172 insertions(+), 187 deletions(-) create mode 100644 inst/config.yml diff --git a/R/QBMS.R b/R/QBMS.R index 25467cb..763c9ae 100644 --- a/R/QBMS.R +++ b/R/QBMS.R @@ -10,41 +10,45 @@ #' #' @return a list #' @noRd -qbmsbrapi <- function(url = "https://bms.ciat.cgiar.org/ibpworkbench/controller/auth/login", - engine = c("bms", "breedbase"), - path = ifelse(engine == "bms", "bmsapi", ""), - time_out = ifelse(engine == "bms", 120, 300), +qbmsbrapi <- function(url = "https://sandbox.breedinginsight.net", + engine = '', + path = 'v1/programs/025a8e6e-15fc-4488-8d26-41eb16107a95', + time_out = 300, no_auth = FALSE, + brapi_ver = 'v2', username = NULL, password = NULL) { if (is.null(url) | url == "") { return() } - + print('qbmsbrapi') bmsbase <- QBMS::set_qbms_config( url = url, path = path, - time_out = time_out, - no_auth = no_auth, - engine = engine, - page_size = 5000 + brapi_ver = 'v2', + engine = engine ) - if (!no_auth) { - if (is.null(username) | username == "") { - return() - } - if (is.null(password) | password == "") { - return() - } - bmslogin <- QBMS::login_bms(username = username, password = password) - } else { - bmslogin <- NULL + if (is.null(password) | password == "") { + return() } + + print(url) + print(path) + print(engine) + print(brapi_ver) + print(password) + + + QBMS::set_token(password) + print('token set') + crops <- QBMS::list_crops() - return(list(bmsbase = bmsbase, bmslogin = bmslogin, crops = crops)) + print('list_crops') + return(list(bmsbase = bmsbase, crops = crops)) } + #' Get Programs #' #' @param crop crop @@ -52,10 +56,6 @@ qbmsbrapi <- function(url = "https://bms.ciat.cgiar.org/ibpworkbench/controller/ #' @return a list with programs #' @noRd qbmsprograms <- function(crop = NULL) { - if (is.null(crop)) { - return() - } - QBMS::set_crop(crop) programs <- QBMS::list_programs() return(programs) } diff --git a/R/app_server.R b/R/app_server.R index 4dbcef1..245fe5a 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -5,6 +5,7 @@ #' @import shiny #' @noRd app_server <- function(input, output, session) { + sever::sever() # Home callModule(mod_home_module1_server, "home_module1_ui_1") diff --git a/R/app_ui.R b/R/app_ui.R index 25685e9..0c1b774 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -5,6 +5,14 @@ #' @import shiny #' @noRd app_ui <- function(request) { + + # Read configuration + + # config_path <- system.file("C:/Users/tjs334/OneDrive - Cornell University/Documents/GitHub/MrBeanApp/inst", "config.yml", package = "MrBeanApp") + app_directory <- "C:/Users/tjs334/OneDrive - Cornell University/Documents/GitHub/MrBeanApp" + config_path <- file.path(app_directory, "inst", "config.yml") + config <- yaml::read_yaml(config_path) + tagList( # Leave this function for adding external resources golem_add_external_resources(), @@ -126,72 +134,80 @@ app_ui <- function(request) { ) ), - ##Removed ASReml from Side bar -# bs4SidebarHeader("ASReml"), -# # Single spatial analysis ASReml -# bs4SidebarMenuItem( -# text = "Single-Site", -# icon = shiny::icon("braille"), -# startExpanded = F, -# bs4SidebarMenuSubItem( -# text = "Model Specs", -# tabName = "spats_asreml", -# icon = shiny::icon("circle", verify_fa = FALSE) -# ), -# bs4SidebarMenuSubItem( -# text = "BLUPs/BLUEs", -# tabName = "spats_asreml_effects", -# icon = shiny::icon("circle", verify_fa = FALSE) -# ) -# ), -# # Un-replicated analysis -# bs4SidebarMenuItem( -# "Unreplicated", -# icon = shiny::icon("crosshairs"), -# startExpanded = F, -# bs4SidebarMenuSubItem( -# text = "Model Specs", -# tabName = "aug_model", -# icon = shiny::icon("circle", verify_fa = FALSE) -# ), -# bs4SidebarMenuSubItem( -# text = "BLUPs/BLUEs", -# tabName = "aug_result", -# icon = shiny::icon("circle", verify_fa = FALSE) -# ) -# ), -# # Model selector -# bs4SidebarMenuItem( -# text = "Model Selector", -# icon = shiny::icon("hand-pointer"), -# startExpanded = F, -# bs4SidebarMenuSubItem( -# HTML( -# paste( -# "Model Specs", -# bs4Badge("new", -# position = "right", -# color = "success" -# ) -# ) -# ), -# tabName = "asreml_selector", -# icon = shiny::icon("circle", verify_fa = FALSE) -# ), -# bs4SidebarMenuSubItem( -# HTML( -# paste( -# "BLUPs/BLUEs", -# bs4Badge("new", -# position = "right", -# color = "success" -# ) -# ) -# ), -# tabName = "asr_sel_selected", -# icon = shiny::icon("circle", verify_fa = FALSE) -# ) -# ), + # Conditionally include ASReml features + if (config$enable_asreml_features) { + bs4SidebarHeader("ASReml") + }, + if (config$enable_asreml_features){ + # Single spatial analysis ASReml + bs4SidebarMenuItem( + text = "Single-Site", + icon = shiny::icon("braille"), + startExpanded = F, + bs4SidebarMenuSubItem( + text = "Model Specs", + tabName = "spats_asreml", + icon = shiny::icon("circle", verify_fa = FALSE) + ), + bs4SidebarMenuSubItem( + text = "BLUPs/BLUEs", + tabName = "spats_asreml_effects", + icon = shiny::icon("circle", verify_fa = FALSE) + ) + ) + }, + if (config$enable_asreml_features){ + # Un-replicated analysis + bs4SidebarMenuItem( + "Unreplicated", + icon = shiny::icon("crosshairs"), + startExpanded = F, + bs4SidebarMenuSubItem( + text = "Model Specs", + tabName = "aug_model", + icon = shiny::icon("circle", verify_fa = FALSE) + ), + bs4SidebarMenuSubItem( + text = "BLUPs/BLUEs", + tabName = "aug_result", + icon = shiny::icon("circle", verify_fa = FALSE) + ) + ) + }, + if (config$enable_asreml_features){ + # Model selector + bs4SidebarMenuItem( + text = "Model Selector", + icon = shiny::icon("hand-pointer"), + startExpanded = F, + bs4SidebarMenuSubItem( + HTML( + paste( + "Model Specs", + bs4Badge("new", + position = "right", + color = "success" + ) + ) + ), + tabName = "asreml_selector", + icon = shiny::icon("circle", verify_fa = FALSE) + ), + bs4SidebarMenuSubItem( + HTML( + paste( + "BLUPs/BLUEs", + bs4Badge("new", + position = "right", + color = "success" + ) + ) + ), + tabName = "asr_sel_selected", + icon = shiny::icon("circle", verify_fa = FALSE) + ) + ) + }, bs4SidebarHeader("Two-Stage Analysis"), # Two-Stage MET bs4SidebarMenuItem( diff --git a/R/mod_import_dt.R b/R/mod_import_dt.R index d923bfc..21ee551 100644 --- a/R/mod_import_dt.R +++ b/R/mod_import_dt.R @@ -20,19 +20,14 @@ mod_import_dt_ui <- function(id) { width = 3, radioGroupButtons( inputId = ns("Id004"), - choices = c("Example Data" = 1, "Import Data" = 2, "BrAPI" = 3), + choices = c( "DeltaBreed" = 3,"Example Data" = 1), status = "success", - selected = 1 + selected = 3 ), conditionalPanel( condition = "input.Id004==1", h6("Use the example database to try the different modules of Mr.Bean"), ns = ns - ), - conditionalPanel( - condition = "input.Id004==2", - h6("Import external data preferably csv/txt files."), - ns = ns ) ), column( @@ -100,8 +95,8 @@ mod_import_dt_ui <- function(id) { condition = "input.miss=='Other'", ns = ns, textInput(ns("datamiss"), - label = "String", - width = "100%" + label = "String", + width = "100%" ) ), selectInput( @@ -189,7 +184,7 @@ mod_import_dt_ui <- function(id) { solidHeader = FALSE, width = 12, status = "success", - h3("How to connect BrAPI in MrBean?"), + h3("How to connect DeltaBreed to MrBean?"), hr(), suppressWarnings( includeHTML( @@ -203,7 +198,7 @@ mod_import_dt_ui <- function(id) { width = 4, fluidRow( bs4Dash::box( - title = tagList(shiny::icon("users"), "BMS"), + title = tagList(shiny::icon("users"), "DeltaBreed"), solidHeader = FALSE, width = 12, status = "success", @@ -221,43 +216,14 @@ mod_import_dt_ui <- function(id) { placement = "top" ) ), - value = "https://bms.ciat.cgiar.org/ibpworkbench/controller/auth/login", + value = "https://sandbox.breedinginsight.net/v1/programs/025a8e6e-15fc-4488-8d26-41eb16107a95", width = "100%" ), - awesomeCheckbox( - inputId = ns("no_auth"), - label = "No authentication required?", - value = FALSE, - status = "danger" - ), - prettyRadioButtons( - inputId = ns("engine"), - label = "Engine:", - choices = c( - "BMS" = "bms", - "BreedBase" = "breedbase" - ), - icon = icon("check"), - inline = TRUE, - bigger = TRUE, - status = "success", - animation = "jelly" - ), - conditionalPanel( - condition = "input.no_auth==false", - ns = ns, - textInput( - ns("user"), - label = tagList(shiny::icon("user"), "User:"), - placeholder = "username", - width = "100%" - ), - passwordInput( - ns("password"), - label = tagList(shiny::icon("key"), "Password:"), - width = "100%", - placeholder = "*****************" - ) + passwordInput( + ns("token"), + label = tagList(shiny::icon("key"), "Token:"), + width = "100%", + placeholder = "*****************" ), actionButton( ns("mysql"), @@ -412,15 +378,12 @@ mod_import_dt_server <- function(input, output, session) { input$mysql isolate({ tryCatch( - { - tmpbms <- qbmsbrapi( - url = input$urlbms, - username = input$user, - password = input$password, - engine = input$engine, - no_auth = input$no_auth - ) - }, + { + tmpbms <- qbmsbrapi( + url = input$urlbms, + password = input$token, + ) + }, error = function(e) { shinytoastr::toastr_error( title = "Error:", @@ -439,30 +402,30 @@ mod_import_dt_server <- function(input, output, session) { observe({ if (is.null(bmscon())) { + print('shinyalert1') shinyalert::shinyalert( title = "Incorrect username or password", type = "error", confirmButtonCol = "#28a745" ) } else { + print('shinyalert2') shinyalert::shinyalert( - title = paste0("Welcome to ", input$engine, "!"), + title = paste0("Welcome to DeltaBreed!"), type = "success", text = "", confirmButtonCol = "#28a745", - imageUrl = ifelse( - input$engine == "bms", - "www/0.png", - "www/brapi.png" - ), + imageUrl = "www/brapi.png", animation = "slide-from-top" ) + print('shinyalert3') updateSelectInput( session, inputId = "Id008", choices = bmscon()$crops, selected = "NNNNN" ) + print('selected_input') } }) %>% bindEvent(input$mysql) @@ -470,9 +433,9 @@ mod_import_dt_server <- function(input, output, session) { programs <- reactive({ crop <- input$Id008 tryCatch( - { - list_programs <- qbmsprograms(crop = crop) - }, + { + list_programs <- qbmsprograms() + }, error = function(e) { shinytoastr::toastr_error( title = "Error:", @@ -489,6 +452,7 @@ mod_import_dt_server <- function(input, output, session) { }) observe({ + print('observe_programs') if (is.null(programs())) { return() } else { @@ -505,9 +469,9 @@ mod_import_dt_server <- function(input, output, session) { trials <- reactive({ w$show() tryCatch( - { - list_trials <- qbmstrials(program = input$program) - }, + { + list_trials <- qbmstrials(program = input$program) + }, error = function(e) { shinytoastr::toastr_error( title = "Error:", @@ -526,6 +490,7 @@ mod_import_dt_server <- function(input, output, session) { }) observe({ + print('observe_trials') if (is.null(trials())) { options <- "" } else { @@ -538,14 +503,14 @@ mod_import_dt_server <- function(input, output, session) { studies <- reactive({ w$show() tryCatch( - { - list_studies <- lapply(input$trial, qbmsstudies) - names(list_studies) <- input$trial - dt_std <- data.frame(plyr::ldply(list_studies[], - data.frame, - .id = "trial" - )) - }, + { + list_studies <- lapply(input$trial, qbmsstudies) + names(list_studies) <- input$trial + dt_std <- data.frame(plyr::ldply(list_studies[], + data.frame, + .id = "trial" + )) + }, error = function(e) { shinytoastr::toastr_error( title = "Error:", @@ -564,6 +529,7 @@ mod_import_dt_server <- function(input, output, session) { }) observe({ + print('observe_studies') if (is.null(studies())) { options <- "" } else { @@ -580,9 +546,9 @@ mod_import_dt_server <- function(input, output, session) { isolate({ w$show() tryCatch( - { - datos <- dataqbms(studies = input$study, dt_studies = studies()) - }, + { + datos <- dataqbms(studies = input$study, dt_studies = studies()) + }, error = function(e) { shinytoastr::toastr_error( title = "Error:", @@ -604,18 +570,18 @@ mod_import_dt_server <- function(input, output, session) { dataset <- reactive({ tryCatch( - { - data_react( - file = input$file1, - choice = input$Id004, - header = input$header, - sep = input$sep, - miss = input$miss, - string = input$datamiss, - sheet = input$sheet, - dataBMS = DtReact() - ) - }, + { + data_react( + file = input$file1, + choice = input$Id004, + header = input$header, + sep = input$sep, + miss = input$miss, + string = input$datamiss, + sheet = input$sheet, + dataBMS = DtReact() + ) + }, error = function(e) { shinytoastr::toastr_error( title = "Error:", @@ -656,9 +622,9 @@ mod_import_dt_server <- function(input, output, session) { animType = "fade" ) toggle("levelessub", - anim = TRUE, - time = 1, - animType = "fade" + anim = TRUE, + time = 1, + animType = "fade" ) }) %>% bindEvent(input$subset) @@ -689,9 +655,9 @@ mod_import_dt_server <- function(input, output, session) { output$data <- DT::renderDataTable({ DT::datatable( - { - dataset_sub() - }, + { + dataset_sub() + }, option = list( pageLength = 3, scrollX = TRUE, @@ -715,4 +681,4 @@ mod_import_dt_server <- function(input, output, session) { # mod_import_dt_ui("import_dt_ui_1") ## To be copied in the server -# callModule(mod_import_dt_server, "import_dt_ui_1") +# callModule(mod_import_dt_server, "import_dt_ui_1") \ No newline at end of file diff --git a/inst/config.yml b/inst/config.yml new file mode 100644 index 0000000..b009761 --- /dev/null +++ b/inst/config.yml @@ -0,0 +1,2 @@ +enable_asreml_features: false +enable_DeltaBreed_connection: false \ No newline at end of file From 1e1b618d1e8113caa0658c44cf60249301b1f3d2 Mon Sep 17 00:00:00 2001 From: Tyler Slonecki Date: Thu, 18 Jan 2024 14:33:29 -0500 Subject: [PATCH 3/9] Create icon3.html --- inst/app/www/icon3.html | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 inst/app/www/icon3.html diff --git a/inst/app/www/icon3.html b/inst/app/www/icon3.html new file mode 100644 index 0000000..36ea365 --- /dev/null +++ b/inst/app/www/icon3.html @@ -0,0 +1,33 @@ + + + + + + +
    +
  • Server example to access BMS
  • +
      +
    • https://bms.ciat.cgiar.org/
    • +
    +
  • Server example to access BreedBase
  • +
      +
    • https://cassavabase.org
    • +
    • https://sweetpotatobase.org
    • +
    +
  • If accessing the selected server no requires authentication please click "No authentication required".
  • +
  • The connection is only used to read data, not to write data.
  • +
  • If you have problems in accessing BMS/BreedBase, please contact your provider
  • + http://bms.ciat.cgiar.org/ibpworkbench/controller/auth/login + +
+ + + + +
+ bms + brapi +
+ + + From c9a36c4c2199f69768a50eb51393cd96416919e3 Mon Sep 17 00:00:00 2001 From: Tyler Slonecki Date: Fri, 19 Jan 2024 10:46:53 -0500 Subject: [PATCH 4/9] Make config import relative, move path to url in QBMS, and and remove debug statements --- R/QBMS.R | 15 ++------------- R/app_ui.R | 6 ++---- R/mod_import_dt.R | 7 ------- inst/config.yml | 1 - 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/R/QBMS.R b/R/QBMS.R index 763c9ae..764d945 100644 --- a/R/QBMS.R +++ b/R/QBMS.R @@ -10,9 +10,9 @@ #' #' @return a list #' @noRd -qbmsbrapi <- function(url = "https://sandbox.breedinginsight.net", +qbmsbrapi <- function(url = "https://sandbox.breedinginsight.net/v1/programs/025a8e6e-15fc-4488-8d26-41eb16107a95", engine = '', - path = 'v1/programs/025a8e6e-15fc-4488-8d26-41eb16107a95', + path = '', time_out = 300, no_auth = FALSE, brapi_ver = 'v2', @@ -21,7 +21,6 @@ qbmsbrapi <- function(url = "https://sandbox.breedinginsight.net", if (is.null(url) | url == "") { return() } - print('qbmsbrapi') bmsbase <- QBMS::set_qbms_config( url = url, path = path, @@ -32,19 +31,9 @@ qbmsbrapi <- function(url = "https://sandbox.breedinginsight.net", if (is.null(password) | password == "") { return() } - - print(url) - print(path) - print(engine) - print(brapi_ver) - print(password) - - QBMS::set_token(password) - print('token set') crops <- QBMS::list_crops() - print('list_crops') return(list(bmsbase = bmsbase, crops = crops)) } diff --git a/R/app_ui.R b/R/app_ui.R index 0c1b774..b93208c 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -7,10 +7,8 @@ app_ui <- function(request) { # Read configuration - - # config_path <- system.file("C:/Users/tjs334/OneDrive - Cornell University/Documents/GitHub/MrBeanApp/inst", "config.yml", package = "MrBeanApp") - app_directory <- "C:/Users/tjs334/OneDrive - Cornell University/Documents/GitHub/MrBeanApp" - config_path <- file.path(app_directory, "inst", "config.yml") + app_directory <- system.file("", package = "MrBean") + config_path <- file.path(app_directory, "", "config.yml") config <- yaml::read_yaml(config_path) tagList( diff --git a/R/mod_import_dt.R b/R/mod_import_dt.R index 21ee551..b70d589 100644 --- a/R/mod_import_dt.R +++ b/R/mod_import_dt.R @@ -402,14 +402,12 @@ mod_import_dt_server <- function(input, output, session) { observe({ if (is.null(bmscon())) { - print('shinyalert1') shinyalert::shinyalert( title = "Incorrect username or password", type = "error", confirmButtonCol = "#28a745" ) } else { - print('shinyalert2') shinyalert::shinyalert( title = paste0("Welcome to DeltaBreed!"), type = "success", @@ -418,14 +416,12 @@ mod_import_dt_server <- function(input, output, session) { imageUrl = "www/brapi.png", animation = "slide-from-top" ) - print('shinyalert3') updateSelectInput( session, inputId = "Id008", choices = bmscon()$crops, selected = "NNNNN" ) - print('selected_input') } }) %>% bindEvent(input$mysql) @@ -452,7 +448,6 @@ mod_import_dt_server <- function(input, output, session) { }) observe({ - print('observe_programs') if (is.null(programs())) { return() } else { @@ -490,7 +485,6 @@ mod_import_dt_server <- function(input, output, session) { }) observe({ - print('observe_trials') if (is.null(trials())) { options <- "" } else { @@ -529,7 +523,6 @@ mod_import_dt_server <- function(input, output, session) { }) observe({ - print('observe_studies') if (is.null(studies())) { options <- "" } else { diff --git a/inst/config.yml b/inst/config.yml index b009761..0cefb88 100644 --- a/inst/config.yml +++ b/inst/config.yml @@ -1,2 +1 @@ enable_asreml_features: false -enable_DeltaBreed_connection: false \ No newline at end of file From 26a561db4c97a9952f5a3c76ab783478d2598037 Mon Sep 17 00:00:00 2001 From: Tyler Slonecki Date: Fri, 19 Jan 2024 13:19:56 -0500 Subject: [PATCH 5/9] Added asreml home page info to config --- R/mod_home_module1.R | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/R/mod_home_module1.R b/R/mod_home_module1.R index 3859855..ccf2426 100644 --- a/R/mod_home_module1.R +++ b/R/mod_home_module1.R @@ -8,6 +8,12 @@ #' #' @importFrom shiny NS tagList mod_home_module1_ui <- function(id) { + + # Read configuration + app_directory <- system.file("", package = "MrBean") + config_path <- file.path(app_directory, "", "config.yml") + config <- yaml::read_yaml(config_path) + ns <- NS(id) tagList( fluidRow( @@ -39,17 +45,17 @@ mod_home_module1_ui <- function(id) { href = "https://cran.r-project.org/web/packages/SpATS/SpATS.pdf", icon = shiny::icon("braille") ), - - #removed ASReml from Home page -# bs4Dash::valueBox( -# value = "ASReml-R", -# subtitle = "AR1xAR1 Correlation", -# width = 12, -# color = "danger", -# elevation = 3, -# href = "https://asreml.kb.vsni.co.uk/wp-content/uploads/sites/3/2018/02/ASReml-R-Reference-Manual-4.pdf", -# icon = shiny::icon("braille") -# ), + if (config$enable_asreml_features) { + bs4Dash::valueBox( + value = "ASReml-R", + subtitle = "AR1xAR1 Correlation", + width = 12, + color = "danger", + elevation = 3, + href = "https://asreml.kb.vsni.co.uk/wp-content/uploads/sites/3/2018/02/ASReml-R-Reference-Manual-4.pdf", + icon = shiny::icon("braille") + ) + }, bs4Dash::valueBox( value = "Lme4", subtitle = "lmer", From 183dc4684b8d8c7a248347f30dff450602410693 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Fri, 19 Jan 2024 14:16:59 -0500 Subject: [PATCH 6/9] Remove .idea directory and add to .gitignore --- .gitignore | 2 +- .idea/.gitignore | 3 --- .idea/MrBeanApp.iml | 9 --------- .idea/misc.xml | 6 ------ .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ 6 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/MrBeanApp.iml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore index 46645b5..2a6c873 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ .Rhistory .RData .Ruserdata -rsconnect/ \ No newline at end of file +rsconnect/.idea diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/MrBeanApp.iml b/.idea/MrBeanApp.iml deleted file mode 100644 index d6ebd48..0000000 --- a/.idea/MrBeanApp.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 639900d..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 2017086..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From b1ad21e8aea28f08ee57955a7ad1869c1f348f1b Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Fri, 19 Jan 2024 14:18:55 -0500 Subject: [PATCH 7/9] Move .idea to new line --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2a6c873..59c1862 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .Rhistory .RData .Ruserdata -rsconnect/.idea +rsconnect/ +.idea From 437bf9ada8d67d17e2a1fea444a29da1b06138c4 Mon Sep 17 00:00:00 2001 From: Tyler Slonecki Date: Mon, 5 Feb 2024 11:57:48 -0500 Subject: [PATCH 8/9] Bug fix to allow for import of single trials There was a mismatch between the number of studies and the number of matching trials in the table --- R/QBMS.R | 4 ++-- R/mod_import_dt.R | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/R/QBMS.R b/R/QBMS.R index 764d945..3ccafc8 100644 --- a/R/QBMS.R +++ b/R/QBMS.R @@ -10,7 +10,7 @@ #' #' @return a list #' @noRd -qbmsbrapi <- function(url = "https://sandbox.breedinginsight.net/v1/programs/025a8e6e-15fc-4488-8d26-41eb16107a95", +qbmsbrapi <- function(url = "https://qa-test.breedinginsight.net/v1/programs/8397cfd7-7d28-4441-964d-4d5567f67e9e", engine = '', path = '', time_out = 300, @@ -114,7 +114,7 @@ dataqbms <- function(studies = NULL, dt_studies = NULL) { ) %>% as.data.frame() } else { - names(mult_dt) <- dt_studies$trial + names(mult_dt) <- dplyr::filter(dt_studies, trimws(studyName) %in% trimws(studies))$trial mult_dt <- data.table::rbindlist( l = mult_dt, fill = TRUE, diff --git a/R/mod_import_dt.R b/R/mod_import_dt.R index b70d589..ed14487 100644 --- a/R/mod_import_dt.R +++ b/R/mod_import_dt.R @@ -20,7 +20,7 @@ mod_import_dt_ui <- function(id) { width = 3, radioGroupButtons( inputId = ns("Id004"), - choices = c( "DeltaBreed" = 3,"Example Data" = 1), + choices = c( "BrAPI" = 3,"Example Data" = 1), status = "success", selected = 3 ), @@ -184,7 +184,7 @@ mod_import_dt_ui <- function(id) { solidHeader = FALSE, width = 12, status = "success", - h3("How to connect DeltaBreed to MrBean?"), + h3("How to connect BrAPI server to MrBean?"), hr(), suppressWarnings( includeHTML( @@ -198,7 +198,7 @@ mod_import_dt_ui <- function(id) { width = 4, fluidRow( bs4Dash::box( - title = tagList(shiny::icon("users"), "DeltaBreed"), + title = tagList(shiny::icon("users"), "Server"), solidHeader = FALSE, width = 12, status = "success", @@ -216,7 +216,7 @@ mod_import_dt_ui <- function(id) { placement = "top" ) ), - value = "https://sandbox.breedinginsight.net/v1/programs/025a8e6e-15fc-4488-8d26-41eb16107a95", + value = "https://qa-test.breedinginsight.net/v1/programs/8397cfd7-7d28-4441-964d-4d5567f67e9e", width = "100%" ), passwordInput( @@ -427,7 +427,6 @@ mod_import_dt_server <- function(input, output, session) { bindEvent(input$mysql) programs <- reactive({ - crop <- input$Id008 tryCatch( { list_programs <- qbmsprograms() From 8a815bf5bfc5dba722b4e263d5b017b9dc60db96 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Wed, 19 Feb 2025 14:30:47 -0500 Subject: [PATCH 9/9] Made page size larger --- R/QBMS.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/QBMS.R b/R/QBMS.R index 3ccafc8..869f82a 100644 --- a/R/QBMS.R +++ b/R/QBMS.R @@ -24,6 +24,7 @@ qbmsbrapi <- function(url = "https://qa-test.breedinginsight.net/v1/programs/839 bmsbase <- QBMS::set_qbms_config( url = url, path = path, + page_size = 100000, brapi_ver = 'v2', engine = engine )