From 8f72bb1e9b16f57f830484d55fd7fde821738ce7 Mon Sep 17 00:00:00 2001 From: Jeff Dickinson Date: Mon, 18 Nov 2024 13:45:32 -0600 Subject: [PATCH] Closes #2561 update ADEG template (#2565) * #2561 Update ADEG template flags * #2561 Doc: Update NEWS --- NEWS.md | 1 + inst/templates/ad_adeg.R | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 34c9a86e56..2dff9806c6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,7 @@ - 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) +- Update `ADEG` template to flag `ABLFL` and `ANL01FL` based on `DTYPE == "AVERAGE"` records. (#2561) ## Updates of Existing Functions diff --git a/inst/templates/ad_adeg.R b/inst/templates/ad_adeg.R index fe6f58914d..3be5b8bdc1 100644 --- a/inst/templates/ad_adeg.R +++ b/inst/templates/ad_adeg.R @@ -210,10 +210,7 @@ adeg <- adeg %>% # Calculate BASETYPE derive_basetype_records( basetypes = exprs( - "LAST: AFTER LYING DOWN FOR 5 MINUTES" = ATPTN == 815, - "LAST: AFTER STANDING FOR 1 MINUTE" = ATPTN == 816, - "LAST: AFTER STANDING FOR 3 MINUTES" = ATPTN == 817, - "LAST" = is.na(ATPTN) + "BASELINE DAY 1" = TRUE ) ) %>% # Calculate ABLFL @@ -226,7 +223,7 @@ adeg <- adeg %>% mode = "last" ), filter = ((!is.na(AVAL) | !is.na(AVALC)) & - ADT <= TRTSDT & !is.na(BASETYPE) & is.na(DTYPE) & + ADT <= TRTSDT & !is.na(BASETYPE) & DTYPE == "AVERAGE" & PARAMCD != "EGINTP" ) ) @@ -274,7 +271,7 @@ adeg <- adeg %>% new_var = ANL01FL, mode = "last" ), - filter = !is.na(AVISITN) & ONTRTFL == "Y" + filter = !is.na(AVISITN) & (ONTRTFL == "Y" | ABLFL == "Y") & DTYPE == "AVERAGE" ) ## Get treatment information ----