From a66fc691d919bdfd941053722d8e0108c6c00320 Mon Sep 17 00:00:00 2001 From: remikk <32499319+remikk@users.noreply.github.com> Date: Mon, 30 Sep 2024 22:01:44 +0200 Subject: [PATCH] Update ad_advs.R The CHG and PCHG derivations were restricted to the post-baselines visits using restrict_derivation() with AVISITN > 0 condition as in the referenced #2484 in pharmaverse/admiral repository. --- inst/templates/ad_advs.R | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/inst/templates/ad_advs.R b/inst/templates/ad_advs.R index 154b6be..6de2f7a 100644 --- a/inst/templates/ad_advs.R +++ b/inst/templates/ad_advs.R @@ -455,10 +455,18 @@ advs <- advs %>% source_var = AVAL, new_var = BASE ) %>% - # Calculate CHG - derive_var_chg() %>% - # Calculate PCHG - derive_var_pchg() + # Calculate CHG for post-baseline records + # The decision on how to populate pre-baseline and baseline values of CHG is left to producer choice + restrict_derivation( + derivation = derive_var_chg, + filter = AVISITN > 0 + ) %>% + # Calculate PCHG for post-baseline records + # The decision on how to populate pre-baseline and baseline values of PCHG is left to producer choice + restrict_derivation( + derivation = derive_var_pchg, + filter = AVISITN > 0 + ) ## Calculate ONTRTFL ---- advs <- advs %>%