Skip to content

Commit

Permalink
[skip vbump] upversion to 0.4.0 (#280)
Browse files Browse the repository at this point in the history
Related with #226
  • Loading branch information
donyunardi authored Feb 1, 2024
1 parent 98f5631 commit 7106fa8
Show file tree
Hide file tree
Showing 21 changed files with 88 additions and 130 deletions.
21 changes: 10 additions & 11 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
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", , "[email protected]", role = c("aut", "cre")),
person("Aleksander", "Chlebowski", , "[email protected]", role = "aut"),
person("Dawid", "Kaledkowski", , "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9533-457X")),
person("Aleksander", "Chlebowski", , "[email protected]", role = "aut",
comment = c(ORCID = "0000-0001-5018-6294")),
person("Marcin", "Kosinski", , "[email protected]", role = "aut"),
person("Andre", "Verissimo", , "[email protected]", role = "aut"),
person("Andre", "Verissimo", , "[email protected]", role = "aut", comment = c(ORCID = "0000-0002-2212-339X")),
person("Pawel", "Rucki", , "[email protected]", role = "aut"),
person("Mahmoud", "Hallal", , "[email protected]", role = "aut"),
person("Nikolas", "Burkoff", role = "aut"),
Expand All @@ -18,8 +19,8 @@ Authors@R: c(
person("Dony", "Unardi", , "[email protected]", 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/
Expand All @@ -33,8 +34,7 @@ Imports:
methods,
rlang (>= 1.1.0),
stats,
utils,
yaml
utils
Suggests:
knitr (>= 1.42),
rmarkdown (>= 2.19),
Expand All @@ -44,18 +44,17 @@ 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
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'
'formatters_var_labels.R'
'deprecated.R'
'dummy_function.R'
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# teal.data 0.3.0.9042
# teal.data 0.4.0

### Enhancements

Expand Down
2 changes: 1 addition & 1 deletion R/cdisc_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
10 changes: 10 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
35 changes: 0 additions & 35 deletions R/default_cdisc_join_keys.R

This file was deleted.

4 changes: 2 additions & 2 deletions R/deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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)")
Expand Down
19 changes: 14 additions & 5 deletions R/teal_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#'
Expand All @@ -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,
Expand All @@ -42,7 +51,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'
Expand Down
18 changes: 0 additions & 18 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -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")
File renamed without changes.
22 changes: 22 additions & 0 deletions data-raw/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Binary file added data/default_cdisc_join_keys.rda
Binary file not shown.
1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Reproducibility
formatters
funder
getter
ORCID
pre
repo
reproducibility
Expand Down
17 changes: 0 additions & 17 deletions inst/js/custom.js

This file was deleted.

16 changes: 0 additions & 16 deletions man/build_cdisc_join_keys.Rd

This file was deleted.

7 changes: 3 additions & 4 deletions man/cdisc_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/col_labels.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion man/default_cdisc_join_keys.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/teal.data-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions man/teal_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions tests/testthat/test-cdisc_data.R
Original file line number Diff line number Diff line change
@@ -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"]
)
})

0 comments on commit 7106fa8

Please sign in to comment.