Skip to content

Commit

Permalink
Aligned tables and changed the STUDYID, USUBJID to get_admiral_option…
Browse files Browse the repository at this point in the history
…("subject_keys") for the bds_exposure vignette
  • Loading branch information
ProfessorP-beep committed Oct 30, 2024
1 parent 9694ee5 commit c389dd9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
10 changes: 6 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
- Replace use of `data("sdtm")` with `sdtm <- pharmaverse::sdtm` in templates and vignettes. (#2498)

## Updates of Existing Functions
- `derive_vars_atc()` and `create_single_dose_dataset()` `by_vars` argument updated to use `get_admiral_option("subject_keys")` instead of `USUBJID` or `STUDYID`.
- 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.
- `derive_extreme_event()` was fixed such that `check_type = "none"` is accepted
again. (#2462)



## Breaking Changes

Expand Down Expand Up @@ -50,6 +48,8 @@ again. (#2462)

# admiral 1.1.1
- `derive_locf_records()` documentation example was fixed to display LOCF records. (#2461)
- `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`.
- 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.

# admiral 1.1.0

Expand All @@ -61,6 +61,8 @@ again. (#2462)
- New `country_code_lookup()` metadata added to decode countries based on [ISO 3166 codes](https://www.iso.org/iso-3166-country-codes.html). (#2388)

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

- `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)

Expand Down
30 changes: 15 additions & 15 deletions tests/testthat/test-create_single_dose_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
## Test 1: Works as expected for Q*/EVERY * cases ----
test_that("create_single_dose_dataset Test 1: Works as expected for Q*/EVERY * cases", {
input <- tibble::tribble(
~STUDYID, ~USUBJID, ~EXDOSFRQ, ~ASTDT, ~AENDT,
"STUDY01", "P01", "Q2D", ymd("2021-01-01"), ymd("2021-01-07"),
"STUDY01", "P01", "Q3D", ymd("2021-01-08"), ymd("2021-01-14"),
~STUDYID, ~USUBJID, ~EXDOSFRQ, ~ASTDT, ~AENDT,
"STUDY01", "P01", "Q2D", ymd("2021-01-01"), ymd("2021-01-07"),
"STUDY01", "P01", "Q3D", ymd("2021-01-08"), ymd("2021-01-14"),
"STUDY01", "P01", "EVERY 2 WEEKS", ymd("2021-01-15"), ymd("2021-01-29"),
"STUDY01", "P02", "ONCE", ymd("2021-02-02"), ymd("2021-02-02")
"STUDY01", "P02", "ONCE", ymd("2021-02-02"), ymd("2021-02-02")
)
expected_output <- tibble::tribble(
~STUDYID, ~USUBJID, ~EXDOSFRQ, ~ASTDT, ~AENDT,
"STUDY01", "P01", "ONCE", ymd("2021-01-01"), ymd("2021-01-01"),
"STUDY01", "P01", "ONCE", ymd("2021-01-03"), ymd("2021-01-03"),
"STUDY01", "P01", "ONCE", ymd("2021-01-05"), ymd("2021-01-05"),
"STUDY01", "P01", "ONCE", ymd("2021-01-07"), ymd("2021-01-07"),
"STUDY01", "P01", "ONCE", ymd("2021-01-08"), ymd("2021-01-08"),
"STUDY01", "P01", "ONCE", ymd("2021-01-11"), ymd("2021-01-11"),
"STUDY01", "P01", "ONCE", ymd("2021-01-14"), ymd("2021-01-14"),
"STUDY01", "P01", "ONCE", ymd("2021-01-15"), ymd("2021-01-15"),
"STUDY01", "P01", "ONCE", ymd("2021-01-29"), ymd("2021-01-29"),
"STUDY01", "P02", "ONCE", ymd("2021-02-02"), ymd("2021-02-02")
~STUDYID, ~USUBJID, ~EXDOSFRQ, ~ASTDT, ~AENDT,
"STUDY01", "P01", "ONCE", ymd("2021-01-01"), ymd("2021-01-01"),
"STUDY01", "P01", "ONCE", ymd("2021-01-03"), ymd("2021-01-03"),
"STUDY01", "P01", "ONCE", ymd("2021-01-05"), ymd("2021-01-05"),
"STUDY01", "P01", "ONCE", ymd("2021-01-07"), ymd("2021-01-07"),
"STUDY01", "P01", "ONCE", ymd("2021-01-08"), ymd("2021-01-08"),
"STUDY01", "P01", "ONCE", ymd("2021-01-11"), ymd("2021-01-11"),
"STUDY01", "P01", "ONCE", ymd("2021-01-14"), ymd("2021-01-14"),
"STUDY01", "P01", "ONCE", ymd("2021-01-15"), ymd("2021-01-15"),
"STUDY01", "P01", "ONCE", ymd("2021-01-29"), ymd("2021-01-29"),
"STUDY01", "P02", "ONCE", ymd("2021-02-02"), ymd("2021-02-02")
)

expect_dfs_equal(
Expand Down
6 changes: 3 additions & 3 deletions vignettes/bds_exposure.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ adex <- derive_vars_merged(
ex,
dataset_add = adsl,
new_vars = adsl_vars,
by_vars = exprs(STUDYID, USUBJID)
by_vars = get_admiral_option("subject_keys")
)
```

Expand Down Expand Up @@ -581,7 +581,7 @@ example call is:
adex <- derive_var_obs_number(
adex,
new_var = ASEQ,
by_vars = exprs(STUDYID, USUBJID),
by_vars = get_admiral_option("subject_keys"),
order = exprs(PARCAT1, ASTDT, VISIT, VISITNUM, EXSEQ, PARAMN),
check_type = "error"
)
Expand All @@ -602,7 +602,7 @@ If needed, the other `ADSL` variables can now be added:
adex <- adex %>%
derive_vars_merged(
dataset_add = select(adsl, !!!negate_vars(adsl_vars)),
by_vars = exprs(STUDYID, USUBJID)
by_vars = get_admiral_option("subject_keys")
)
```
## Add Labels and Attributes {#attributes}
Expand Down

0 comments on commit c389dd9

Please sign in to comment.