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 #2109 ADPP template program has x and y variables #2110

Merged
merged 5 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
2 changes: 2 additions & 0 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ jobs:
check:
name: Check
uses: pharmaverse/admiralci/.github/workflows/r-cmd-check.yml@main
with:
error-on: warning # TODO: find a way to ignore specific notes
if: github.event_name == 'pull_request'
docs:
name: Documentation
Expand Down
13 changes: 13 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# admiral 1.0.0

## New Features

## Updates of Existing Functions

- Template `ad_adpp.R` updated to replace `left_join()` with `derive_vars_merged()` (#2109).

## Breaking Changes

## Documentation

## Various

# admiral 0.12.0

Expand Down
20 changes: 11 additions & 9 deletions inst/templates/ad_adpp.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ format_avalcat1n <- function(param, aval) {
# Get list of ADSL vars required for derivations
adsl_vars <- exprs(TRTSDT, TRTEDT, DTHDT, EOSDT, TRT01P, TRT01A)

adpp <- pp %>%
adpp_pp <- pp %>%
# Join ADSL with PP (need TRTSDT for ADY derivation)
left_join(
select(admiral_adsl, STUDYID, USUBJID, !!!adsl_vars),
by = c("STUDYID", "USUBJID")
derive_vars_merged(
dataset_add = admiral_adsl,
new_vars = adsl_vars,
by_vars = exprs(STUDYID, USUBJID)
) %>%
## Calculate ADT, ADY ----
derive_vars_dt(
Expand All @@ -93,7 +94,7 @@ adpp <- pp %>%
) %>%
derive_vars_dy(reference_date = TRTSDT, source_vars = exprs(ADT))

adpp <- adpp %>%
adpp_aval <- adpp_pp %>%
## Add PARAMCD only - add PARAM etc later ----
left_join(
select(param_lookup, PPTESTCD, PARAMCD),
Expand All @@ -117,7 +118,7 @@ adpp <- adpp %>%
## Get visit info ----
# See also the "Visit and Period Variables" vignette
# (https://pharmaverse.github.io/admiral/cran-release/articles/visits_periods.html#visit_bds)
adpp <- adpp %>%
adpp_avisit <- adpp_aval %>%
# Derive Timing
mutate(
VISIT = "", # /!\ To remove
Expand All @@ -141,9 +142,10 @@ adpp <- adpp %>%
derive_vars_merged(dataset_add = avalcat_lookup, by_vars = exprs(PARAMCD, AVALCA1N))

# Add all ADSL variables
adpp <- adpp %>%
left_join(admiral_adsl,
by = c("STUDYID", "USUBJID")
adpp <- adpp_avisit %>%
derive_vars_merged(
dataset_add = select(admiral_adsl, !!!negate_vars(adsl_vars)),
by_vars = exprs(STUDYID, USUBJID)
)

# Final Steps, Select final variables and Add labels
Expand Down