exporting redcap instrument from shiny app

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-10-24 11:37:40 +02:00
commit 3e4b1b1549
No known key found for this signature in database
5 changed files with 182 additions and 54 deletions

View file

@ -41,6 +41,14 @@ server <- function(input, output, session) {
}
)
# Downloadable .zip of instrument ----
output$downloadInstrument <- shiny::downloadHandler(
filename = paste0("REDCapCAST_instrument",Sys.Date(),".zip"),
content = function(file) {
create_instrument_meta_single(purrr::pluck(dd(), "meta"), file)
}
)
output_staging <- shiny::reactiveValues()
output_staging$meta <- output_staging$data <- NA

View file

@ -19,11 +19,11 @@ ui <- shiny::shinyUI(
windowTitle = "REDCap database creator"
),
shiny::h4(
"This tool includes to convenient functions:",
"THese are the functionalities to create and migrate data from a spreadsheet to a REDCap database:",
shiny::br(),
"1) creating a REDCap data dictionary based on a spreadsheet (.csv/.xls(x)/.dta/.ods) and",
"1) create a REDCap data dictionary or instrument based on a spreadsheet (.csv/.xls(x)/.dta/.ods) and",
shiny::br(),
"2) creating said database on a given REDCap server and uploading the dataset via API access."
"2) upload said database file on a given REDCap server and upload the dataset via API access or download for all manual upload."
),
@ -49,7 +49,10 @@ ui <- shiny::shinyUI(
shiny::downloadButton("downloadData", "Download data"),
# Button
shiny::downloadButton("downloadMeta", "Download datadictionary"),
shiny::downloadButton("downloadMeta", "Download data dictionary"),
# Button
shiny::downloadButton("downloadInstrument", "Download as instrument"),
# Horizontal line ----