Compare commits

..

No commits in common. "a181a2816c038e3b28bde0fea6b3696d80d88e4e" and "9c61b5e646c7512386e85a88fc9a916054b9fcd8" have entirely different histories.

14 changed files with 185 additions and 164 deletions

View File

@ -20,7 +20,7 @@ jobs:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
# - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
@ -39,8 +39,6 @@ jobs:
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
- uses: r-lib/actions/setup-renv@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck

View File

@ -21,8 +21,6 @@ jobs:
with:
use-public-rspm: true
- uses: r-lib/actions/setup-renv@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr

7
.lintr Normal file
View File

@ -0,0 +1,7 @@
linters: linters_with_defaults(
commented_code_linter = NULL
)
encoding: "UTF-8"
exclusions: list(
"drafting/"
)

View File

@ -1,6 +1,6 @@
Package: REDCapCAST
Title: REDCap Castellated Data Handling
Version: 24.3.1
Version: 24.2.1
Authors@R: c(
person("Andreas Gammelgaard", "Damsbo", email = "agdamsbo@clin.au.dk",
role = c("aut", "cre"),comment = c(ORCID = "0000-0002-7559-1154")),
@ -28,6 +28,7 @@ Suggests:
knitr,
rmarkdown,
gt,
usethis,
ggplot2,
here,
styler,
@ -51,6 +52,7 @@ Imports:
stats,
shiny,
openxlsx2,
rsconnect,
haven
Collate:
'utils.r'

View File

@ -3,6 +3,7 @@
export(REDCap_split)
export(clean_redcap_name)
export(d2w)
export(deploy_shiny)
export(ds2dd)
export(ds2dd_detailed)
export(easy_redcap)

View File

@ -1,10 +1,3 @@
# REDCapCAST 24.3.1 - in development
### Documentation and more
* Dependencies: In order to deploy `shiny_cast()` with `shinylive`, I need to remove `curl` as a dependency. To accomplish this, the `shiny_deploy()` helper functions has been moved to the package [`pacakge.aid`](https://github.com/agdamsbo/package.aid). This is for a rainy day: https://r-wasm.github.io/rwasm/. The whole shiny part may be migrated to its own project to try to separate things and be easy on dependencies. Time will tell.
# REDCapCAST 24.2.1
### Functions

View File

@ -34,3 +34,25 @@ shiny_cast <- function() {
)
}
#' Deploy the Shiny app with rsconnect
#'
#' @param path app folder path
#' @param name.app name of deployed app
#'
#' @return deploy
#' @export
#'
#' @examples
#' # deploy_shiny
#'
deploy_shiny <- function(path = here::here("app/"), name.app = "shiny_cast") {
# Connecting
rsconnect::setAccountInfo(
name = "cognitiveindex",
token = keyring::key_get(service = "rsconnect_cognitiveindex_token"),
secret = keyring::key_get(service = "rsconnect_cognitiveindex_secret")
)
# Deploying
rsconnect::deployApp(appDir = path, lint = TRUE, appName = name.app, )
}

View File

@ -1,10 +0,0 @@
name: redcapcast
title:
username: agdamsbo
account: agdamsbo
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 11351429
bundleId: 8311272
url: https://agdamsbo.shinyapps.io/redcapcast/
version: 1

View File

@ -1,10 +0,0 @@
name: shiny_cast
title:
username: cognitiveindex
account: cognitiveindex
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 11351378
bundleId: 8306502
url: https://cognitiveindex.shinyapps.io/shiny_cast/
version: 1

200
app/ui.R
View File

@ -1,133 +1,89 @@
ui <- shiny::shinyUI(
shiny::fluidPage(
ui <- shiny::fluidPage(
## -----------------------------------------------------------------------------
## Application title
## -----------------------------------------------------------------------------
## -----------------------------------------------------------------------------
## Application title
## -----------------------------------------------------------------------------
shiny::titlePanel("Simple REDCap data base creation and data upload from data set file via API",
windowTitle = "REDCap databse creator"
),
shiny::h5("Please note, that this tool serves as a demonstration of some of the functionality
of the REDCapCAST package. No responsibility for data loss or any other
problems will be taken."),
## -----------------------------------------------------------------------------
## Side panel
## -----------------------------------------------------------------------------
# customHeaderPanel(title = "REDCapCAST: data base creation and data upload from data set file",
# windowTitle = "REDCap database creator"
# ),
shiny::titlePanel(title = shiny::div(shiny::a(shiny::img(src="logo.png"),href="https://agdamsbo.github.io/REDCapCAST"),
"Easy REDCap database creation"),
windowTitle = "REDCap database creator"
shiny::sidebarPanel(
shiny::h4("REDCap database and dataset"),
shiny::fileInput("ds", "Choose data file",
multiple = FALSE,
accept = c(
".csv",
".xls",
".xlsx",
".dta"
)
),
shiny::h4("This tool includes to convenient functions:",
shiny::br(),
"1) creating a REDCap data dictionary based on a spreadsheet (.csv/.xls(x)/.dta) and",
shiny::br(),
"2) creating said database on a given REDCap server and uploading the dataset via API access."),
shiny::h6("Below you can download the dataset formatted for upload and the
corresponding data dictionary for a new data base."),
# Button
shiny::downloadButton("downloadData", "Download data"),
# Button
shiny::downloadButton("downloadMeta", "Download dictionary"),
## -----------------------------------------------------------------------------
## Side panel
## -----------------------------------------------------------------------------
shiny::sidebarPanel(
shiny::h4("1) REDCap datadictionary and compatible dataset"),
shiny::fileInput("ds", "Choose data file",
multiple = FALSE,
accept = c(
".csv",
".xls",
".xlsx",
".dta"
)
),
shiny::h6("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 data"),
# Button
shiny::downloadButton("downloadMeta", "Download datadictionary"),
# Horizontal line ----
shiny::tags$hr(),
shiny::h4("2) REDCap upload"),
shiny::h6("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::h6("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::h6("Please note, that before uploading any real data, put your project
# Horizontal line ----
shiny::tags$hr(),
shiny::h4("REDCap upload"),
shiny::textInput(
inputId = "uri",
label = "URI",
value = "https://redcap.your.institution/api/"
),
shiny::textInput(
inputId = "api",
label = "API key",
value = ""
),
shiny::actionButton(
inputId = "upload.meta",
label = "Upload dictionary", icon = shiny::icon("book-bookmark")
),
shiny::h6("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::actionButton(
inputId = "upload.data",
label = "Upload data", icon = shiny::icon("upload")
),
# Horizontal line ----
shiny::tags$hr()
),
shiny::mainPanel(
shiny::tabsetPanel(
## -----------------------------------------------------------------------------
## Summary tab
## -----------------------------------------------------------------------------
shiny::tabPanel(
"Summary",
shiny::h3("Data overview (first 20)"),
shiny::htmlOutput("data.tbl", container = shiny::span),
shiny::h3("Dictionary overview"),
shiny::htmlOutput("meta.tbl", container = shiny::span)
),
# Horizontal line ----
shiny::tags$hr()
),
shiny::mainPanel(
shiny::tabsetPanel(
## -----------------------------------------------------------------------------
## Summary tab
## -----------------------------------------------------------------------------
shiny::tabPanel(
"Summary",
shiny::h3("Data overview (first 20)"),
shiny::htmlOutput("data.tbl", container = shiny::span),
shiny::h3("Dictionary overview"),
shiny::htmlOutput("meta.tbl", container = shiny::span)
),
## -----------------------------------------------------------------------------
## Upload tab
## -----------------------------------------------------------------------------
shiny::tabPanel(
"Upload",
shiny::h3("Meta upload overview"),
shiny::htmlOutput("upload.meta.print", container = shiny::span),
shiny::h3("Data upload overview"),
shiny::htmlOutput("upload.data.print", container = shiny::span)
)
## -----------------------------------------------------------------------------
## Upload tab
## -----------------------------------------------------------------------------
shiny::tabPanel(
"Upload",
shiny::h3("Meta upload overview"),
shiny::htmlOutput("upload.meta.print", container = shiny::span),
shiny::h3("Data upload overview"),
shiny::htmlOutput("upload.data.print", container = shiny::span)
)
),
# close sidebarLayout
br(),
br(),
br(),
br(),
hr(),
shiny::tags$footer(shiny::strong("Disclaimer: "),
"This tool is aimed at demonstrating use of REDCapCAST. No responsibility for data loss or any other problems will be taken. Please contact me for support.",
shiny::br(),
shiny::a("License: GPL-3+",href="https://agdamsbo.github.io/REDCapCAST/LICENSE.html"),
"|",
shiny::a("agdamsbo/REDCapCAST",href="https://agdamsbo.github.io/REDCapCAST"),
"|",
shiny::a("Source",href="https://github.com/agdamsbo/REDCapCAST"),
"|",
shiny::a("Contact",href="https://andreas.gdamsbo.dk"),
align = "center",
style = "
position:fixed;
bottom:40px;
width:100%;
height:20px;
color: black;
padding: 0px;
background-color: White;
z-index: 100;
")
)
)
)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

23
man/deploy_shiny.Rd Normal file
View File

@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shiny_cast.R
\name{deploy_shiny}
\alias{deploy_shiny}
\title{Deploy the Shiny app with rsconnect}
\usage{
deploy_shiny(path = here::here("app/"), name.app = "shiny_cast")
}
\arguments{
\item{path}{app folder path}
\item{name.app}{name of deployed app}
}
\value{
deploy
}
\description{
Deploy the Shiny app with rsconnect
}
\examples{
# deploy_shiny
}

View File

@ -210,24 +210,24 @@
},
"curl": {
"Package": "curl",
"Version": "5.2.1",
"Version": "5.2.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
"Hash": "411ca2c03b1ce5f548345d2fc2685f7a"
"Hash": "ce88d13c0b10fe88a37d9c59dba2d7f9"
},
"digest": {
"Package": "digest",
"Version": "0.6.35",
"Version": "0.6.34",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"utils"
],
"Hash": "698ece7ba5a4fa4559e3d537e7ec3d31"
"Hash": "7ede2ee9ea8d3edbf1ca84c1e333ad1a"
},
"dplyr": {
"Package": "dplyr",
@ -557,6 +557,18 @@
],
"Hash": "9fa7cdc5fbdb1c8511fdde72a944db63"
},
"packrat": {
"Package": "packrat",
"Version": "0.9.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"tools",
"utils"
],
"Hash": "55ddd2d4a1959535f18393478b0c14a6"
},
"pillar": {
"Package": "pillar",
"Version": "1.9.0",
@ -674,13 +686,13 @@
},
"renv": {
"Package": "renv",
"Version": "1.0.5",
"Version": "1.0.4",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"utils"
],
"Hash": "32c3f93e8360f667ca5863272ec8ba6a"
"Hash": "11abaf7c540ff33f94514d50f929bfd1"
},
"rlang": {
"Package": "rlang",
@ -693,6 +705,35 @@
],
"Hash": "42548638fae05fd9a9b5f3f437fbbbe2"
},
"rsconnect": {
"Package": "rsconnect",
"Version": "1.2.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"cli",
"curl",
"digest",
"jsonlite",
"lifecycle",
"openssl",
"packrat",
"renv",
"rlang",
"rstudioapi",
"tools",
"yaml"
],
"Hash": "94bb3a2125b01b13dd2e4a784c2a9639"
},
"rstudioapi": {
"Package": "rstudioapi",
"Version": "0.15.0",
"Source": "Repository",
"Repository": "CRAN",
"Hash": "5564500e25cffad9e22244ced1379887"
},
"sass": {
"Package": "sass",
"Version": "0.4.8",
@ -839,7 +880,7 @@
},
"tidyselect": {
"Package": "tidyselect",
"Version": "1.2.1",
"Version": "1.2.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@ -851,7 +892,7 @@
"vctrs",
"withr"
],
"Hash": "829f27b9c4919c16b593794a6344d6c0"
"Hash": "79540e5fcd9e0435af547d885f184fd5"
},
"tzdb": {
"Package": "tzdb",

View File

@ -2,7 +2,7 @@
local({
# the requested version of renv
version <- "1.0.5"
version <- "1.0.4"
attr(version, "sha") <- NULL
# the project directory