mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2024-12-04 01:51:53 +01:00
minor name edit
This commit is contained in:
parent
a518ada45b
commit
927d485739
@ -1,6 +1,6 @@
|
|||||||
Package: REDCapCAST
|
Package: REDCapCAST
|
||||||
Title: REDCap Castellated Data Handling And Metadata Casting
|
Title: REDCap Castellated Data Handling and Metadata Casting
|
||||||
Version: 24.11.1
|
Version: 24.11.2
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person("Andreas Gammelgaard", "Damsbo", email = "agdamsbo@clin.au.dk",
|
person("Andreas Gammelgaard", "Damsbo", email = "agdamsbo@clin.au.dk",
|
||||||
role = c("aut", "cre"),comment = c(ORCID = "0000-0002-7559-1154")),
|
role = c("aut", "cre"),comment = c(ORCID = "0000-0002-7559-1154")),
|
||||||
|
@ -1,32 +1,63 @@
|
|||||||
server <- function(input, output, session) {
|
library(REDCapCAST)
|
||||||
require(REDCapCAST)
|
library(bslib)
|
||||||
|
library(shiny)
|
||||||
|
library(openxlsx2)
|
||||||
|
library(haven)
|
||||||
|
library(readODS)
|
||||||
|
library(readr)
|
||||||
|
library(dplyr)
|
||||||
|
library(here)
|
||||||
|
|
||||||
# bslib::bs_themer()
|
server <- function(input, output, session) {
|
||||||
|
|
||||||
|
v <- shiny::reactiveValues(
|
||||||
|
file = NULL
|
||||||
|
)
|
||||||
|
|
||||||
dat <- shiny::reactive({
|
dat <- shiny::reactive({
|
||||||
shiny::req(input$ds)
|
shiny::req(input$ds)
|
||||||
|
|
||||||
output_staging$file <- "loaded"
|
|
||||||
read_input(input$ds$datapath)
|
read_input(input$ds$datapath)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# getData <- reactive({
|
||||||
|
# if(is.null(input$ds$datapath)) return(NULL)
|
||||||
|
# })
|
||||||
|
# output$uploaded <- reactive({
|
||||||
|
# return(!is.null(getData()))
|
||||||
|
# })
|
||||||
|
|
||||||
|
|
||||||
|
output$uploaded <- shiny::reactive({
|
||||||
|
if (is.null(v$file)) {
|
||||||
|
"no"
|
||||||
|
} else {
|
||||||
|
"yes"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
shiny::outputOptions(output, "uploaded", suspendWhenHidden = FALSE)
|
||||||
|
|
||||||
dd <- shiny::reactive({
|
dd <- shiny::reactive({
|
||||||
|
shiny::req(input$ds)
|
||||||
|
v$file <- "loaded"
|
||||||
ds2dd_detailed(data = dat())
|
ds2dd_detailed(data = dat())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
output$data.tbl <- gt::render_gt(
|
||||||
output$data.tbl <- shiny::renderTable({
|
|
||||||
dd() |>
|
dd() |>
|
||||||
purrr::pluck("data") |>
|
purrr::pluck("data") |>
|
||||||
head(20) |>
|
head(20) |>
|
||||||
dplyr::tibble()
|
dplyr::tibble() |>
|
||||||
})
|
gt::gt()
|
||||||
|
)
|
||||||
|
|
||||||
output$meta.tbl <- shiny::renderTable({
|
output$meta.tbl <- gt::render_gt(
|
||||||
dd() |>
|
dd() |>
|
||||||
purrr::pluck("meta") |>
|
purrr::pluck("meta") |>
|
||||||
dplyr::tibble()
|
dplyr::tibble() |>
|
||||||
})
|
gt::gt()
|
||||||
|
)
|
||||||
|
|
||||||
# Downloadable csv of dataset ----
|
# Downloadable csv of dataset ----
|
||||||
output$downloadData <- shiny::downloadHandler(
|
output$downloadData <- shiny::downloadHandler(
|
||||||
@ -53,17 +84,8 @@ server <- function(input, output, session) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
output_staging <- shiny::reactiveValues()
|
output_staging <- shiny::reactiveValues()
|
||||||
output_staging$meta <- output_staging$data <- output_staging$file <- NA
|
|
||||||
|
|
||||||
output$uploaded <- shiny::reactive({
|
output_staging$meta <- output_staging$data <- NA
|
||||||
if (is.na(output_staging$file)) {
|
|
||||||
"no"
|
|
||||||
} else {
|
|
||||||
"yes"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
shiny::outputOptions(output, "uploaded", suspendWhenHidden = FALSE)
|
|
||||||
|
|
||||||
shiny::observeEvent(input$upload.meta,{ upload_meta() })
|
shiny::observeEvent(input$upload.meta,{ upload_meta() })
|
||||||
|
|
||||||
|
@ -4,11 +4,12 @@ ui <-
|
|||||||
title = "REDCap database creator",
|
title = "REDCap database creator",
|
||||||
bslib::page_navbar(
|
bslib::page_navbar(
|
||||||
title = "Easy REDCap database creation",
|
title = "Easy REDCap database creation",
|
||||||
sidebar = bslib::sidebar(width = 300,
|
sidebar = bslib::sidebar(
|
||||||
|
width = 300,
|
||||||
shiny::h5("1) Database meta data"),
|
shiny::h5("1) Database meta data"),
|
||||||
shiny::fileInput(
|
shiny::fileInput(
|
||||||
inputId = "ds",
|
inputId = "ds",
|
||||||
label = "Upload spreadsheet",
|
label = "Upload spreadsheet",
|
||||||
multiple = FALSE,
|
multiple = FALSE,
|
||||||
accept = c(
|
accept = c(
|
||||||
".csv",
|
".csv",
|
||||||
@ -18,87 +19,92 @@ ui <-
|
|||||||
".ods"
|
".ods"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
conditionalPanel(
|
shiny::helpText("Have a look at the preview panels to show download options."),
|
||||||
|
# For some odd reason this only unfolds when the preview panel is shown..
|
||||||
|
shiny::conditionalPanel(
|
||||||
condition = "output.uploaded=='yes'",
|
condition = "output.uploaded=='yes'",
|
||||||
shiny::helpText("Below you can download the dataset formatted for upload and the
|
shiny::helpText("Below you can download the dataset formatted for upload and the
|
||||||
corresponding data dictionary for a new data base, if you want to upload manually."),
|
corresponding data dictionary for a new data base, if you want to upload manually."),
|
||||||
# Button
|
# Button
|
||||||
shiny::downloadButton("downloadData", "Download adjusted data"),
|
shiny::downloadButton("downloadData", "Download renamed data"),
|
||||||
|
|
||||||
# Button
|
# Button
|
||||||
shiny::downloadButton("downloadMeta", "Download data dictionary"),
|
shiny::downloadButton("downloadMeta", "Download data dictionary"),
|
||||||
|
|
||||||
# Button
|
# Button
|
||||||
shiny::downloadButton("downloadInstrument", "Download as instrument"),
|
shiny::downloadButton("downloadInstrument", "Download as instrument"),
|
||||||
|
|
||||||
# Horizontal line ----
|
# Horizontal line ----
|
||||||
shiny::tags$hr(),
|
shiny::tags$hr(),
|
||||||
shiny::radioButtons(
|
shiny::radioButtons(
|
||||||
inputId = "upload_redcap",
|
inputId = "upload_redcap",
|
||||||
label = "Upload directly to REDCap server?",
|
label = "Upload directly to REDCap server?",
|
||||||
selected = "no",
|
selected = "no",
|
||||||
inline = TRUE,
|
inline = TRUE,
|
||||||
choices = list(
|
choices = list(
|
||||||
"No" = "no",
|
"No" = "no",
|
||||||
"Yes" = "yes"
|
"Yes" = "yes"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::conditionalPanel(
|
||||||
|
condition = "input.upload_redcap=='yes'",
|
||||||
|
shiny::h4("2) Data base upload"),
|
||||||
|
shiny::helpText("This tool is usable for now. Detailed instructions are coming."),
|
||||||
|
shiny::textInput(
|
||||||
|
inputId = "uri",
|
||||||
|
label = "URI",
|
||||||
|
value = "https://redcap.your.institution/api/"
|
||||||
|
),
|
||||||
|
shiny::textInput(
|
||||||
|
inputId = "api",
|
||||||
|
label = "API key",
|
||||||
|
value = ""
|
||||||
|
),
|
||||||
|
shiny::helpText("An API key is an access key to the REDCap database. Please", shiny::a("see here for directions", href = "https://www.iths.org/news/redcap-tip/redcap-api-101/"), " to obtain an API key for your project."),
|
||||||
|
shiny::actionButton(
|
||||||
|
inputId = "upload.meta",
|
||||||
|
label = "Upload datadictionary", icon = shiny::icon("book-bookmark")
|
||||||
|
),
|
||||||
|
shiny::helpText("Please note, that before uploading any real data, put your project
|
||||||
|
into production mode."),
|
||||||
|
shiny::actionButton(
|
||||||
|
inputId = "upload.data",
|
||||||
|
label = "Upload data", icon = shiny::icon("upload")
|
||||||
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
shiny::conditionalPanel(
|
|
||||||
condition = "input.upload_redcap=='yes'",
|
|
||||||
shiny::h4("2) Data base upload"),
|
|
||||||
shiny::helpText("This tool is usable for now. Detailed instructions are coming."),
|
|
||||||
shiny::textInput(
|
|
||||||
inputId = "uri",
|
|
||||||
label = "URI",
|
|
||||||
value = "https://redcap.your.institution/api/"
|
|
||||||
),
|
|
||||||
shiny::textInput(
|
|
||||||
inputId = "api",
|
|
||||||
label = "API key",
|
|
||||||
value = ""
|
|
||||||
),
|
|
||||||
shiny::helpText("An API key is an access key to the REDCap database. Please", shiny::a("see here for directions", href = "https://www.iths.org/news/redcap-tip/redcap-api-101/"), " to obtain an API key for your project."),
|
|
||||||
shiny::actionButton(
|
|
||||||
inputId = "upload.meta",
|
|
||||||
label = "Upload datadictionary", icon = shiny::icon("book-bookmark")
|
|
||||||
),
|
|
||||||
shiny::helpText("Please note, that before uploading any real data, put your project
|
|
||||||
into production mode."),
|
|
||||||
shiny::actionButton(
|
|
||||||
inputId = "upload.data",
|
|
||||||
label = "Upload data", icon = shiny::icon("upload")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::p(
|
shiny::p(
|
||||||
"License: ",shiny::a("GPL-3+", href = "https://agdamsbo.github.io/REDCapCAST/LICENSE.html")),
|
"License: ", shiny::a("GPL-3+", href = "https://agdamsbo.github.io/REDCapCAST/LICENSE.html")
|
||||||
|
),
|
||||||
shiny::p(
|
shiny::p(
|
||||||
shiny::a("Package documentation", href = "https://agdamsbo.github.io/REDCapCAST"))
|
shiny::a("Package documentation", href = "https://agdamsbo.github.io/REDCapCAST")
|
||||||
|
)
|
||||||
),
|
),
|
||||||
bslib::nav_panel(
|
bslib::nav_panel(
|
||||||
title = "Intro",
|
title = "Intro",
|
||||||
shiny::markdown(readLines("www/SHINYCAST.md")),
|
shiny::markdown(readLines("www/SHINYCAST.md")),
|
||||||
shiny::br()
|
shiny::br()
|
||||||
),
|
),
|
||||||
bslib::nav_spacer(),
|
# bslib::nav_spacer(),
|
||||||
bslib::nav_panel(
|
bslib::nav_panel(
|
||||||
title = "Data preview",
|
title = "Data preview",
|
||||||
shiny::htmlOutput(outputId = "data.tbl", container = shiny::span)
|
gt::gt_output(outputId = "data.tbl")
|
||||||
|
# shiny::htmlOutput(outputId = "data.tbl", container = shiny::span)
|
||||||
),
|
),
|
||||||
bslib::nav_panel(
|
bslib::nav_panel(
|
||||||
title = "Dictionary overview",
|
title = "Dictionary overview",
|
||||||
shiny::htmlOutput(outputId = "meta.tbl", container = shiny::span)
|
gt::gt_output(outputId = "meta.tbl")
|
||||||
|
# shiny::htmlOutput(outputId = "meta.tbl", container = shiny::span)
|
||||||
),
|
),
|
||||||
bslib::nav_panel(
|
bslib::nav_panel(
|
||||||
title = "Upload",
|
title = "Upload",
|
||||||
shiny::h3("Meta upload overview"),
|
shiny::h3("Meta upload overview"),
|
||||||
shiny::htmlOutput(outputId = "upload.meta.print", container = shiny::span),
|
shiny::textOutput(outputId = "upload.meta.print"),
|
||||||
shiny::h3("Data upload overview"),
|
shiny::h3("Data upload overview"),
|
||||||
shiny::htmlOutput(outputId = "upload.data.print", container = shiny::span)
|
shiny::textOutput(outputId = "upload.data.print")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user