Skip to content

Commit

Permalink
Merge branch 'main' into 2519_fix_param_tte
Browse files Browse the repository at this point in the history
  • Loading branch information
bundfussr committed Nov 7, 2024
2 parents ecd417f + a7bfd9a commit b92f406
Show file tree
Hide file tree
Showing 32 changed files with 267 additions and 978 deletions.
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
^\.lycheeignore$
^staged_dependencies.yaml$
^inst/dev_dependencies.R$
^\.devcontainer$
^vignettes/articles$
^inst/cheatsheet$
^data-raw$
Expand Down
76 changes: 0 additions & 76 deletions .devcontainer/4.1/devcontainer.json

This file was deleted.

76 changes: 0 additions & 76 deletions .devcontainer/4.2/devcontainer.json

This file was deleted.

76 changes: 0 additions & 76 deletions .devcontainer/devcontainer.json

This file was deleted.

11 changes: 0 additions & 11 deletions .devcontainer/postCreateCommand.sh

This file was deleted.

8 changes: 0 additions & 8 deletions .devcontainer/rstudio-prefs.json

This file was deleted.

5 changes: 0 additions & 5 deletions .devcontainer/rstudio.sh

This file was deleted.

2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: admiral
Title: ADaM in R Asset Library
Version: 1.1.1.9012
Version: 1.1.1.9018
Authors@R: c(
person("Ben", "Straub", , "ben.x.straub@gsk.com", role = c("aut", "cre")),
person("Stefan", "Bundfuss", role = "aut",
Expand Down
13 changes: 12 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,24 @@
`AVALCATx` & `AVALCAxN`. (#2480)
- New function `derive_vars_crit_flag()` for deriving criterion flag variables
(`CRITy`, `CRITyFL`, `CRITyFLN`). (#2468)

- Replace use of `data("sdtm")` with `sdtm <- pharmaverse::sdtm` in templates and vignettes. (#2498)

- Remove `dthcaus_source()` calls in `ADSL` template because they are deprecated. (#2517)

## Updates of Existing Functions

- `derive_param_tte()` now provides a useful error message if in
`event_conditions` or `censor_conditions` a dataset is referenced which is not
specified in `source_datasets`. (#2519)

- In `derive_vars_query()` the error message was improved for the cases that
some of the requested query variables are already present in the input dataset
or that the queries dataset contains duplicates. (#2543)

- NCICTCAEv5 grading criteria fixed for `TERM = "INR Increased"`, criteria was
wrongly using `x ULN`, for first part of criteria for grades 1 to 3. For
example, `">2.5 x ULN"` changed to `">2.5"` for grade 3. (#2534)

## Breaking Changes

- The following function arguments are entering the next phase of the deprecation process: (#2487)
Expand Down Expand Up @@ -46,7 +55,9 @@ specified in `source_datasets`. (#2519)
<details>
<summary>Developer Notes</summary>

- Created unit tests for developer internal function `restricted_imputed_dtc_dt()` (#2495)
- Adopted `data-raw/data` R Package Convention (#2427)
- Removed `.devcontainer` file (codespace) (#2524)

</details>

Expand Down
6 changes: 4 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@
#' @keywords datasets
#' @family datasets
#' @source
#' An example of standard query dataset to be used in deriving variables in ADAE and ADCM
#' An example of standard query dataset to be used in deriving Standardized
#' MedDRA Query variables in ADAE
#'
"queries"

#' Queries MH Dataset
#' @keywords datasets
#' @family datasets
#' @source
#' An example of standard query MH dataset to be used in deriving variables in ADMH
#' An example of standard query MH dataset to be used in deriving Standardized
#' MedDRA Query variables in ADMH
#'
"queries_mh"

Expand Down
17 changes: 16 additions & 1 deletion R/derive_vars_query.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ get_vars_query <- function(dataset, dataset_queries) { # nolint: cyclocomp_linte
arrange(desc(order1), order2, order3) %>%
pull(value)

existing_new_vars <- intersect(new_col_names, colnames(dataset))
if (length(existing_new_vars) > 0) {
cli_abort(paste(
"The following variable{?s} requested by {.arg dataset_queries} already",
"exist{?s/} in {.arg dataset}: {.var {existing_new_vars}}"
))
}

# queries restructured
queries_wide <- dataset_queries %>%
mutate(
Expand Down Expand Up @@ -316,7 +324,14 @@ derive_vars_query <- function(dataset, dataset_queries) { # nolint: cyclocomp_li
#' @noRd
assert_valid_queries <- function(queries, queries_name) {
# check duplicate rows
signal_duplicate_records(queries, by_vars = exprs(!!!syms(colnames(queries))))
signal_duplicate_records(
queries,
msg = paste0(
"Queries dataset ({.var ", queries_name, "}) contains duplicate records ",
"with respect to {.var {replace_values_by_names(by_vars)}}"
),
by_vars = exprs(!!!syms(colnames(queries)))
)

# check illegal prefix category
is_good_prefix <- grepl("^[a-zA-Z]{2,3}", queries$PREFIX)
Expand Down
Binary file removed data-backup/admiral_adlb.rda
Binary file not shown.
Binary file removed data-backup/admiral_adsl.rda
Binary file not shown.
Loading

0 comments on commit b92f406

Please sign in to comment.