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

View File

@ -21,8 +21,6 @@ jobs:
with: with:
use-public-rspm: true use-public-rspm: true
- uses: r-lib/actions/setup-renv@v2
- uses: r-lib/actions/setup-r-dependencies@v2 - uses: r-lib/actions/setup-r-dependencies@v2
with: with:
extra-packages: any::covr 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 Package: REDCapCAST
Title: REDCap Castellated Data Handling Title: REDCap Castellated Data Handling
Version: 24.3.1 Version: 24.2.1
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")),
@ -28,6 +28,7 @@ Suggests:
knitr, knitr,
rmarkdown, rmarkdown,
gt, gt,
usethis,
ggplot2, ggplot2,
here, here,
styler, styler,
@ -51,6 +52,7 @@ Imports:
stats, stats,
shiny, shiny,
openxlsx2, openxlsx2,
rsconnect,
haven haven
Collate: Collate:
'utils.r' 'utils.r'

View File

@ -3,6 +3,7 @@
export(REDCap_split) export(REDCap_split)
export(clean_redcap_name) export(clean_redcap_name)
export(d2w) export(d2w)
export(deploy_shiny)
export(ds2dd) export(ds2dd)
export(ds2dd_detailed) export(ds2dd_detailed)
export(easy_redcap) 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 # REDCapCAST 24.2.1
### Functions ### 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( ui <- shiny::fluidPage(
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", shiny::sidebarPanel(
# windowTitle = "REDCap database creator" shiny::h4("REDCap database and dataset"),
# ), shiny::fileInput("ds", "Choose data file",
multiple = FALSE,
shiny::titlePanel(title = shiny::div(shiny::a(shiny::img(src="logo.png"),href="https://agdamsbo.github.io/REDCapCAST"), accept = c(
"Easy REDCap database creation"), ".csv",
windowTitle = "REDCap database creator" ".xls",
".xlsx",
".dta"
)
), ),
shiny::h4("This tool includes to convenient functions:", shiny::h6("Below you can download the dataset formatted for upload and the
shiny::br(), corresponding data dictionary for a new data base."),
"1) creating a REDCap data dictionary based on a spreadsheet (.csv/.xls(x)/.dta) and", # Button
shiny::br(), shiny::downloadButton("downloadData", "Download data"),
"2) creating said database on a given REDCap server and uploading the dataset via API access."),
# Button
shiny::downloadButton("downloadMeta", "Download dictionary"),
## ----------------------------------------------------------------------------- # Horizontal line ----
## Side panel shiny::tags$hr(),
## ----------------------------------------------------------------------------- shiny::h4("REDCap upload"),
shiny::textInput(
shiny::sidebarPanel( inputId = "uri",
shiny::h4("1) REDCap datadictionary and compatible dataset"), label = "URI",
shiny::fileInput("ds", "Choose data file", value = "https://redcap.your.institution/api/"
multiple = FALSE, ),
accept = c( shiny::textInput(
".csv", inputId = "api",
".xls", label = "API key",
".xlsx", value = ""
".dta" ),
) shiny::actionButton(
), inputId = "upload.meta",
shiny::h6("Below you can download the dataset formatted for upload and the label = "Upload dictionary", icon = shiny::icon("book-bookmark")
corresponding data dictionary for a new data base, if you want to upload manually."), ),
# Button shiny::h6("Please note, that before uploading any real data, put your project
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
into production mode."), into production mode."),
shiny::actionButton( shiny::actionButton(
inputId = "upload.data", inputId = "upload.data",
label = "Upload data", icon = shiny::icon("upload") 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 ---- ## Upload tab
shiny::tags$hr() ## -----------------------------------------------------------------------------
), shiny::tabPanel(
shiny::mainPanel( "Upload",
shiny::tabsetPanel( shiny::h3("Meta upload overview"),
shiny::htmlOutput("upload.meta.print", container = shiny::span),
## ----------------------------------------------------------------------------- shiny::h3("Data upload overview"),
## Summary tab shiny::htmlOutput("upload.data.print", container = shiny::span)
## -----------------------------------------------------------------------------
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)
)
) )
), )
# 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": { "curl": {
"Package": "curl", "Package": "curl",
"Version": "5.2.1", "Version": "5.2.0",
"Source": "Repository", "Source": "Repository",
"Repository": "CRAN", "Repository": "CRAN",
"Requirements": [ "Requirements": [
"R" "R"
], ],
"Hash": "411ca2c03b1ce5f548345d2fc2685f7a" "Hash": "ce88d13c0b10fe88a37d9c59dba2d7f9"
}, },
"digest": { "digest": {
"Package": "digest", "Package": "digest",
"Version": "0.6.35", "Version": "0.6.34",
"Source": "Repository", "Source": "Repository",
"Repository": "CRAN", "Repository": "CRAN",
"Requirements": [ "Requirements": [
"R", "R",
"utils" "utils"
], ],
"Hash": "698ece7ba5a4fa4559e3d537e7ec3d31" "Hash": "7ede2ee9ea8d3edbf1ca84c1e333ad1a"
}, },
"dplyr": { "dplyr": {
"Package": "dplyr", "Package": "dplyr",
@ -557,6 +557,18 @@
], ],
"Hash": "9fa7cdc5fbdb1c8511fdde72a944db63" "Hash": "9fa7cdc5fbdb1c8511fdde72a944db63"
}, },
"packrat": {
"Package": "packrat",
"Version": "0.9.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"tools",
"utils"
],
"Hash": "55ddd2d4a1959535f18393478b0c14a6"
},
"pillar": { "pillar": {
"Package": "pillar", "Package": "pillar",
"Version": "1.9.0", "Version": "1.9.0",
@ -674,13 +686,13 @@
}, },
"renv": { "renv": {
"Package": "renv", "Package": "renv",
"Version": "1.0.5", "Version": "1.0.4",
"Source": "Repository", "Source": "Repository",
"Repository": "CRAN", "Repository": "CRAN",
"Requirements": [ "Requirements": [
"utils" "utils"
], ],
"Hash": "32c3f93e8360f667ca5863272ec8ba6a" "Hash": "11abaf7c540ff33f94514d50f929bfd1"
}, },
"rlang": { "rlang": {
"Package": "rlang", "Package": "rlang",
@ -693,6 +705,35 @@
], ],
"Hash": "42548638fae05fd9a9b5f3f437fbbbe2" "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": { "sass": {
"Package": "sass", "Package": "sass",
"Version": "0.4.8", "Version": "0.4.8",
@ -839,7 +880,7 @@
}, },
"tidyselect": { "tidyselect": {
"Package": "tidyselect", "Package": "tidyselect",
"Version": "1.2.1", "Version": "1.2.0",
"Source": "Repository", "Source": "Repository",
"Repository": "CRAN", "Repository": "CRAN",
"Requirements": [ "Requirements": [
@ -851,7 +892,7 @@
"vctrs", "vctrs",
"withr" "withr"
], ],
"Hash": "829f27b9c4919c16b593794a6344d6c0" "Hash": "79540e5fcd9e0435af547d885f184fd5"
}, },
"tzdb": { "tzdb": {
"Package": "tzdb", "Package": "tzdb",

View File

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