Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #2501-general-issue-make-subject-keys-flexible-in-all-functions #2516

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3ba3590
Updated the derive_vars and create_single_dose_dataset function by_va…
ProfessorP-beep Sep 28, 2024
d358fa0
Removed a duplicate of the admiral code within the admiral package I …
ProfessorP-beep Sep 29, 2024
ecd2500
I tried to address the failure in package building by changing bds_ex…
ProfessorP-beep Oct 1, 2024
d10123a
Merge branch 'main' of https://github.com/pharmaverse/admiral into 25…
ProfessorP-beep Oct 1, 2024
808f9de
ran lintr again, styler, and roxygen.
ProfessorP-beep Oct 1, 2024
e1ce1b6
test changes to derive_vars_atc
ProfessorP-beep Oct 1, 2024
c8922f3
changed derive_vars_atc by_vars to exprs(!!!get_admiral_option("subje…
ProfessorP-beep Oct 2, 2024
e908b48
Added STUDYID column to fix error with derive_vars_atc after correcti…
ProfessorP-beep Oct 2, 2024
6ff41a3
Ran devtools::test() and corrected errors that required a STUDYID col…
ProfessorP-beep Oct 2, 2024
fa79598
spellcheck and styler run
ProfessorP-beep Oct 2, 2024
9369763
spellcheck fix again
ProfessorP-beep Oct 2, 2024
9694ee5
moved updates under admiral development version in News.md
ProfessorP-beep Oct 3, 2024
c389dd9
Aligned tables and changed the STUDYID, USUBJID to get_admiral_option…
ProfessorP-beep Oct 30, 2024
ee9a029
ran styler on requested files from last push
ProfessorP-beep Oct 30, 2024
3c7922c
Merge branch 'main' into 2501-general-issue-make-subject-keys-flexibl…
bms63 Nov 12, 2024
c92ec8f
chore: #2501 NEWS.md
bms63 Nov 12, 2024
8b6ff37
chore: #2501 Update NEWS.md
bms63 Nov 12, 2024
85cf371
#2501 subject_keys: align tribble() calls
bundfussr Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading