Skip to content

Commit

Permalink
Merge branch 'main' into 2546_update_ABLFL_example_derive_var_base
Browse files Browse the repository at this point in the history
  • Loading branch information
sadchla-codes authored Nov 13, 2024
2 parents 0ba446c + dbd8e96 commit 63902f3
Show file tree
Hide file tree
Showing 13 changed files with 398 additions and 384 deletions.
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.9021
Version: 1.1.1.9022
Authors@R: c(
person("Ben", "Straub", , "ben.x.straub@gsk.com", role = c("aut", "cre")),
person("Stefan", "Bundfuss", role = "aut",
Expand Down
10 changes: 7 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ or that the queries dataset contains duplicates. (#2543)
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)

- `derive_vars_atc()` and `create_single_dose_dataset()` `by_vars` argument updated to use `get_admiral_option("subject_keys")` instead of `USUBJID` or `STUDYID` in `bds_exposure.Rmd`. (#2501)

- test scripts, R, and markdown files for `create_single_dose_dataset` and `occds.Rmd` updated to include a `STUDYID` column because of `get_admiral_option("subject_keys")` update above. (#2501)

## Breaking Changes

- The following function arguments are entering the next phase of the deprecation process: (#2487)
Expand All @@ -58,6 +62,8 @@ example, `">2.5 x ULN"` changed to `">2.5"` for grade 3. (#2534)

## Documentation

- `derive_locf_records()` documentation example was fixed to display LOCF records. (#2461)

## Various

<details>
Expand All @@ -70,12 +76,9 @@ example, `">2.5 x ULN"` changed to `">2.5"` for grade 3. (#2534)
</details>

# admiral 1.1.1

- `derive_extreme_event()` was fixed such that `check_type = "none"` is accepted
again. (#2462)

- `derive_locf_records()` documentation example was fixed to display LOCF records. (#2461)

# admiral 1.1.0

## New Features
Expand All @@ -87,6 +90,7 @@ again. (#2462)

## Updates of Existing Functions


- `group_var` (optional) parameter is added to `derive_var_trtemfl()` to derive `TRTEMFL` for AE data if the data are collected as one episode of AE with multiple lines. (#2302)

- Templates for ADPC, ADPPK and ADPP are updated to handle urine records. (#2392)
Expand Down
27 changes: 14 additions & 13 deletions R/create_single_dose_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ dose_freq_lookup <- tribble(
#' library(dplyr)
#'
#' data <- tribble(
#' ~USUBJID, ~EXDOSFRQ, ~ASTDT, ~ASTDTM, ~AENDT, ~AENDTM,
#' "P01", "Q2D", ymd("2021-01-01"), ymd_hms("2021-01-01 10:30:00"),
#' ~STUDYID, ~USUBJID, ~EXDOSFRQ, ~ASTDT, ~ASTDTM, ~AENDT, ~AENDTM,
#' "STUDY01", "P01", "Q2D", ymd("2021-01-01"), ymd_hms("2021-01-01 10:30:00"),
#' ymd("2021-01-07"), ymd_hms("2021-01-07 11:30:00"),
#' "P01", "Q3D", ymd("2021-01-08"), ymd_hms("2021-01-08 12:00:00"),
#' "STUDY01", "P01", "Q3D", ymd("2021-01-08"), ymd_hms("2021-01-08 12:00:00"),
#' ymd("2021-01-14"), ymd_hms("2021-01-14 14:00:00"),
#' "P01", "EVERY 2 WEEKS", ymd("2021-01-15"), ymd_hms("2021-01-15 09:57:00"),
#' "STUDY01", "P01", "EVERY 2 WEEKS", ymd("2021-01-15"), ymd_hms("2021-01-15 09:57:00"),
#' ymd("2021-01-29"), ymd_hms("2021-01-29 10:57:00")
#' )
#'
Expand All @@ -307,10 +307,10 @@ dose_freq_lookup <- tribble(
#' )
#'
#' data <- tribble(
#' ~USUBJID, ~EXDOSFRQ, ~ASTDT, ~ASTDTM, ~AENDT, ~AENDTM,
#' "P01", "Q30MIN", ymd("2021-01-01"), ymd_hms("2021-01-01T06:00:00"),
#' ~STUDYID, ~USUBJID, ~EXDOSFRQ, ~ASTDT, ~ASTDTM, ~AENDT, ~AENDTM,
#' "STUDY01", "P01", "Q30MIN", ymd("2021-01-01"), ymd_hms("2021-01-01T06:00:00"),
#' ymd("2021-01-01"), ymd_hms("2021-01-01T07:00:00"),
#' "P02", "Q90MIN", ymd("2021-01-01"), ymd_hms("2021-01-01T06:00:00"),
#' "STUDY02", "P02", "Q90MIN", ymd("2021-01-01"), ymd_hms("2021-01-01T06:00:00"),
#' ymd("2021-01-01"), ymd_hms("2021-01-01T09:00:00")
#' )
#'
Expand All @@ -323,12 +323,12 @@ dose_freq_lookup <- tribble(
#' # Example with nominal time
#'
#' data <- tribble(
#' ~USUBJID, ~EXDOSFRQ, ~NFRLT, ~ASTDT, ~ASTDTM, ~AENDT, ~AENDTM,
#' "P01", "BID", 0, ymd("2021-01-01"), ymd_hms("2021-01-01 08:00:00"),
#' ~STUDYID, ~USUBJID, ~EXDOSFRQ, ~NFRLT, ~ASTDT, ~ASTDTM, ~AENDT, ~AENDTM,
#' "STUDY01", "P01", "BID", 0, ymd("2021-01-01"), ymd_hms("2021-01-01 08:00:00"),
#' ymd("2021-01-07"), ymd_hms("2021-01-07 20:00:00"),
#' "P01", "BID", 168, ymd("2021-01-08"), ymd_hms("2021-01-08 08:00:00"),
#' "STUDY01", "P01", "BID", 168, ymd("2021-01-08"), ymd_hms("2021-01-08 08:00:00"),
#' ymd("2021-01-14"), ymd_hms("2021-01-14 20:00:00"),
#' "P01", "BID", 336, ymd("2021-01-15"), ymd_hms("2021-01-15 08:00:00"),
#' "STUDY01", "P01", "BID", 336, ymd("2021-01-15"), ymd_hms("2021-01-15 08:00:00"),
#' ymd("2021-01-29"), ymd_hms("2021-01-29 20:00:00")
#' )
#'
Expand Down Expand Up @@ -397,7 +397,7 @@ dose_freq_lookup <- tribble(
#' # Select valid dose records, non-missing `EXSTDTC` and `EXDOSE`.
#' ex_mod <- ex %>%
#' filter(!is.na(EXSTDTC) & !is.na(EXDOSE)) %>%
#' derive_vars_merged(adsl_death, by_vars = exprs(STUDYID, USUBJID)) %>%
#' derive_vars_merged(adsl_death, by_vars = get_admiral_option("subject_keys")) %>%
#' # Example, set up missing `EXDOSFRQ` as QD daily dosing regime.
#' # Replace with study dosing regime per trial treatment.
#' mutate(EXDOSFRQ = if_else(is.na(EXDOSFRQ), "QD", EXDOSFRQ)) %>%
Expand Down Expand Up @@ -450,7 +450,8 @@ create_single_dose_dataset <- function(dataset,
lookup_column = CDISC_VALUE,
nominal_time = NULL,
keep_source_vars = expr_c(
exprs(USUBJID), dose_freq, start_date, start_datetime,
get_admiral_option("subject_keys"), dose_freq,
start_date, start_datetime,
end_date, end_datetime
)) {
dose_freq <- assert_symbol(enexpr(dose_freq))
Expand Down
105 changes: 54 additions & 51 deletions R/derive_vars_transposed.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,33 +56,33 @@
#' library(dplyr, warn.conflicts = FALSE)
#'
#' cm <- tribble(
#' ~USUBJID, ~CMGRPID, ~CMREFID, ~CMDECOD,
#' "BP40257-1001", "14", "1192056", "PARACETAMOL",
#' "BP40257-1001", "18", "2007001", "SOLUMEDROL",
#' "BP40257-1002", "19", "2791596", "SPIRONOLACTONE"
#' ~USUBJID, ~CMGRPID, ~CMREFID, ~CMDECOD,
#' "BP40257-1001", "14", "1192056", "PARACETAMOL",
#' "BP40257-1001", "18", "2007001", "SOLUMEDROL",
#' "BP40257-1002", "19", "2791596", "SPIRONOLACTONE"
#' )
#' facm <- tribble(
#' ~USUBJID, ~FAGRPID, ~FAREFID, ~FATESTCD, ~FASTRESC,
#' "BP40257-1001", "1", "1192056", "CMATC1CD", "N",
#' "BP40257-1001", "1", "1192056", "CMATC2CD", "N02",
#' "BP40257-1001", "1", "1192056", "CMATC3CD", "N02B",
#' "BP40257-1001", "1", "1192056", "CMATC4CD", "N02BE",
#' "BP40257-1001", "1", "2007001", "CMATC1CD", "D",
#' "BP40257-1001", "1", "2007001", "CMATC2CD", "D10",
#' "BP40257-1001", "1", "2007001", "CMATC3CD", "D10A",
#' "BP40257-1001", "1", "2007001", "CMATC4CD", "D10AA",
#' "BP40257-1001", "2", "2007001", "CMATC1CD", "D",
#' "BP40257-1001", "2", "2007001", "CMATC2CD", "D07",
#' "BP40257-1001", "2", "2007001", "CMATC3CD", "D07A",
#' "BP40257-1001", "2", "2007001", "CMATC4CD", "D07AA",
#' "BP40257-1001", "3", "2007001", "CMATC1CD", "H",
#' "BP40257-1001", "3", "2007001", "CMATC2CD", "H02",
#' "BP40257-1001", "3", "2007001", "CMATC3CD", "H02A",
#' "BP40257-1001", "3", "2007001", "CMATC4CD", "H02AB",
#' "BP40257-1002", "1", "2791596", "CMATC1CD", "C",
#' "BP40257-1002", "1", "2791596", "CMATC2CD", "C03",
#' "BP40257-1002", "1", "2791596", "CMATC3CD", "C03D",
#' "BP40257-1002", "1", "2791596", "CMATC4CD", "C03DA"
#' ~USUBJID, ~FAGRPID, ~FAREFID, ~FATESTCD, ~FASTRESC,
#' "BP40257-1001", "1", "1192056", "CMATC1CD", "N",
#' "BP40257-1001", "1", "1192056", "CMATC2CD", "N02",
#' "BP40257-1001", "1", "1192056", "CMATC3CD", "N02B",
#' "BP40257-1001", "1", "1192056", "CMATC4CD", "N02BE",
#' "BP40257-1001", "1", "2007001", "CMATC1CD", "D",
#' "BP40257-1001", "1", "2007001", "CMATC2CD", "D10",
#' "BP40257-1001", "1", "2007001", "CMATC3CD", "D10A",
#' "BP40257-1001", "1", "2007001", "CMATC4CD", "D10AA",
#' "BP40257-1001", "2", "2007001", "CMATC1CD", "D",
#' "BP40257-1001", "2", "2007001", "CMATC2CD", "D07",
#' "BP40257-1001", "2", "2007001", "CMATC3CD", "D07A",
#' "BP40257-1001", "2", "2007001", "CMATC4CD", "D07AA",
#' "BP40257-1001", "3", "2007001", "CMATC1CD", "H",
#' "BP40257-1001", "3", "2007001", "CMATC2CD", "H02",
#' "BP40257-1001", "3", "2007001", "CMATC3CD", "H02A",
#' "BP40257-1001", "3", "2007001", "CMATC4CD", "H02AB",
#' "BP40257-1002", "1", "2791596", "CMATC1CD", "C",
#' "BP40257-1002", "1", "2791596", "CMATC2CD", "C03",
#' "BP40257-1002", "1", "2791596", "CMATC3CD", "C03D",
#' "BP40257-1002", "1", "2791596", "CMATC4CD", "C03DA"
#' )
#'
#' cm %>%
Expand Down Expand Up @@ -226,39 +226,42 @@ derive_vars_transposed <- function(dataset,
#' library(tibble)
#'
#' cm <- tribble(
#' ~USUBJID, ~CMGRPID, ~CMREFID, ~CMDECOD,
#' "BP40257-1001", "14", "1192056", "PARACETAMOL",
#' "BP40257-1001", "18", "2007001", "SOLUMEDROL",
#' "BP40257-1002", "19", "2791596", "SPIRONOLACTONE"
#' ~STUDYID, ~USUBJID, ~CMGRPID, ~CMREFID, ~CMDECOD,
#' "STUDY01", "BP40257-1001", "14", "1192056", "PARACETAMOL",
#' "STUDY01", "BP40257-1001", "18", "2007001", "SOLUMEDROL",
#' "STUDY01", "BP40257-1002", "19", "2791596", "SPIRONOLACTONE"
#' )
#' facm <- tribble(
#' ~USUBJID, ~FAGRPID, ~FAREFID, ~FATESTCD, ~FASTRESC,
#' "BP40257-1001", "1", "1192056", "CMATC1CD", "N",
#' "BP40257-1001", "1", "1192056", "CMATC2CD", "N02",
#' "BP40257-1001", "1", "1192056", "CMATC3CD", "N02B",
#' "BP40257-1001", "1", "1192056", "CMATC4CD", "N02BE",
#' "BP40257-1001", "1", "2007001", "CMATC1CD", "D",
#' "BP40257-1001", "1", "2007001", "CMATC2CD", "D10",
#' "BP40257-1001", "1", "2007001", "CMATC3CD", "D10A",
#' "BP40257-1001", "1", "2007001", "CMATC4CD", "D10AA",
#' "BP40257-1001", "2", "2007001", "CMATC1CD", "D",
#' "BP40257-1001", "2", "2007001", "CMATC2CD", "D07",
#' "BP40257-1001", "2", "2007001", "CMATC3CD", "D07A",
#' "BP40257-1001", "2", "2007001", "CMATC4CD", "D07AA",
#' "BP40257-1001", "3", "2007001", "CMATC1CD", "H",
#' "BP40257-1001", "3", "2007001", "CMATC2CD", "H02",
#' "BP40257-1001", "3", "2007001", "CMATC3CD", "H02A",
#' "BP40257-1001", "3", "2007001", "CMATC4CD", "H02AB",
#' "BP40257-1002", "1", "2791596", "CMATC1CD", "C",
#' "BP40257-1002", "1", "2791596", "CMATC2CD", "C03",
#' "BP40257-1002", "1", "2791596", "CMATC3CD", "C03D",
#' "BP40257-1002", "1", "2791596", "CMATC4CD", "C03DA"
#' ~STUDYID, ~USUBJID, ~FAGRPID, ~FAREFID, ~FATESTCD, ~FASTRESC,
#' "STUDY01", "BP40257-1001", "1", "1192056", "CMATC1CD", "N",
#' "STUDY01", "BP40257-1001", "1", "1192056", "CMATC2CD", "N02",
#' "STUDY01", "BP40257-1001", "1", "1192056", "CMATC3CD", "N02B",
#' "STUDY01", "BP40257-1001", "1", "1192056", "CMATC4CD", "N02BE",
#' "STUDY01", "BP40257-1001", "1", "2007001", "CMATC1CD", "D",
#' "STUDY01", "BP40257-1001", "1", "2007001", "CMATC2CD", "D10",
#' "STUDY01", "BP40257-1001", "1", "2007001", "CMATC3CD", "D10A",
#' "STUDY01", "BP40257-1001", "1", "2007001", "CMATC4CD", "D10AA",
#' "STUDY01", "BP40257-1001", "2", "2007001", "CMATC1CD", "D",
#' "STUDY01", "BP40257-1001", "2", "2007001", "CMATC2CD", "D07",
#' "STUDY01", "BP40257-1001", "2", "2007001", "CMATC3CD", "D07A",
#' "STUDY01", "BP40257-1001", "2", "2007001", "CMATC4CD", "D07AA",
#' "STUDY01", "BP40257-1001", "3", "2007001", "CMATC1CD", "H",
#' "STUDY01", "BP40257-1001", "3", "2007001", "CMATC2CD", "H02",
#' "STUDY01", "BP40257-1001", "3", "2007001", "CMATC3CD", "H02A",
#' "STUDY01", "BP40257-1001", "3", "2007001", "CMATC4CD", "H02AB",
#' "STUDY01", "BP40257-1002", "1", "2791596", "CMATC1CD", "C",
#' "STUDY01", "BP40257-1002", "1", "2791596", "CMATC2CD", "C03",
#' "STUDY01", "BP40257-1002", "1", "2791596", "CMATC3CD", "C03D",
#' "STUDY01", "BP40257-1002", "1", "2791596", "CMATC4CD", "C03DA"
#' )
#'
#' derive_vars_atc(cm, facm)
derive_vars_atc <- function(dataset,
dataset_facm,
by_vars = exprs(USUBJID, CMREFID = FAREFID),
by_vars = exprs(
!!!get_admiral_option("subject_keys"),
CMREFID = FAREFID
),
id_vars = NULL,
value_var = FASTRESC) {
value_var <- assert_symbol(enexpr(value_var))
Expand Down
28 changes: 14 additions & 14 deletions man/create_single_dose_dataset.Rd

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

52 changes: 26 additions & 26 deletions man/derive_vars_atc.Rd

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

Loading

0 comments on commit 63902f3

Please sign in to comment.