From 29206522eb3f7b45603a31c3b070b84ab89d38b6 Mon Sep 17 00:00:00 2001 From: Dony Unardi Date: Wed, 24 Jan 2024 08:56:44 -0800 Subject: [PATCH 01/11] [skip vbump] upversion to 0.4.0 --- DESCRIPTION | 4 ++-- NEWS.md | 2 +- R/deprecated.R | 4 ++-- R/teal_data.R | 2 +- man/col_labels.Rd | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 62c577c7a..1614229a0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: teal.data Title: Data Model for 'teal' Applications -Version: 0.3.0.9042 +Version: 0.4.0 Date: 2024-01-24 Authors@R: c( person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")), @@ -52,7 +52,7 @@ Language: en-US LazyData: true Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 -Collate: +Collate: 'cdisc_data.R' 'data.R' 'default_cdisc_join_keys.R' diff --git a/NEWS.md b/NEWS.md index dd39b9f1f..8dc3f9939 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.data 0.3.0.9042 +# teal.data 0.4.0 ### Enhancements diff --git a/R/deprecated.R b/R/deprecated.R index ad295f4a8..d4b3e9e93 100644 --- a/R/deprecated.R +++ b/R/deprecated.R @@ -17,7 +17,7 @@ NULL .deprecate_function <- function(what, details) { lifecycle::deprecate_stop( - when = "0.3.1", + when = "0.4.0", what = what, details = details ) @@ -338,7 +338,7 @@ get_join_keys <- function(...) { #' `r lifecycle::badge("deprecated")` #' #' In previous versions of `teal.data` labels were managed with `get_labels()`. -#' This function is deprecated as of `0.3.1`, use `col_labels` instead. +#' This function is deprecated as of `0.4.0`, use `col_labels` instead. #' @export get_labels <- function(...) { .deprecate_function("get_labels()", "Use col_labels(data)") diff --git a/R/teal_data.R b/R/teal_data.R index 5e37ba35a..12a64e774 100644 --- a/R/teal_data.R +++ b/R/teal_data.R @@ -42,7 +42,7 @@ teal_data <- function(..., ) ) { lifecycle::deprecate_stop( - when = "0.3.1", + when = "0.4.0", "teal_data( data_objects = 'should use data directly. Using TealDatasetConnector and TealDataset is deprecated. Find more information on https://github.com/insightsengineering/teal/discussions/945' diff --git a/man/col_labels.Rd b/man/col_labels.Rd index 7e2467d60..708f676be 100644 --- a/man/col_labels.Rd +++ b/man/col_labels.Rd @@ -49,7 +49,7 @@ These functions get or set this attribute, either on all (\code{col_labels}) or \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} In previous versions of \code{teal.data} labels were managed with \code{get_labels()}. -This function is deprecated as of \verb{0.3.1}, use \code{col_labels} instead. +This function is deprecated as of \verb{0.4.0}, use \code{col_labels} instead. } \examples{ x <- iris From 141251e6bfd95a24035b5f0979c202e0dba66777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ka=C5=82=C4=99dkowski?= <6959016+gogonzo@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:13:35 +0100 Subject: [PATCH 02/11] deprecate check (#282) Deprecate `check` argument --- R/cdisc_data.R | 2 +- R/teal_data.R | 17 +++++++++++++---- man/cdisc_data.Rd | 7 +++---- man/teal_data.Rd | 12 +++--------- tests/testthat/test-cdisc_data.R | 11 ++++++----- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/R/cdisc_data.R b/R/cdisc_data.R index 331ef7452..807e3bdd3 100644 --- a/R/cdisc_data.R +++ b/R/cdisc_data.R @@ -34,6 +34,6 @@ cdisc_data <- function(..., join_keys = teal.data::default_cdisc_join_keys[names(rlang::list2(...))], code = character(0), - check = FALSE) { + check) { teal_data(..., join_keys = join_keys, code = code, check = check) } diff --git a/R/teal_data.R b/R/teal_data.R index 12a64e774..70a2d472f 100644 --- a/R/teal_data.R +++ b/R/teal_data.R @@ -15,9 +15,8 @@ #' @param code (`character`, `language`) optional code to reproduce the datasets provided in `...`. #' Note this code is not executed and the `teal_data` may not be reproducible #' -#' @param check (`logical`) reproducibility check - whether to perform a check that the pre-processing -#' code included in the object definitions actually produces those objects. -#' If `check` is true and preprocessing code is empty an error will be thrown. +#' @param check (`logical`) `r lifecycle::badge("deprecated")` +#' Use [verify()] to verify code reproducibility . #' #' @return A `teal_data` object. #' @@ -29,11 +28,21 @@ teal_data <- function(..., join_keys = teal.data::join_keys(), code = character(0), - check = FALSE) { + check) { data_objects <- rlang::list2(...) if (inherits(join_keys, "join_key_set")) { join_keys <- teal.data::join_keys(join_keys) } + if (!missing(check)) { + lifecycle::deprecate_stop( + when = "0.4.0", + "teal_data( + check = 'check argument is deprecated. Use `verify()` to verify code reproducibility. + Find more information on https://github.com/insightsengineering/teal/discussions/945' + )" + ) + } + if ( checkmate::test_list( data_objects, diff --git a/man/cdisc_data.Rd b/man/cdisc_data.Rd index cecd579eb..2c356d90a 100644 --- a/man/cdisc_data.Rd +++ b/man/cdisc_data.Rd @@ -8,7 +8,7 @@ cdisc_data( ..., join_keys = teal.data::default_cdisc_join_keys[names(rlang::list2(...))], code = character(0), - check = FALSE + check ) } \arguments{ @@ -23,9 +23,8 @@ For ADAM datasets it would be automatically derived.} \item{code}{(\code{character}, \code{language}) optional code to reproduce the datasets provided in \code{...}. Note this code is not executed and the \code{teal_data} may not be reproducible} -\item{check}{(\code{logical}) reproducibility check - whether to perform a check that the pre-processing -code included in the object definitions actually produces those objects. -If \code{check} is true and preprocessing code is empty an error will be thrown.} +\item{check}{(\code{logical}) \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} +Use \code{\link[=verify]{verify()}} to verify code reproducibility .} } \value{ A \code{teal_data} object. diff --git a/man/teal_data.Rd b/man/teal_data.Rd index a8b6b6008..5676cef15 100644 --- a/man/teal_data.Rd +++ b/man/teal_data.Rd @@ -4,12 +4,7 @@ \alias{teal_data} \title{Comprehensive data integration function for \code{teal} applications} \usage{ -teal_data( - ..., - join_keys = teal.data::join_keys(), - code = character(0), - check = FALSE -) +teal_data(..., join_keys = teal.data::join_keys(), code = character(0), check) } \arguments{ \item{...}{any number of objects (presumably data objects) provided as \code{name = value} pairs.} @@ -22,9 +17,8 @@ If empty then no joins between pairs of objects.} \item{code}{(\code{character}, \code{language}) optional code to reproduce the datasets provided in \code{...}. Note this code is not executed and the \code{teal_data} may not be reproducible} -\item{check}{(\code{logical}) reproducibility check - whether to perform a check that the pre-processing -code included in the object definitions actually produces those objects. -If \code{check} is true and preprocessing code is empty an error will be thrown.} +\item{check}{(\code{logical}) \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} +Use \code{\link[=verify]{verify()}} to verify code reproducibility .} } \value{ A \code{teal_data} object. diff --git a/tests/testthat/test-cdisc_data.R b/tests/testthat/test-cdisc_data.R index bccb68c07..403a5497c 100644 --- a/tests/testthat/test-cdisc_data.R +++ b/tests/testthat/test-cdisc_data.R @@ -1,7 +1,8 @@ -testthat::test_that("cdisc_data returns teal_data object for objects different than old api", { - adsl_raw <- as.data.frame(as.list(stats::setNames(nm = default_cdisc_join_keys["ADSL", "ADSL"]))) - testthat::expect_s4_class( - teal_data(adsl = adsl_raw, check = TRUE), - "teal_data" +testthat::test_that("cdisc_data returns teal_data object with default join_keys for given dataset", { + data <- cdisc_data(ADSL = data.frame()) + testthat::expect_s4_class(data, "teal_data") + testthat::expect_identical( + join_keys(data), + default_cdisc_join_keys["ADSL"] ) }) From ed0b19cb9695d458effb3894a86036a41397d88a Mon Sep 17 00:00:00 2001 From: go_gonzo Date: Thu, 25 Jan 2024 09:30:32 +0100 Subject: [PATCH 03/11] orcid DK --- DESCRIPTION | 2 +- man/teal.data-package.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1614229a0..cd8eada4e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -4,7 +4,7 @@ Title: Data Model for 'teal' Applications Version: 0.4.0 Date: 2024-01-24 Authors@R: c( - person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")), + person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9533-457X")), person("Aleksander", "Chlebowski", , "aleksander.chlebowski@contractors.roche.com", role = "aut"), person("Marcin", "Kosinski", , "marcin.kosinski.mk1@roche.com", role = "aut"), person("Andre", "Verissimo", , "andre.verissimo@roche.com", role = "aut"), diff --git a/man/teal.data-package.Rd b/man/teal.data-package.Rd index 5aa95a20e..0c374afb9 100644 --- a/man/teal.data-package.Rd +++ b/man/teal.data-package.Rd @@ -21,7 +21,7 @@ Useful links: } \author{ -\strong{Maintainer}: Dawid Kaledkowski \email{dawid.kaledkowski@roche.com} +\strong{Maintainer}: Dawid Kaledkowski \email{dawid.kaledkowski@roche.com} (\href{https://orcid.org/0000-0001-9533-457X}{ORCID}) Authors: \itemize{ From 7f3e1a7d70b6236abc1eb20784898d9b34de7e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:38:18 +0100 Subject: [PATCH 04/11] orcid AV --- DESCRIPTION | 2 +- man/teal.data-package.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index cd8eada4e..0d92d698c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,7 +7,7 @@ Authors@R: c( person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9533-457X")), person("Aleksander", "Chlebowski", , "aleksander.chlebowski@contractors.roche.com", role = "aut"), person("Marcin", "Kosinski", , "marcin.kosinski.mk1@roche.com", role = "aut"), - person("Andre", "Verissimo", , "andre.verissimo@roche.com", role = "aut"), + person("Andre", "Verissimo", , "andre.verissimo@roche.com", role = "aut", comment = c(ORCID = "0000-0002-2212-339X")), person("Pawel", "Rucki", , "pawel.rucki@roche.com", role = "aut"), person("Mahmoud", "Hallal", , "mahmoud.hallal@roche.com", role = "aut"), person("Nikolas", "Burkoff", role = "aut"), diff --git a/man/teal.data-package.Rd b/man/teal.data-package.Rd index 0c374afb9..249efe775 100644 --- a/man/teal.data-package.Rd +++ b/man/teal.data-package.Rd @@ -27,7 +27,7 @@ Authors: \itemize{ \item Aleksander Chlebowski \email{aleksander.chlebowski@contractors.roche.com} \item Marcin Kosinski \email{marcin.kosinski.mk1@roche.com} - \item Andre Verissimo \email{andre.verissimo@roche.com} + \item Andre Verissimo \email{andre.verissimo@roche.com} (\href{https://orcid.org/0000-0002-2212-339X}{ORCID}) \item Pawel Rucki \email{pawel.rucki@roche.com} \item Mahmoud Hallal \email{mahmoud.hallal@roche.com} \item Nikolas Burkoff From eeb767b70c062e83f5a71a7baa189079063cd259 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Thu, 25 Jan 2024 09:48:41 +0100 Subject: [PATCH 05/11] add ORCID for AC --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0d92d698c..cf625ec35 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,7 +5,8 @@ Version: 0.4.0 Date: 2024-01-24 Authors@R: c( person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9533-457X")), - person("Aleksander", "Chlebowski", , "aleksander.chlebowski@contractors.roche.com", role = "aut"), + person("Aleksander", "Chlebowski", , "aleksander.chlebowski@contractors.roche.com", role = "aut", + comment = c(ORCID = "0000-0001-5018-6294")), person("Marcin", "Kosinski", , "marcin.kosinski.mk1@roche.com", role = "aut"), person("Andre", "Verissimo", , "andre.verissimo@roche.com", role = "aut", comment = c(ORCID = "0000-0002-2212-339X")), person("Pawel", "Rucki", , "pawel.rucki@roche.com", role = "aut"), From a31d630144d83c4b58be9cab3203ad7ebc7c5446 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Thu, 25 Jan 2024 09:48:51 +0100 Subject: [PATCH 06/11] update WORDLIST --- inst/WORDLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/inst/WORDLIST b/inst/WORDLIST index 695d2028a..a4662949b 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -5,6 +5,7 @@ Reproducibility formatters funder getter +ORCID pre repo reproducibility From 70e171472d6bc3ec651ad75b350e5c1d7c44b301 Mon Sep 17 00:00:00 2001 From: "27856297+dependabot-preview[bot]@users.noreply.github.com" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 08:50:59 +0000 Subject: [PATCH 07/11] [skip actions] Roxygen Man Pages Auto Update --- man/teal.data-package.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/teal.data-package.Rd b/man/teal.data-package.Rd index 249efe775..8dce91496 100644 --- a/man/teal.data-package.Rd +++ b/man/teal.data-package.Rd @@ -25,7 +25,7 @@ Useful links: Authors: \itemize{ - \item Aleksander Chlebowski \email{aleksander.chlebowski@contractors.roche.com} + \item Aleksander Chlebowski \email{aleksander.chlebowski@contractors.roche.com} (\href{https://orcid.org/0000-0001-5018-6294}{ORCID}) \item Marcin Kosinski \email{marcin.kosinski.mk1@roche.com} \item Andre Verissimo \email{andre.verissimo@roche.com} (\href{https://orcid.org/0000-0002-2212-339X}{ORCID}) \item Pawel Rucki \email{pawel.rucki@roche.com} From 7052a1b2a2e1cec680315a5cb73dc5f351409375 Mon Sep 17 00:00:00 2001 From: go_gonzo Date: Thu, 25 Jan 2024 09:52:04 +0100 Subject: [PATCH 08/11] restart cicd From 1512f1b1b400b49407dbad9ba868c2256a161679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:26:57 +0100 Subject: [PATCH 09/11] Response to comments from CRAN `0.4.0-rc2` (#284) Closes #283 #### Changes description - [x] Proposes a new description - [ ] Remove/adress `@examples` of non-exported functions #### Here are a few alternatives 1. Utilities to provide a unified data model for `teal` applications focusing on reproducibility and relational data. 1. Utilities to provide a unified data model for `teal` applications focusing on reproducibility. The model and data transformation functions support a wide range of data structures, such as `data.frame`, `MultiAssayExperiment`, matrices and others. Relationships between datasets can be modelled using `join_keys` function. 1. Utilities to provide a unified data model for `teal` applications focusing on reproducibility that supports a wide range of data structures, such as `data.frame`, `MultiAssayExperiment`, matrices and others. 1. Utilities to provide a unified data model for `teal` applications focusing on reproducibility. `teal.data` supports a wide range of data structures, such as `data.frame`, `MultiAssayExperiment` and matrices. 1. With a core focus on reproducibility, these utilities provide a unified data model for teal applications, supporting a diverse range of data structures such as `data.frame`, `MultiAssayExperiment`, matrices, and others. 1. Utilities to provide a unified data model for `teal` applications focusing on reproducibility and relational data. --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index cf625ec35..0083cdfdb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,8 +19,8 @@ Authors@R: c( person("Dony", "Unardi", , "unardid@gene.com", role = "rev"), person("F. Hoffmann-La Roche AG", role = c("cph", "fnd")) ) -Description: Utilities for data transformations compatible with 'teal' - applications. +Description: Provides a `teal_data` class as a unified data model for `teal` applications + focusing on reproducibility and relational data. License: Apache License 2.0 URL: https://insightsengineering.github.io/teal.data/, https://github.com/insightsengineering/teal.data/ From b814945ff00d130954063e4282a914ef2bac131b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:17:28 +0100 Subject: [PATCH 10/11] Moves `default_cdisc_join_keys` to data folder (#285) Co-authored-by: go_gonzo --- DESCRIPTION | 6 +-- NAMESPACE | 1 - R/data.R | 10 +++++ R/default_cdisc_join_keys.R | 35 ------------------ R/zzz.R | 18 --------- .../cdisc_datasets.yaml | 0 data-raw/data.R | 22 +++++++++++ data/default_cdisc_join_keys.rda | Bin 0 -> 634 bytes inst/js/custom.js | 17 --------- man/build_cdisc_join_keys.Rd | 16 -------- man/default_cdisc_join_keys.Rd | 12 +++++- 11 files changed, 45 insertions(+), 92 deletions(-) delete mode 100644 R/default_cdisc_join_keys.R rename {inst/cdisc_datasets => data-raw}/cdisc_datasets.yaml (100%) create mode 100644 data/default_cdisc_join_keys.rda delete mode 100644 inst/js/custom.js delete mode 100644 man/build_cdisc_join_keys.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 0083cdfdb..782a52f61 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,8 +34,7 @@ Imports: methods, rlang (>= 1.1.0), stats, - utils, - yaml + utils Suggests: knitr (>= 1.42), rmarkdown (>= 2.19), @@ -45,7 +44,7 @@ VignetteBuilder: RdMacros: lifecycle Config/Needs/verdepcheck: mllg/checkmate, r-lib/lifecycle, r-lib/rlang, - yaml=vubiostat/r-yaml, yihui/knitr, rstudio/rmarkdown, + yihui/knitr, rstudio/rmarkdown, insightsengineering/teal.code, r-lib/testthat Config/Needs/website: insightsengineering/nesttemplate Encoding: UTF-8 @@ -56,7 +55,6 @@ RoxygenNote: 7.3.1 Collate: 'cdisc_data.R' 'data.R' - 'default_cdisc_join_keys.R' 'formatters_var_labels.R' 'deprecated.R' 'dummy_function.R' diff --git a/NAMESPACE b/NAMESPACE index 8b39873a1..71db8957b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -44,7 +44,6 @@ export(dataset) export(dataset_connector) export(dataset_connector_file) export(dataset_file) -export(default_cdisc_join_keys) export(example_cdisc_data) export(fun_cdisc_dataset_connector) export(fun_dataset_connector) diff --git a/R/data.R b/R/data.R index 1ade4541f..88d6abea5 100644 --- a/R/data.R +++ b/R/data.R @@ -80,3 +80,13 @@ #' @source internal #' @name rADVS "rADVS" + +#' List containing default joining keys for `CDISC` datasets +#' +#' This data object is created at loading time from `cdisc_datasets/cdisc_datasets.yaml`. +#' +#' @name default_cdisc_join_keys +#' @usage default_cdisc_join_keys +#' @docType data +#' @source internal +"default_cdisc_join_keys" diff --git a/R/default_cdisc_join_keys.R b/R/default_cdisc_join_keys.R deleted file mode 100644 index a1e0d82d4..000000000 --- a/R/default_cdisc_join_keys.R +++ /dev/null @@ -1,35 +0,0 @@ -#' List containing default joining keys for `CDISC` datasets -#' -#' This data object is created at loading time from `cdisc_datasets/cdisc_datasets.yaml`. -#' -#' @name default_cdisc_join_keys -#' @docType data -#' @export -NULL - -#' Helper method to build `default_cdisc_join_keys` -#' @param default_cdisc_keys (`list`) default definition of primary and foreign -#' keys for `CDISC` datasets -#' -#' @keywords internal -build_cdisc_join_keys <- function(default_cdisc_keys) { - checkmate::assert_list(default_cdisc_keys, types = "list") - - jk <- join_keys() - for (name in names(default_cdisc_keys)) { - # Set default primary keys - keys_list <- default_cdisc_keys[[name]] - - if (!is.null(keys_list[["primary"]])) { - jk[[name]][[name]] <- keys_list[["primary"]] - } - - if (!is.null(keys_list[["parent"]])) { - if (!is.null(keys_list[["foreign"]])) { - jk[[name]][[keys_list[["parent"]]]] <- keys_list[["foreign"]] - } - parents(jk)[[name]] <- keys_list[["parent"]] - } - } - jk -} diff --git a/R/zzz.R b/R/zzz.R index 97652d917..b1dfb9432 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,20 +1,2 @@ -.onLoad <- function(libname, pkgname) { - # expose default CDISC dataset names - # copy from excel file - default_cdisc_keys <- yaml::yaml.load_file( - system.file("cdisc_datasets/cdisc_datasets.yaml", package = "teal.data") - ) - assign("default_cdisc_keys", default_cdisc_keys, envir = parent.env(environment())) - - # update default_cdisc_join_keys - assign( - "default_cdisc_join_keys", - build_cdisc_join_keys(default_cdisc_keys), - envir = parent.env(environment()) - ) - - invisible() -} - # use non-exported function from teal.code lang2calls <- getFromNamespace("lang2calls", "teal.code") diff --git a/inst/cdisc_datasets/cdisc_datasets.yaml b/data-raw/cdisc_datasets.yaml similarity index 100% rename from inst/cdisc_datasets/cdisc_datasets.yaml rename to data-raw/cdisc_datasets.yaml diff --git a/data-raw/data.R b/data-raw/data.R index 395da5c8b..4a81b0da6 100644 --- a/data-raw/data.R +++ b/data-raw/data.R @@ -26,3 +26,25 @@ usethis::use_data(rADTTE) rADVS <- synthetic_cdisc_data("latest")$advs # nolint: object_name_linter. usethis::use_data(rADVS) + +## Code to prepare default CDISC datasets for `teal.data` +default_cdisc_keys <- yaml::yaml.load_file(file.path("data-raw", "cdisc_datasets.yaml")) + +default_cdisc_join_keys <- teal.data::join_keys() +for (name in names(default_cdisc_keys)) { + # Set default primary keys + keys_list <- default_cdisc_keys[[name]] + + if (!is.null(keys_list[["primary"]])) { + default_cdisc_join_keys[[name]][[name]] <- keys_list[["primary"]] + } + + if (!is.null(keys_list[["parent"]])) { + if (!is.null(keys_list[["foreign"]])) { + default_cdisc_join_keys[[name]][[keys_list[["parent"]]]] <- keys_list[["foreign"]] + } + teal.data::parents(default_cdisc_join_keys)[[name]] <- keys_list[["parent"]] + } +} + +usethis::use_data(default_cdisc_join_keys) diff --git a/data/default_cdisc_join_keys.rda b/data/default_cdisc_join_keys.rda new file mode 100644 index 0000000000000000000000000000000000000000..bee6bd0324b6ff3a7dff1ff07644251c064b2cb4 GIT binary patch literal 634 zcmV-=0)_oTT4*^jL0KkKS;D83aR3gdZ-D>sSb#nNKlguNuRq=(00GbgUUcYa06H3} zrkZkY=ht000^Q00003m;e9( z000000Hr9J5E>IAdW}6yfY9`S01kv|bt6errxCxVRM5a-iZIHc#v=^s@`wB%)+o%A zjByG-xLQjnXb=p5GC=~C+Cym{sHW0OpF%qki0ao`M&+&+?fdoAH6s~t=9qJ4xZksQ zLgSGpy?L*)$Jb_)WN|qtj&d?c!3C6n329^REF%r0_ zRw^tp8A#^RO0~tV0aAw?4YZV2nnGg%p`ZZ>00bedCfZL!xrY50dCqekMi^l1FgX}B zF-KvEh8r3;G&vq+d7<&G?cp7)&B}KjZU%>(I}D1$ z1}TaRSbc}uqUmE67{S53(9zuE$x`2KW@EjJ7X!fPAyL(sct>#FJh&K%BK}P zRV<~;D>E|9=cMU(9gP^pbrrGJ*|IN%R{#J2 literal 0 HcmV?d00001 diff --git a/inst/js/custom.js b/inst/js/custom.js deleted file mode 100644 index d124a26be..000000000 --- a/inst/js/custom.js +++ /dev/null @@ -1,17 +0,0 @@ -// allow a button to be pressed by pressing the enter key see -// https://github.com/daattali/advanced-shiny/blob/master/proxy-click/app.R -$(function () { - var $els = $("[data-proxy-click]"); - $.each( - $els, - function (idx, el) { - var $el = $(el); - var $proxy = $("#" + $el.data("proxyClick")); - $el.keydown(function (e) { - if (e.keyCode == 13) { - $proxy.click(); - } - }); - } - ); -}); diff --git a/man/build_cdisc_join_keys.Rd b/man/build_cdisc_join_keys.Rd deleted file mode 100644 index 973ab213c..000000000 --- a/man/build_cdisc_join_keys.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/default_cdisc_join_keys.R -\name{build_cdisc_join_keys} -\alias{build_cdisc_join_keys} -\title{Helper method to build \code{default_cdisc_join_keys}} -\usage{ -build_cdisc_join_keys(default_cdisc_keys) -} -\arguments{ -\item{default_cdisc_keys}{(\code{list}) default definition of primary and foreign -keys for \code{CDISC} datasets} -} -\description{ -Helper method to build \code{default_cdisc_join_keys} -} -\keyword{internal} diff --git a/man/default_cdisc_join_keys.Rd b/man/default_cdisc_join_keys.Rd index f0c53ebd1..266dd9d9c 100644 --- a/man/default_cdisc_join_keys.Rd +++ b/man/default_cdisc_join_keys.Rd @@ -1,9 +1,19 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/default_cdisc_join_keys.R +% Please edit documentation in R/data.R \docType{data} \name{default_cdisc_join_keys} \alias{default_cdisc_join_keys} \title{List containing default joining keys for \code{CDISC} datasets} +\format{ +An object of class \code{join_keys} (inherits from \code{list}) of length 19. +} +\source{ +internal +} +\usage{ +default_cdisc_join_keys +} \description{ This data object is created at loading time from \code{cdisc_datasets/cdisc_datasets.yaml}. } +\keyword{datasets} From 75d07c203b2fc92b36e31ca8fe98d23b8e226714 Mon Sep 17 00:00:00 2001 From: go_gonzo Date: Sun, 28 Jan 2024 17:36:14 +0100 Subject: [PATCH 11/11] remove back ticks from description --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 782a52f61..fe30f1b1a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,7 +19,7 @@ Authors@R: c( person("Dony", "Unardi", , "unardid@gene.com", role = "rev"), person("F. Hoffmann-La Roche AG", role = c("cph", "fnd")) ) -Description: Provides a `teal_data` class as a unified data model for `teal` applications +Description: Provides a 'teal_data' class as a unified data model for 'teal' applications focusing on reproducibility and relational data. License: Apache License 2.0 URL: https://insightsengineering.github.io/teal.data/,