mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2024-11-22 13:30:23 +01:00
minor changes
This commit is contained in:
parent
b63fbbe3c9
commit
a7a416fe1d
@ -16,3 +16,4 @@
|
|||||||
^cran-comments\.md$
|
^cran-comments\.md$
|
||||||
^CRAN-SUBMISSION$
|
^CRAN-SUBMISSION$
|
||||||
drafting
|
drafting
|
||||||
|
app
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
options(
|
options(
|
||||||
renv.settings.snapshot.type = "explicit",
|
renv.settings.snapshot.type = "explicit",
|
||||||
renv.config.auto.snapshot = TRUE,
|
renv.config.auto.snapshot = TRUE,
|
||||||
renv.config.pak.enabled = TRUE
|
renv.config.pak.enabled = TRUE,
|
||||||
|
rmarkdown.html_vignette.check_title = FALSE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
source("renv/activate.R")
|
source("renv/activate.R")
|
||||||
|
|
||||||
if (interactive()) {
|
if (interactive()) {
|
||||||
|
13
DESCRIPTION
13
DESCRIPTION
@ -8,10 +8,9 @@ Authors@R: c(
|
|||||||
comment = c(ORCID = "0000-0001-6948-9498")))
|
comment = c(ORCID = "0000-0001-6948-9498")))
|
||||||
Description: Originally forked from the R part of 'REDCapRITS' by Paul Egeler.
|
Description: Originally forked from the R part of 'REDCapRITS' by Paul Egeler.
|
||||||
See <https://github.com/pegeler/REDCapRITS>.
|
See <https://github.com/pegeler/REDCapRITS>.
|
||||||
Handles castellated datasets from 'REDCap' projects with repeating instruments.
|
'REDCap' database casting and handling of castellated data when using
|
||||||
Assists in casting tidy tables from raw 'REDCap' data exports for each
|
repeated instruments and longitudinal projects. Keeps a focused data export
|
||||||
repeated instrument. Keeps a focused data export approach, by allowing to
|
approach, by allowing to only export required data from the database.
|
||||||
only export required data from the database.
|
|
||||||
'REDCap' (Research Electronic Data Capture) is a secure, web-based software
|
'REDCap' (Research Electronic Data Capture) is a secure, web-based software
|
||||||
platform designed to support data capture for research studies, providing
|
platform designed to support data capture for research studies, providing
|
||||||
1) an intuitive interface for validated data capture; 2) audit trails for
|
1) an intuitive interface for validated data capture; 2) audit trails for
|
||||||
@ -22,7 +21,6 @@ Description: Originally forked from the R part of 'REDCapRITS' by Paul Egeler.
|
|||||||
Harris et al (2019) <doi:10.1016/j.jbi.2019.103208>).
|
Harris et al (2019) <doi:10.1016/j.jbi.2019.103208>).
|
||||||
Depends: R (>= 3.4.0)
|
Depends: R (>= 3.4.0)
|
||||||
Suggests:
|
Suggests:
|
||||||
spelling,
|
|
||||||
httr,
|
httr,
|
||||||
jsonlite,
|
jsonlite,
|
||||||
testthat,
|
testthat,
|
||||||
@ -38,7 +36,9 @@ Suggests:
|
|||||||
devtools,
|
devtools,
|
||||||
roxygen2,
|
roxygen2,
|
||||||
openxlsx2,
|
openxlsx2,
|
||||||
rsconnect
|
rsconnect,
|
||||||
|
shiny,
|
||||||
|
spelling
|
||||||
License: GPL (>= 3)
|
License: GPL (>= 3)
|
||||||
Encoding: UTF-8
|
Encoding: UTF-8
|
||||||
LazyData: true
|
LazyData: true
|
||||||
@ -61,6 +61,7 @@ Collate:
|
|||||||
'ds2dd.R'
|
'ds2dd.R'
|
||||||
'ds2dd_detailed.R'
|
'ds2dd_detailed.R'
|
||||||
'easy_redcap.R'
|
'easy_redcap.R'
|
||||||
|
'mtcars_redcap.R'
|
||||||
'read_redcap_instrument.R'
|
'read_redcap_instrument.R'
|
||||||
'read_redcap_tables.R'
|
'read_redcap_tables.R'
|
||||||
'redcap_wider.R'
|
'redcap_wider.R'
|
||||||
|
@ -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)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
utils::globalVariables(c("server"))
|
||||||
#' Shiny server factory
|
#' Shiny server factory
|
||||||
#'
|
#'
|
||||||
#' @return shiny server
|
#' @return shiny server
|
||||||
@ -36,6 +37,9 @@ shiny_cast <- function() {
|
|||||||
|
|
||||||
#' Deploy the Shiny app with rsconnect
|
#' Deploy the Shiny app with rsconnect
|
||||||
#'
|
#'
|
||||||
|
#' @param path app folder path
|
||||||
|
#' @param name.app name of deployed app
|
||||||
|
#'
|
||||||
#' @return deploy
|
#' @return deploy
|
||||||
#' @export
|
#' @export
|
||||||
#'
|
#'
|
||||||
@ -43,9 +47,6 @@ shiny_cast <- function() {
|
|||||||
#' # deploy_shiny
|
#' # deploy_shiny
|
||||||
#'
|
#'
|
||||||
deploy_shiny <- function(path=here::here("app/"), name.app="shiny_cast"){
|
deploy_shiny <- function(path=here::here("app/"), name.app="shiny_cast"){
|
||||||
# Ensure to install latest package version
|
|
||||||
renv::install("agdamsbo/REDCapCAST")
|
|
||||||
|
|
||||||
# Connecting
|
# Connecting
|
||||||
rsconnect::setAccountInfo(
|
rsconnect::setAccountInfo(
|
||||||
name = "cognitiveindex",
|
name = "cognitiveindex",
|
||||||
|
14
README.md
14
README.md
@ -16,25 +16,27 @@ REDCap database casting and handling of castellated data when using repeated ins
|
|||||||
|
|
||||||
This package is a fork of [pegeler/REDCapRITS](https://github.com/pegeler/REDCapRITS). The REDCapRITS represents great and extensive work to handle castellated REDCap data in different programming languages. This fork is purely minded on R usage and includes a few implementations of the main `REDCap_split` function.
|
This package is a fork of [pegeler/REDCapRITS](https://github.com/pegeler/REDCapRITS). The REDCapRITS represents great and extensive work to handle castellated REDCap data in different programming languages. This fork is purely minded on R usage and includes a few implementations of the main `REDCap_split` function.
|
||||||
|
|
||||||
THis package is very much to be seen as an attempt at a REDCap-R foundry for handling both the transition from dataset/variable list to database and the other way, from REDCap database to a tidy dataset. The goal was also to allow for a "minimal data" approach by allowing to filter records, instruments and variables in the export to only download data needed. I think this approach is desireable for handling sensitive, clinical data. No similar functionality is available from similar tools (like `REDCapR` or `REDCapTidieR`). Please refer to [REDCap-Tools](https://redcap-tools.github.io/) for other great tools.
|
This package is very much to be seen as an attempt at a R-to-REDCap-to-R foundry for handling both the transition from dataset/variable list to database and the other way, from REDCap database to a tidy dataset. The goal was also to allow for a "minimal data" approach by allowing to filter records, instruments and variables in the export to only download data needed. I think this approach is desirable for handling sensitive, clinical data. Please refer to [REDCap-Tools](https://redcap-tools.github.io/) for other great tools for working with REDCap in R.
|
||||||
|
|
||||||
## Use and immprovements
|
## Use and immprovements
|
||||||
|
|
||||||
This package is primarily relevant for working with longitudinal projects and/or projects using repeated instruments. Here is just a short descirption of the main functions:
|
Here is just a short description of the main functions:
|
||||||
|
|
||||||
* `REDcap_split()`: Works largely as the original `REDCapRITS::REDCap_split()`. It takes a REDCap dataset and metadata (data dictionary) to split the data set into a list of dataframes of instruments.
|
* `REDcap_split()`: Works largely as the original `REDCapRITS::REDCap_split()`. It takes a REDCap dataset and metadata (data dictionary) to split the data set into a list of dataframes of instruments.
|
||||||
|
|
||||||
* `read_redcap_tables()`: wraps the use of [`REDCapR::redcap_read()`](https://github.com/OuhscBbmc/REDCapR) with `REDCap_split()` to ease the export of REDCap data.
|
* `read_redcap_tables()`: wraps the use of [`REDCapR::redcap_read()`](https://github.com/OuhscBbmc/REDCapR) with `REDCap_split()` to ease the export of REDCap data. Default output is a list of data frames with one data frame for each REDCap instrument.
|
||||||
|
|
||||||
* `redcap_wider()`: pivots each data frame with repeated instruments to a wide format utilizing the [`tidyr::pivot_wider()`](https://tidyr.tidyverse.org/reference/pivot_wider.html) from the [tidyverse](https://www.tidyverse.org/).
|
* `redcap_wider()`: joins and pivots a list of data frames with repeated instruments to a wide format utilizing the [`tidyr::pivot_wider()`](https://tidyr.tidyverse.org/reference/pivot_wider.html) from the [tidyverse](https://www.tidyverse.org/).
|
||||||
|
|
||||||
* `easy_redcap()`: combines secure API key storage with the `keyring`-package, focused data retrieval and optional widening. This is the recommended approach for easy data access and analysis.
|
* `easy_redcap()`: combines secure API key storage with the `keyring`-package, focused data retrieval and optional widening. This is the recommended approach for easy data access and analysis.
|
||||||
|
|
||||||
...
|
* `ds2dd_detailed()`: Converts a data set to a data dictionary for upload to a new REDCap database. Variables (fields) and instruments in a REDCap data base are defined by this data dictionary.
|
||||||
|
|
||||||
|
* `shiny_cast()`: [Shiny]() application to ease the process of converting a spreadsheet/data set to a REDCap database. The app runs locally and data is transferred securely. You can just create and upload the data dictionary, but you can also transfer the given data in the same process.
|
||||||
|
|
||||||
## Future
|
## Future
|
||||||
|
|
||||||
The plan with this package is to be bundled with a Handbook on working with REDCap from R. I plan to also include functionality to assist in casting (yes, pun intended) the initial REDCap database.
|
The plan with this package is to be bundled with a Handbook on working with REDCap from R. This work is in progress but is limited by the time available. Please feel free to contact me or create and issue with ideas for future additions.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
@ -18,4 +18,4 @@ StripTrailingWhitespace: Yes
|
|||||||
BuildType: Package
|
BuildType: Package
|
||||||
PackageUseDevtools: Yes
|
PackageUseDevtools: Yes
|
||||||
PackageInstallArgs: --no-multiarch --with-keep.source
|
PackageInstallArgs: --no-multiarch --with-keep.source
|
||||||
PackageRoxygenize: rd,collate,namespace,vignette
|
PackageRoxygenize: rd,collate,namespace
|
||||||
|
4
app/ui.R
4
app/ui.R
@ -40,12 +40,12 @@ ui <- shiny::fluidPage(
|
|||||||
shiny::textInput(
|
shiny::textInput(
|
||||||
inputId = "uri",
|
inputId = "uri",
|
||||||
label = "URI",
|
label = "URI",
|
||||||
value = "https://redcap.au.dk/api/"
|
value = "https://redcap.your.institution/api/"
|
||||||
),
|
),
|
||||||
shiny::textInput(
|
shiny::textInput(
|
||||||
inputId = "api",
|
inputId = "api",
|
||||||
label = "API key",
|
label = "API key",
|
||||||
value = "21CF2C17EA1CA4F3688DF991C8FE3EBF"
|
value = ""
|
||||||
),
|
),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
inputId = "upload.meta",
|
inputId = "upload.meta",
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
mtcars |> dplyr::mutate(record_id=seq_len(n()),
|
mtcars_redcap <- mtcars |> dplyr::mutate(record_id=seq_len(dplyr::n()),
|
||||||
name=rownames(mtcars)
|
name=rownames(mtcars)
|
||||||
) |>
|
) |>
|
||||||
dplyr::select(record_id,dplyr::everything()) |>
|
dplyr::select(record_id,dplyr::everything())
|
||||||
|
|
||||||
|
mtcars_redcap |>
|
||||||
write.csv(here::here("data/mtcars_redcap.csv"),row.names = FALSE)
|
write.csv(here::here("data/mtcars_redcap.csv"),row.names = FALSE)
|
||||||
|
|
||||||
|
usethis::use_data(mtcars_redcap, overwrite = TRUE)
|
||||||
|
Loading…
Reference in New Issue
Block a user