minor name edit

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-11-18 08:17:55 +01:00
parent a518ada45b
commit 927d485739
No known key found for this signature in database
3 changed files with 106 additions and 78 deletions

View File

@ -1,6 +1,6 @@
Package: REDCapCAST
Title: REDCap Castellated Data Handling And Metadata Casting
Version: 24.11.1
Title: REDCap Castellated Data Handling and Metadata Casting
Version: 24.11.2
Authors@R: c(
person("Andreas Gammelgaard", "Damsbo", email = "agdamsbo@clin.au.dk",
role = c("aut", "cre"),comment = c(ORCID = "0000-0002-7559-1154")),

View File

@ -1,32 +1,63 @@
server <- function(input, output, session) {
require(REDCapCAST)
library(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({
shiny::req(input$ds)
output_staging$file <- "loaded"
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({
shiny::req(input$ds)
v$file <- "loaded"
ds2dd_detailed(data = dat())
})
output$data.tbl <- shiny::renderTable({
output$data.tbl <- gt::render_gt(
dd() |>
purrr::pluck("data") |>
head(20) |>
dplyr::tibble()
})
dplyr::tibble() |>
gt::gt()
)
output$meta.tbl <- shiny::renderTable({
output$meta.tbl <- gt::render_gt(
dd() |>
purrr::pluck("meta") |>
dplyr::tibble()
})
dplyr::tibble() |>
gt::gt()
)
# Downloadable csv of dataset ----
output$downloadData <- shiny::downloadHandler(
@ -53,17 +84,8 @@ server <- function(input, output, session) {
)
output_staging <- shiny::reactiveValues()
output_staging$meta <- output_staging$data <- output_staging$file <- NA
output$uploaded <- shiny::reactive({
if (is.na(output_staging$file)) {
"no"
} else {
"yes"
}
})
shiny::outputOptions(output, "uploaded", suspendWhenHidden = FALSE)
output_staging$meta <- output_staging$data <- NA
shiny::observeEvent(input$upload.meta,{ upload_meta() })

View File

@ -4,7 +4,8 @@ ui <-
title = "REDCap database creator",
bslib::page_navbar(
title = "Easy REDCap database creation",
sidebar = bslib::sidebar(width = 300,
sidebar = bslib::sidebar(
width = 300,
shiny::h5("1) Database meta data"),
shiny::fileInput(
inputId = "ds",
@ -18,12 +19,14 @@ ui <-
".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'",
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."),
# Button
shiny::downloadButton("downloadData", "Download adjusted data"),
shiny::downloadButton("downloadData", "Download renamed data"),
# Button
shiny::downloadButton("downloadMeta", "Download data dictionary"),
@ -74,31 +77,34 @@ ui <-
shiny::br(),
shiny::br(),
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::a("Package documentation", href = "https://agdamsbo.github.io/REDCapCAST"))
shiny::a("Package documentation", href = "https://agdamsbo.github.io/REDCapCAST")
)
),
bslib::nav_panel(
title = "Intro",
shiny::markdown(readLines("www/SHINYCAST.md")),
shiny::br()
),
bslib::nav_spacer(),
# bslib::nav_spacer(),
bslib::nav_panel(
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(
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(
title = "Upload",
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::htmlOutput(outputId = "upload.data.print", container = shiny::span)
shiny::textOutput(outputId = "upload.data.print")
)
)
)