mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 09:59:39 +02:00
api as password - rearranged import parameters - text updates
This commit is contained in:
parent
0f0e3ddc13
commit
879a4f45dd
1 changed files with 47 additions and 46 deletions
|
@ -18,18 +18,25 @@ m_redcap_readUI <- function(id, title = TRUE, url = NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
server_ui <- shiny::tagList(
|
server_ui <- shiny::tagList(
|
||||||
# width = 6,
|
|
||||||
shiny::tags$h4("REDCap server"),
|
shiny::tags$h4("REDCap server"),
|
||||||
shiny::textInput(
|
shiny::textInput(
|
||||||
inputId = ns("uri"),
|
inputId = ns("uri"),
|
||||||
label = "Web address",
|
label = "Web address",
|
||||||
value = if_not_missing(url, "https://redcap.your.institution/")
|
value = if_not_missing(url, "https://redcap.your.institution/"),
|
||||||
|
width = "100%"
|
||||||
),
|
),
|
||||||
shiny::helpText("Format should be either 'https://redcap.your.institution/' or 'https://your.institution/redcap/'"),
|
shiny::helpText("Format should be either 'https://redcap.your.institution/' or 'https://your.institution/redcap/'"),
|
||||||
shiny::textInput(
|
# shiny::textInput(
|
||||||
|
# inputId = ns("api"),
|
||||||
|
# label = "API token",
|
||||||
|
# value = "",
|
||||||
|
# width = "100%"
|
||||||
|
# ),
|
||||||
|
shiny::passwordInput(
|
||||||
inputId = ns("api"),
|
inputId = ns("api"),
|
||||||
label = "API token",
|
label = "API token",
|
||||||
value = ""
|
value = "",
|
||||||
|
width = "100%"
|
||||||
),
|
),
|
||||||
shiny::helpText("The token is a string of 32 numbers and letters."),
|
shiny::helpText("The token is a string of 32 numbers and letters."),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
|
@ -67,31 +74,34 @@ m_redcap_readUI <- function(id, title = TRUE, url = NULL) {
|
||||||
|
|
||||||
params_ui <-
|
params_ui <-
|
||||||
shiny::tagList(
|
shiny::tagList(
|
||||||
# width = 6,
|
|
||||||
shiny::tags$h4("Data import parameters"),
|
shiny::tags$h4("Data import parameters"),
|
||||||
shiny::helpText("Options here will show, when API and uri are typed"),
|
|
||||||
shiny::tags$br(),
|
|
||||||
shiny::uiOutput(outputId = ns("fields")),
|
|
||||||
shiny::tags$div(
|
shiny::tags$div(
|
||||||
class = "shiny-input-container",
|
style = htmltools::css(
|
||||||
shiny::tags$label(
|
display = "grid",
|
||||||
class = "control-label",
|
gridTemplateColumns = "1fr 50px",
|
||||||
`for` = ns("dropdown_params"),
|
gridColumnGap = "10px"
|
||||||
"...",
|
|
||||||
style = htmltools::css(visibility = "hidden")
|
|
||||||
),
|
),
|
||||||
shinyWidgets::dropMenu(
|
shiny::uiOutput(outputId = ns("fields")),
|
||||||
shiny::actionButton(
|
shiny::tags$div(
|
||||||
inputId = ns("dropdown_params"),
|
class = "shiny-input-container",
|
||||||
label = "Add data filters",
|
shiny::tags$label(
|
||||||
icon = shiny::icon("filter"),
|
class = "control-label",
|
||||||
width = "100%",
|
`for` = ns("dropdown_params"),
|
||||||
class = "px-1"
|
"...",
|
||||||
|
style = htmltools::css(visibility = "hidden")
|
||||||
),
|
),
|
||||||
filter_ui
|
shinyWidgets::dropMenu(
|
||||||
),
|
shiny::actionButton(
|
||||||
shiny::helpText("Optionally filter project arms if logitudinal or apply server side data filters")
|
inputId = ns("dropdown_params"),
|
||||||
|
label = shiny::icon("filter"),
|
||||||
|
width = "50px"
|
||||||
|
),
|
||||||
|
filter_ui
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
|
shiny::helpText("Select fields/variables to import and click the funnel to apply optional filters"),
|
||||||
|
shiny::tags$br(),
|
||||||
shiny::tags$br(),
|
shiny::tags$br(),
|
||||||
shiny::uiOutput(outputId = ns("data_type")),
|
shiny::uiOutput(outputId = ns("data_type")),
|
||||||
shiny::uiOutput(outputId = ns("fill")),
|
shiny::uiOutput(outputId = ns("fill")),
|
||||||
|
@ -112,28 +122,14 @@ m_redcap_readUI <- function(id, title = TRUE, url = NULL) {
|
||||||
tags$p(phosphoricons::ph("info", weight = "bold"), "Please specify data to download, then press 'Import'.")
|
tags$p(phosphoricons::ph("info", weight = "bold"), "Please specify data to download, then press 'Import'.")
|
||||||
),
|
),
|
||||||
dismissible = TRUE
|
dismissible = TRUE
|
||||||
) # ,
|
)
|
||||||
## TODO: Use busy indicator like on download to have button activate/deactivate
|
|
||||||
# bslib::input_task_button(
|
|
||||||
# id = ns("data_import"),
|
|
||||||
# label = "Import",
|
|
||||||
# icon = shiny::icon("download", lib = "glyphicon"),
|
|
||||||
# label_busy = "Just a minute...",
|
|
||||||
# icon_busy = fontawesome::fa_i("arrows-rotate",
|
|
||||||
# class = "fa-spin",
|
|
||||||
# "aria-hidden" = "true"
|
|
||||||
# ),
|
|
||||||
# type = "primary",
|
|
||||||
# auto_reset = TRUE#,state="busy"
|
|
||||||
# ),
|
|
||||||
# shiny::br(),
|
|
||||||
# shiny::helpText("Press 'Import' to get data from the REDCap server. Check the preview below before proceeding.")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
shiny::fluidPage(
|
shiny::fluidPage(
|
||||||
title = title,
|
title = title,
|
||||||
server_ui,
|
server_ui,
|
||||||
|
# shiny::uiOutput(ns("params_ui")),
|
||||||
shiny::conditionalPanel(
|
shiny::conditionalPanel(
|
||||||
condition = "output.connect_success == true",
|
condition = "output.connect_success == true",
|
||||||
params_ui,
|
params_ui,
|
||||||
|
@ -257,6 +253,7 @@ m_redcap_readServer <- function(id) {
|
||||||
output$connect_success <- shiny::reactive(identical(data_rv$dd_status, "success"))
|
output$connect_success <- shiny::reactive(identical(data_rv$dd_status, "success"))
|
||||||
shiny::outputOptions(output, "connect_success", suspendWhenHidden = FALSE)
|
shiny::outputOptions(output, "connect_success", suspendWhenHidden = FALSE)
|
||||||
|
|
||||||
|
|
||||||
shiny::observeEvent(input$see_dd, {
|
shiny::observeEvent(input$see_dd, {
|
||||||
show_data(
|
show_data(
|
||||||
purrr::pluck(data_rv$dd_list, "data"),
|
purrr::pluck(data_rv$dd_list, "data"),
|
||||||
|
@ -292,7 +289,7 @@ m_redcap_readServer <- function(id) {
|
||||||
shiny::req(data_rv$dd_list)
|
shiny::req(data_rv$dd_list)
|
||||||
shinyWidgets::virtualSelectInput(
|
shinyWidgets::virtualSelectInput(
|
||||||
inputId = ns("fields"),
|
inputId = ns("fields"),
|
||||||
label = "Select variables to import:",
|
label = "Select fields/variables to import:",
|
||||||
choices = purrr::pluck(data_rv$dd_list, "data") |>
|
choices = purrr::pluck(data_rv$dd_list, "data") |>
|
||||||
dplyr::select(field_name, form_name) |>
|
dplyr::select(field_name, form_name) |>
|
||||||
(\(.x){
|
(\(.x){
|
||||||
|
@ -301,7 +298,8 @@ m_redcap_readServer <- function(id) {
|
||||||
updateOn = "change",
|
updateOn = "change",
|
||||||
multiple = TRUE,
|
multiple = TRUE,
|
||||||
search = TRUE,
|
search = TRUE,
|
||||||
showValueAsTags = TRUE
|
showValueAsTags = TRUE,
|
||||||
|
width = "100%"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -310,13 +308,14 @@ m_redcap_readServer <- function(id) {
|
||||||
if (isTRUE(data_rv$info$has_repeating_instruments_or_events)) {
|
if (isTRUE(data_rv$info$has_repeating_instruments_or_events)) {
|
||||||
vectorSelectInput(
|
vectorSelectInput(
|
||||||
inputId = ns("data_type"),
|
inputId = ns("data_type"),
|
||||||
label = "Select the data format to import",
|
label = "Specify the data format",
|
||||||
choices = c(
|
choices = c(
|
||||||
"Wide data (One row for each subject)" = "wide",
|
"Wide data (One row for each subject)" = "wide",
|
||||||
"Long data for project with repeating instruments (default REDCap)" = "long"
|
"Long data for project with repeating instruments (default REDCap)" = "long"
|
||||||
),
|
),
|
||||||
selected = "wide",
|
selected = "wide",
|
||||||
multiple = FALSE
|
multiple = FALSE,
|
||||||
|
width = "100%"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -342,7 +341,8 @@ m_redcap_readServer <- function(id) {
|
||||||
"No, leave the data as is" = "no"
|
"No, leave the data as is" = "no"
|
||||||
),
|
),
|
||||||
selected = "no",
|
selected = "no",
|
||||||
multiple = FALSE
|
multiple = FALSE,
|
||||||
|
width = "100%"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -362,7 +362,8 @@ m_redcap_readServer <- function(id) {
|
||||||
selected = NULL,
|
selected = NULL,
|
||||||
label = "Filter by events/arms",
|
label = "Filter by events/arms",
|
||||||
choices = stats::setNames(arms()[[3]], arms()[[1]]),
|
choices = stats::setNames(arms()[[3]], arms()[[1]]),
|
||||||
multiple = TRUE
|
multiple = TRUE,
|
||||||
|
width = "100%"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue