From c2f817ca0e8f1f1637293c37547245099eccc8f6 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Fri, 17 May 2024 08:58:50 -0400 Subject: [PATCH 01/14] Update staged_dependencies.yaml --- staged_dependencies.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staged_dependencies.yaml b/staged_dependencies.yaml index f1ed07fa..f47d2174 100644 --- a/staged_dependencies.yaml +++ b/staged_dependencies.yaml @@ -5,7 +5,7 @@ current_repo: upstream_repos: - repo: pharmaverse/admiral host: https://github.com - - repo: pharmaverse/admiral.test + - repo: pharmaverse/pharmaversesdtm host: https://github.com - repo: pharmaverse/admiraldev host: https://github.com From 76b0dd95c95dfb288eff63116f21ce3323310b9a Mon Sep 17 00:00:00 2001 From: Federico Baratin Date: Wed, 17 Jul 2024 14:39:37 +0200 Subject: [PATCH 02/14] Updated as per latest version + issue --- inst/templates/ad_adis.R | 185 +++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 103 deletions(-) diff --git a/inst/templates/ad_adis.R b/inst/templates/ad_adis.R index 8d5b32d3..e3bde0d5 100644 --- a/inst/templates/ad_adis.R +++ b/inst/templates/ad_adis.R @@ -4,17 +4,19 @@ # # Input: is, suppis, adsl library(admiral) +library(admiral.test) # Contains example datasets from the CDISC pilot project +library(metatools) library(dplyr) library(lubridate) +library(rlang) library(admiralvaccine) -library(pharmaversesdtm) library(metatools) # Load source datasets ---- -data("is_vaccine") -data("suppis_vaccine") -data("admiralvaccine_adsl") +data("vx_is") +data("vx_suppis") +data("vx_adsl") # When SAS datasets are imported into R using haven::read_sas(), missing # character values from SAS appear as "" characters in R, instead of appearing @@ -22,9 +24,9 @@ data("admiralvaccine_adsl") # https://pharmaverse.github.io/admiral/articles/admiral.html#handling-of-missing-values # nolint -is <- convert_blanks_to_na(is_vaccine) -suppis <- convert_blanks_to_na(suppis_vaccine) -adsl <- convert_blanks_to_na(admiralvaccine_adsl) +is <- convert_blanks_to_na(vx_is) +suppis <- convert_blanks_to_na(vx_suppis) +adsl <- convert_blanks_to_na(vx_adsl) # Derivations ---- @@ -35,7 +37,7 @@ is_suppis <- combine_supp(is, suppis) # STEP 2 - Visits and timing variables derivation. -adis_avisit <- is_suppis %>% +adis <- is_suppis %>% mutate( AVISITN = as.numeric(VISITNUM), AVISIT = case_when( @@ -44,11 +46,7 @@ adis_avisit <- is_suppis %>% VISITNUM == 30 ~ "Visit 3", VISITNUM == 40 ~ "Visit 4", is.na(VISITNUM) ~ NA_character_ - ) - ) - -adis_atpt <- adis_avisit %>% - mutate( + ), ATPTN = as.numeric(VISITNUM / 10), ATPT = case_when( VISITNUM == 10 ~ "Visit 1 (Day 1)", @@ -70,31 +68,29 @@ adis_atpt <- adis_avisit %>% # ADT derivation and Merge with ADSL to get RFSTDTC info in order to derive ADY # Add also PPROTFL from ADSL (to avoid additional merges) in order to derive # PPSRFL at step 11. -adis_adt <- derive_vars_dt( - dataset = adis_atpt, +adis <- derive_vars_dt( + dataset = adis, new_vars_prefix = "A", dtc = ISDTC, highest_imputation = "M", date_imputation = "mid", flag_imputation = "none" -) - -# ADY derivation -# Attach RFSTDTC from ADSL in order to derive ADY -adis_ady <- adis_adt %>% +) %>% derive_vars_merged( dataset_add = adsl, new_vars = exprs(RFSTDTC, PPROTFL), - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) %>% mutate( - RFSTDT = as.Date(RFSTDTC) + ADT = as.Date(ADT), + RFSTDTC = as.Date(RFSTDTC) ) %>% + # ADY derivation derive_vars_dy( - reference_date = RFSTDT, + reference_date = RFSTDTC, source_vars = exprs(ADT) - ) %>% - select(-RFSTDT) + ) + # STEP 4: PARAMCD, PARAM and PARAMN derivation @@ -104,39 +100,39 @@ adis_ady <- adis_adt %>% # Please, keep or modify PARAM values according to your purposes. # Put ISSEQ empty for derived records. -# If you would like to maintain traceability, please delete these part of the code. +# If you would like to maintain traciability, please delete these part of the code. -is_log <- adis_ady %>% +is_log <- adis %>% mutate( DERIVED = "LOG10", ISSEQ = NA_real_ ) -is_4fold <- adis_ady %>% +is_4fold <- adis %>% mutate( DERIVED = "4FOLD", ISSEQ = NA_real_ ) -is_log_4fold <- adis_ady %>% +is_log_4fold <- adis %>% mutate( DERIVED = "LOG10 4FOLD", ISSEQ = NA_real_ ) -adis_der <- bind_rows(adis_ady, is_log, is_4fold, is_log_4fold) %>% +adis <- bind_rows(adis, is_log, is_4fold, is_log_4fold) %>% arrange(STUDYID, USUBJID, !is.na(DERIVED), ISSEQ) %>% mutate(DERIVED = if_else(is.na(DERIVED), "ORIG", DERIVED)) -adis_paramcd <- adis_der %>% +adis <- adis %>% mutate( # PARAMCD: for log values, concatenation of L and ISTESTCD. PARAMCD = case_when( DERIVED == "ORIG" ~ ISTESTCD, DERIVED == "LOG10" ~ paste0(ISTESTCD, "L"), DERIVED == "4FOLD" ~ paste0(ISTESTCD, "F"), - # As per CDISC rule, PARAMCD should be 8 charcaters long. Please, adapt if needed + # As per CDISC rule, PARAMCD should be 8 characters long. Please, adapt if needed DERIVED == "LOG10 4FOLD" ~ paste0(substr(ISTESTCD, 1, 6), "LF") ) ) @@ -163,16 +159,15 @@ param_lookup <- tribble( "R0003MLF", "LOG10 4FOLD (R0003MA Antibody)", 34 ) -adis_param_paramn <- derive_vars_merged_lookup( - dataset = adis_paramcd, +adis <- derive_vars_merged_lookup( + dataset = adis, dataset_add = param_lookup, new_vars = exprs(PARAM, PARAMN), by_vars = exprs(PARAMCD) ) - # STEP 5: PARCAT1 and CUTOFF0x derivations. -adis_parcat1_cutoff <- adis_param_paramn %>% +adis <- adis %>% mutate( PARCAT1 = ISCAT, # Please, define your additional cutoff values. Delete if not needed. @@ -183,7 +178,7 @@ adis_parcat1_cutoff <- adis_param_paramn %>% # STEP 6: AVAL, AVALU, DTYPE and SERCAT1/N derivation # AVAL derivation -adis_or <- adis_parcat1_cutoff %>% +adis_or <- adis %>% filter(DERIVED == "ORIG") %>% derive_var_aval_adis( lower_rule = ISLLOQ / 2, @@ -192,7 +187,7 @@ adis_or <- adis_parcat1_cutoff %>% round = 2 ) -adis_log_or <- adis_parcat1_cutoff %>% +adis_log_or <- adis %>% filter(DERIVED == "LOG10") %>% derive_var_aval_adis( lower_rule = log10(ISLLOQ / 2), @@ -201,7 +196,7 @@ adis_log_or <- adis_parcat1_cutoff %>% round = 2 ) -adis_4fold <- adis_parcat1_cutoff %>% +adis_4fold <- adis %>% filter(DERIVED == "4FOLD") %>% derive_var_aval_adis( lower_rule = ISLLOQ, @@ -210,7 +205,7 @@ adis_4fold <- adis_parcat1_cutoff %>% round = 2 ) -adis_log_4fold <- adis_parcat1_cutoff %>% +adis_log_4fold <- adis %>% filter(DERIVED == "LOG10 4FOLD") %>% derive_var_aval_adis( lower_rule = log10(ISLLOQ), @@ -219,7 +214,7 @@ adis_log_4fold <- adis_parcat1_cutoff %>% round = 2 ) -adis_aval_sercat1 <- bind_rows(adis_or, adis_log_or, adis_4fold, adis_log_4fold) %>% +adis <- bind_rows(adis_or, adis_log_or, adis_4fold, adis_log_4fold) %>% mutate( # AVALU derivation (please delete if not needed for your study) AVALU = ISSTRESU, @@ -242,8 +237,8 @@ param_lookup2 <- tribble( NA_character_, NA_real_ ) -adis_sercat1n <- derive_vars_merged_lookup( - dataset = adis_aval_sercat1, +adis <- derive_vars_merged_lookup( + dataset = adis, dataset_add = param_lookup2, new_vars = exprs(SERCAT1N), by_vars = exprs(SERCAT1) @@ -253,8 +248,8 @@ adis_sercat1n <- derive_vars_merged_lookup( # DTYPE derivation. # Please update code when <,<=,>,>= are present in your lab results (in ISSTRESC) -if (any(names(adis_sercat1n) == "ISULOQ") == TRUE) { - adis_dtype <- adis_sercat1n %>% +if (any(names(adis) == "ISULOQ") == TRUE) { + adis <- adis %>% mutate(DTYPE = case_when( DERIVED %in% c("ORIG", "LOG10") & !is.na(ISLLOQ) & ((ISSTRESN < ISLLOQ) | grepl("<", ISORRES)) ~ "HALFLLOQ", @@ -264,8 +259,8 @@ if (any(names(adis_sercat1n) == "ISULOQ") == TRUE) { )) } -if (any(names(adis_sercat1n) == "ISULOQ") == FALSE) { - adis_dtype <- adis_sercat1n %>% +if (any(names(adis) == "ISULOQ") == FALSE) { + adis <- adis %>% mutate(DTYPE = case_when( DERIVED %in% c("ORIG", "LOG10") & !is.na(ISLLOQ) & ((ISSTRESN < ISLLOQ) | grepl("<", ISORRES)) ~ "HALFLLOQ", @@ -274,26 +269,10 @@ if (any(names(adis_sercat1n) == "ISULOQ") == FALSE) { } -# STEP 7: BASE variables and ABLFL derivation -# BASETYPE derivation -adis_basetype <- derive_basetype_records( - adis_dtype, - basetypes = exprs("VISIT 1" = AVISITN %in% c(10, 30)) -) - -# BASE derivation -adis_base <- derive_var_base( - adis_basetype, - by_vars = exprs(STUDYID, USUBJID, PARAMN), - source_var = AVAL, - new_var = BASE, - filter = VISITNUM == 10 -) - - +# STEP 7: ABLFL and BASE variables derivation # ABLFL derivation -adis_ablfl <- restrict_derivation( - adis_base, +adis <- restrict_derivation( + adis, derivation = derive_var_extreme_flag, args = params( by_vars = exprs(STUDYID, USUBJID, PARAMN), @@ -301,13 +280,24 @@ adis_ablfl <- restrict_derivation( new_var = ABLFL, mode = "first" ), - filter = VISITNUM == 10 & !is.na(BASE) + filter = VISITNUM == 10 ) %>% - arrange(STUDYID, USUBJID, !is.na(DERIVED), VISITNUM, PARAMN) + # BASE derivation + derive_var_base( + by_vars = exprs(STUDYID, USUBJID, PARAMN), + source_var = AVAL, + new_var = BASE, + filter = ABLFL == "Y" + ) %>% + # BASETYPE derivation + derive_basetype_records( + basetypes = exprs("VISIT 1" = AVISITN %in% c(10, 30)) + ) %>% + arrange(STUDYID, USUBJID, !is.na(DERIVED), ISSEQ) # BASECAT derivation -adis_basecat <- adis_ablfl %>% +adis <- adis %>% mutate( BASECAT1 = case_when( !grepl("L", PARAMCD) & BASE < 10 ~ "Titer value < 1:10", @@ -319,28 +309,24 @@ adis_basecat <- adis_ablfl %>% # STEP 8 Derivation of Change from baseline and Ratio to baseline ---- -adis_chg <- restrict_derivation( - adis_basecat, +adis <- restrict_derivation(adis, derivation = derive_var_chg, filter = AVISITN > 10 -) - -adis_r2b <- restrict_derivation( - adis_chg, - derivation = derive_var_analysis_ratio, - args = params( - numer_var = AVAL, - denom_var = BASE - ), - filter = AVISITN > 10 ) %>% - arrange(STUDYID, USUBJID, DERIVED, ISSEQ) %>% - select(-DERIVED) + restrict_derivation( + derivation = derive_var_analysis_ratio, + args = params( + numer_var = AVAL, + denom_var = BASE + ), + filter = AVISITN > 10 + ) %>% + arrange(STUDYID, USUBJID, DERIVED, ISSEQ) # STEP 9 Derivation of CRITyFL and CRITyFN ---- -adis_crit <- derive_vars_crit( - dataset = adis_r2b, +adis <- derive_vars_crit( + dataset = adis, prefix = "CRIT1", crit_label = "Titer >= ISLLOQ", condition = !is.na(AVAL) & !is.na(ISLLOQ), @@ -354,39 +340,32 @@ period_ref <- create_period_dataset( new_vars = exprs(APERSDT = APxxSDT, APEREDT = APxxEDT, TRTA = TRTxxA, TRTP = TRTxxP) ) -adis_trt <- derive_vars_joined( - adis_crit, +adis <- derive_vars_joined( + adis, dataset_add = period_ref, - by_vars = exprs(STUDYID, USUBJID), + by_vars = get_admiral_option("subject_keys"), filter_join = ADT >= APERSDT & ADT <= APEREDT, join_type = "all" ) + # STEP 11 Derivation of PPSRFL ---- -adis_ppsrfl <- adis_trt %>% +adis <- adis %>% mutate(PPSRFL = if_else(VISITNUM %in% c(10, 30) & PPROTFL == "Y", "Y", NA_character_)) # STEP 12 Merge with ADSL ---- # Get list of ADSL variables not to be added to ADIS -adsl_vars <- exprs(RFSTDTC, PPROTFL) +vx_adsl_vars <- exprs(RFSTDTC, PPROTFL) adis <- derive_vars_merged( - dataset = adis_ppsrfl, - dataset_add = select(admiralvaccine_adsl, !!!negate_vars(adsl_vars)), - by_vars = exprs(STUDYID, USUBJID) + dataset = adis, + dataset_add = select(vx_adsl, !!!negate_vars(vx_adsl_vars)), + by_vars = get_admiral_option("subject_keys") ) -admiralvaccine_adis <- adis - # Save output ---- - -dir <- tools::R_user_dir("admiralvaccine_templates_data", which = "cache") -# Change to whichever directory you want to save the dataset in -if (!file.exists(dir)) { - # Create the folder - dir.create(dir, recursive = TRUE, showWarnings = FALSE) -} -save(admiralvaccine_adis, file = file.path(dir, "adis.rda"), compress = "bzip2") +dir <- tempdir() # Change to whichever directory you want to save the dataset in +saveRDS(adis, file = file.path(dir, "adis.rda"), compress = "bzip2") From 8a3632e41ceb5023c0fd90ad0ce8e5ce13acca30 Mon Sep 17 00:00:00 2001 From: Federico Baratin Date: Wed, 17 Jul 2024 14:53:50 +0200 Subject: [PATCH 03/14] Updates as per ADIS template + issue 240 --- vignettes/adis.Rmd | 202 ++++++++++++++++++++++----------------------- 1 file changed, 98 insertions(+), 104 deletions(-) diff --git a/vignettes/adis.Rmd b/vignettes/adis.Rmd index c568b655..7bfcd1f7 100644 --- a/vignettes/adis.Rmd +++ b/vignettes/adis.Rmd @@ -87,14 +87,14 @@ library(pharmaversesdtm) library(metatools) # Load source datasets -data("is_vaccine") -data("suppis_vaccine") -data("admiralvaccine_adsl") +data("vx_is") +data("vx_suppis") +data("vx_adsl") # Convert blanks into NA -is <- convert_blanks_to_na(is_vaccine) -suppis <- convert_blanks_to_na(suppis_vaccine) -adsl <- convert_blanks_to_na(admiralvaccine_adsl) +is <- convert_blanks_to_na(vx_is) +suppis <- convert_blanks_to_na(vx_suppis) +adsl <- convert_blanks_to_na(vx_adsl) ``` @@ -111,7 +111,7 @@ Derive `AVISIT`, `AVISITN`, `ATPT`, `ATPTN` and `ATPTREF` variables. Please, update visit records according to your Study Design/Protocol. For the visit values, please refers to your ADAM SPECIFICATIONS. ```{r eval=TRUE} -adis_avisit <- is_suppis %>% +adis <- is_suppis %>% mutate( AVISITN = as.numeric(VISITNUM), AVISIT = case_when( @@ -120,11 +120,7 @@ adis_avisit <- is_suppis %>% VISITNUM == 30 ~ "Visit 3", VISITNUM == 40 ~ "Visit 4", is.na(VISITNUM) ~ NA_character_ - ) - ) - -adis_atpt <- adis_avisit %>% - mutate( + ), ATPTN = as.numeric(VISITNUM / 10), ATPT = case_when( VISITNUM == 10 ~ "Visit 1 (Day 1)", @@ -143,7 +139,7 @@ adis_atpt <- adis_avisit %>% ```{r, echo=FALSE} dataset_vignette( - adis_atpt, + adis, display_vars = exprs(USUBJID, VISITNUM, ISTEST, ISORRES, AVISIT, AVISITN, ATPT, ATPTN, ATPTREF) ) ``` @@ -166,36 +162,33 @@ If your derivation is different, please adapt. # ADT derivation # Add also PPROTFL from ADSL (to avoid additional merges) in order to derive # PPSRFL at step 11. -adis_adt <- derive_vars_dt( - dataset = adis_atpt, +adis <- derive_vars_dt( + dataset = adis, new_vars_prefix = "A", dtc = ISDTC, highest_imputation = "M", date_imputation = "mid", flag_imputation = "none" -) - -# ADY derivation -# Attach RFSTDTC from ADSL in order to derive ADY -adis_ady <- adis_adt %>% +) %>% derive_vars_merged( dataset_add = adsl, new_vars = exprs(RFSTDTC, PPROTFL), - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) %>% mutate( - RFSTDT = as.Date(RFSTDTC) + ADT = as.Date(ADT), + RFSTDTC = as.Date(RFSTDTC) ) %>% + # ADY derivation derive_vars_dy( - reference_date = RFSTDT, + reference_date = RFSTDTC, source_vars = exprs(ADT) - ) %>% - select(-RFSTDT) + ) ``` ```{r, echo=FALSE} dataset_vignette( - adis_ady, + adis, display_vars = exprs(USUBJID, VISITNUM, ISTEST, ISORRES, ISDTC, RFSTDTC, ADT, ADY, PPROTFL) ) ``` @@ -214,28 +207,37 @@ Please, add or remove datasets according to your study needs. # Add also records related to 4fold. # Please, keep or modify PARAM values according to your purposes. -is_log <- adis_ady %>% - mutate(DERIVED = "LOG10") +is_log <- adis %>% + mutate( + DERIVED = "LOG10", + ISSEQ = NA_real_ + ) -is_4fold <- adis_ady %>% - mutate(DERIVED = "4FOLD") +is_4fold <- adis %>% + mutate( + DERIVED = "4FOLD", + ISSEQ = NA_real_ + ) -is_log_4fold <- adis_ady %>% - mutate(DERIVED = "LOG10 4FOLD") +is_log_4fold <- adis %>% + mutate( + DERIVED = "LOG10 4FOLD", + ISSEQ = NA_real_ + ) -adis_der <- bind_rows(adis_ady, is_log, is_4fold, is_log_4fold) %>% - arrange(STUDYID, USUBJID, VISITNUM, ISSEQ, !is.na(DERIVED)) %>% +adis <- bind_rows(adis, is_log, is_4fold, is_log_4fold) %>% + arrange(STUDYID, USUBJID, !is.na(DERIVED), ISSEQ) %>% mutate(DERIVED = if_else(is.na(DERIVED), "ORIG", DERIVED)) -adis_paramcd <- adis_der %>% +adis <- adis %>% mutate( # PARAMCD: for log values, concatenation of L and ISTESTCD. PARAMCD = case_when( DERIVED == "ORIG" ~ ISTESTCD, DERIVED == "LOG10" ~ paste0(ISTESTCD, "L"), DERIVED == "4FOLD" ~ paste0(ISTESTCD, "F"), - # As per CDISC rule, PARAMCD should be 8 charcaters long. Please, adapt if needed + # As per CDISC rule, PARAMCD should be 8 characters long. Please, adapt if needed DERIVED == "LOG10 4FOLD" ~ paste0(substr(ISTESTCD, 1, 6), "LF") ) ) @@ -262,8 +264,8 @@ param_lookup <- tribble( "R0003MLF", "LOG10 4FOLD (R0003MA Antibody)", 34 ) -adis_param_paramn <- derive_vars_merged_lookup( - dataset = adis_paramcd, +adis <- derive_vars_merged_lookup( + dataset = adis, dataset_add = param_lookup, new_vars = exprs(PARAM, PARAMN), by_vars = exprs(PARAMCD) @@ -272,7 +274,7 @@ adis_param_paramn <- derive_vars_merged_lookup( ```{r, echo=FALSE} dataset_vignette( - adis_param_paramn, + adis, display_vars = exprs(USUBJID, VISITNUM, ISTEST, ISORRES, PARAMCD, PARAM, PARAMN) ) ``` @@ -283,7 +285,7 @@ Derive `PARCAT1` and `CUTOFF`x variables. Fake values has been put for `CUTOFF` values. Please, adapt base on your objectives. ```{r eval=TRUE} -adis_parcat1_cutoff <- adis_param_paramn %>% +adis <- adis %>% mutate( PARCAT1 = ISCAT, # Please, define your additional cutoff values. Delete if not needed. @@ -294,7 +296,7 @@ adis_parcat1_cutoff <- adis_param_paramn %>% ```{r, echo=FALSE} dataset_vignette( - adis_parcat1_cutoff, + adis, display_vars = exprs(USUBJID, VISITNUM, ISTEST, ISORRES, PARCAT1, CUTOFF02, CUTOFF03) ) ``` @@ -333,7 +335,7 @@ Later you can find `SERCAT1/N` and `DTYPE` derivations. result is below Lower Limit of Quantitation. ```{r eval=TRUE} -adis_or <- adis_parcat1_cutoff %>% +adis_or <- adis %>% filter(DERIVED == "ORIG") %>% derive_var_aval_adis( lower_rule = ISLLOQ / 2, @@ -342,7 +344,7 @@ adis_or <- adis_parcat1_cutoff %>% round = 2 ) -adis_log_or <- adis_parcat1_cutoff %>% +adis_log_or <- adis %>% filter(DERIVED == "LOG10") %>% derive_var_aval_adis( lower_rule = log10(ISLLOQ / 2), @@ -351,7 +353,7 @@ adis_log_or <- adis_parcat1_cutoff %>% round = 2 ) -adis_4fold <- adis_parcat1_cutoff %>% +adis_4fold <- adis %>% filter(DERIVED == "4FOLD") %>% derive_var_aval_adis( lower_rule = ISLLOQ, @@ -360,7 +362,7 @@ adis_4fold <- adis_parcat1_cutoff %>% round = 2 ) -adis_log_4fold <- adis_parcat1_cutoff %>% +adis_log_4fold <- adis %>% filter(DERIVED == "LOG10 4FOLD") %>% derive_var_aval_adis( lower_rule = log10(ISLLOQ), @@ -369,8 +371,9 @@ adis_log_4fold <- adis_parcat1_cutoff %>% round = 2 ) -adis_aval_sercat1 <- bind_rows(adis_or, adis_log_or, adis_4fold, adis_log_4fold) %>% - mutate( # AVALU derivation (please delete if not needed for your study) +adis <- bind_rows(adis_or, adis_log_or, adis_4fold, adis_log_4fold) %>% + mutate( + # AVALU derivation (please delete if not needed for your study) AVALU = ISSTRESU, # SERCAT1 derivation @@ -391,8 +394,8 @@ param_lookup2 <- tribble( NA_character_, NA_real_ ) -adis_sercat1n <- derive_vars_merged_lookup( - dataset = adis_aval_sercat1, +adis <- derive_vars_merged_lookup( + dataset = adis, dataset_add = param_lookup2, new_vars = exprs(SERCAT1N), by_vars = exprs(SERCAT1) @@ -402,8 +405,8 @@ adis_sercat1n <- derive_vars_merged_lookup( # DTYPE derivation. # Please update code when <,<=,>,>= are present in your lab results (in ISSTRESC) -if (any(names(adis_sercat1n) == "ISULOQ") == TRUE) { - adis_dtype <- adis_sercat1n %>% +if (any(names(adis) == "ISULOQ") == TRUE) { + adis <- adis %>% mutate(DTYPE = case_when( DERIVED %in% c("ORIG", "LOG10") & !is.na(ISLLOQ) & ((ISSTRESN < ISLLOQ) | grepl("<", ISORRES)) ~ "HALFLLOQ", @@ -413,8 +416,8 @@ if (any(names(adis_sercat1n) == "ISULOQ") == TRUE) { )) } -if (any(names(adis_sercat1n) == "ISULOQ") == FALSE) { - adis_dtype <- adis_sercat1n %>% +if (any(names(adis) == "ISULOQ") == FALSE) { + adis <- adis %>% mutate(DTYPE = case_when( DERIVED %in% c("ORIG", "LOG10") & !is.na(ISLLOQ) & ((ISSTRESN < ISLLOQ) | grepl("<", ISORRES)) ~ "HALFLLOQ", @@ -425,7 +428,7 @@ if (any(names(adis_sercat1n) == "ISULOQ") == FALSE) { ```{r, echo=FALSE} dataset_vignette( - adis_dtype, + adis, display_vars = exprs(USUBJID, VISITNUM, ISTEST, ISORRES, AVAL, AVALU, DTYPE, SERCAT1, SERCAT1N) ) ``` @@ -437,25 +440,9 @@ Derive Baseline values for each Subject/Visit and relative flag, `ABLFL`. In a later stage, derive `BASECAT` variable, which represents the base category. Update accordingly. ```{r eval=TRUE} -# BASETYPE derivation -adis_basetype <- derive_basetype_records( - adis_dtype, - basetypes = exprs("VISIT 1" = AVISITN %in% c(10, 30)) -) - -# BASE derivation -adis_base <- derive_var_base( - adis_basetype, - by_vars = exprs(STUDYID, USUBJID, PARAMN), - source_var = AVAL, - new_var = BASE, - filter = VISITNUM == 10 -) - - # ABLFL derivation -adis_ablfl <- restrict_derivation( - adis_base, +adis <- restrict_derivation( + adis, derivation = derive_var_extreme_flag, args = params( by_vars = exprs(STUDYID, USUBJID, PARAMN), @@ -463,13 +450,24 @@ adis_ablfl <- restrict_derivation( new_var = ABLFL, mode = "first" ), - filter = VISITNUM == 10 & !is.na(BASE) + filter = VISITNUM == 10 ) %>% - arrange(STUDYID, USUBJID, !is.na(DERIVED), VISITNUM, PARAMN) + # BASE derivation + derive_var_base( + by_vars = exprs(STUDYID, USUBJID, PARAMN), + source_var = AVAL, + new_var = BASE, + filter = ABLFL == "Y" + ) %>% + # BASETYPE derivation + derive_basetype_records( + basetypes = exprs("VISIT 1" = AVISITN %in% c(10, 30)) + ) %>% + arrange(STUDYID, USUBJID, !is.na(DERIVED), ISSEQ) # BASECAT derivation -adis_basecat <- adis_ablfl %>% +adis <- adis %>% mutate( BASECAT1 = case_when( !grepl("L", PARAMCD) & BASE < 10 ~ "Titer value < 1:10", @@ -482,7 +480,7 @@ adis_basecat <- adis_ablfl %>% ```{r, echo=FALSE} dataset_vignette( - adis_basecat, + adis, display_vars = exprs(USUBJID, VISITNUM, ISTEST, ISORRES, ABLFL, BASE, BASETYPE, BASECAT1) ) ``` @@ -493,28 +491,24 @@ Derive change from baseline values. Derive ratio to base values. ```{r eval=TRUE} -adis_chg <- restrict_derivation( - adis_basecat, +adis <- restrict_derivation(adis, derivation = derive_var_chg, filter = AVISITN > 10 -) - -adis_r2b <- restrict_derivation( - adis_chg, - derivation = derive_var_analysis_ratio, - args = params( - numer_var = AVAL, - denom_var = BASE - ), - filter = AVISITN > 10 ) %>% - arrange(STUDYID, USUBJID, DERIVED, ISSEQ) %>% - select(-DERIVED) + restrict_derivation( + derivation = derive_var_analysis_ratio, + args = params( + numer_var = AVAL, + denom_var = BASE + ), + filter = AVISITN > 10 + ) %>% + arrange(STUDYID, USUBJID, DERIVED, ISSEQ) ``` ```{r, echo=FALSE} dataset_vignette( - adis_r2b, + adis, display_vars = exprs(USUBJID, VISITNUM, ISTEST, ISORRES, CHG, R2BASE) ) ``` @@ -531,8 +525,8 @@ The function returns a relative numeric `CRIT1FN` variable (`1` or `0` if the criterion is met, respectively) and a label `CRIT1` variable (with the text specified in label_var argument). ```{r eval=TRUE} -adis_crit <- derive_vars_crit( - dataset = adis_r2b, +adis <- derive_vars_crit( + dataset = adis, prefix = "CRIT1", crit_label = "Titer >= ISLLOQ", condition = !is.na(AVAL) & !is.na(ISLLOQ), @@ -542,7 +536,7 @@ adis_crit <- derive_vars_crit( ```{r, echo=FALSE} dataset_vignette( - adis_crit, + adis, display_vars = exprs(USUBJID, VISITNUM, ISTEST, ISORRES, CRIT1, CRIT1FL, CRIT1FN) ) ``` @@ -555,10 +549,10 @@ period_ref <- create_period_dataset( new_vars = exprs(APERSDT = APxxSDT, APEREDT = APxxEDT, TRTA = TRTxxA, TRTP = TRTxxP) ) -adis_trt <- derive_vars_joined( - adis_crit, +adis <- derive_vars_joined( + adis, dataset_add = period_ref, - by_vars = exprs(STUDYID, USUBJID), + by_vars = get_admiral_option("subject_keys"), filter_join = ADT >= APERSDT & ADT <= APEREDT, join_type = "all" ) @@ -566,7 +560,7 @@ adis_trt <- derive_vars_joined( ```{r, echo=FALSE} dataset_vignette( - adis_trt, + adis, display_vars = exprs(USUBJID, VISITNUM, ISTEST, ISORRES, TRTP, TRTA) ) ``` @@ -578,13 +572,13 @@ PPS related objectives. This step could change according to your study needs. ```{r eval=TRUE} -adis_ppsrfl <- adis_trt %>% +adis <- adis %>% mutate(PPSRFL = if_else(VISITNUM %in% c(10, 30) & PPROTFL == "Y", "Y", NA_character_)) ``` ```{r, echo=FALSE} dataset_vignette( - adis_ppsrfl, + adis, display_vars = exprs(USUBJID, VISITNUM, ISTEST, ISORRES, TRTP, TRTA) ) ``` @@ -596,12 +590,12 @@ Attach all `ADAM.ADSL` variables to the is build-in dataset. If you may need to keep only a subset of them, please update accordingly. ```{r eval=TRUE} # Get list of ADSL variables not to be added to ADIS -adsl_vars <- exprs(RFSTDTC, PPROTFL) +vx_adsl_vars <- exprs(RFSTDTC, PPROTFL) adis <- derive_vars_merged( - dataset = adis_ppsrfl, - dataset_add = select(admiralvaccine_adsl, !!!negate_vars(adsl_vars)), - by_vars = exprs(STUDYID, USUBJID) + dataset = adis, + dataset_add = select(vx_adsl, !!!negate_vars(vx_adsl_vars)), + by_vars = get_admiral_option("subject_keys") ) ``` From f263022b84966a3ad96e023adede601ede84019a Mon Sep 17 00:00:00 2001 From: Federico Baratin Date: Wed, 17 Jul 2024 15:02:22 +0200 Subject: [PATCH 04/14] Updated code as per issue 240 --- inst/templates/ad_adce.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inst/templates/ad_adce.R b/inst/templates/ad_adce.R index 0a2d78ae..164192b2 100644 --- a/inst/templates/ad_adce.R +++ b/inst/templates/ad_adce.R @@ -56,7 +56,7 @@ adce02 <- adce01 %>% derive_vars_merged( dataset_add = adsl, new_vars = adsl_vars, - by = exprs(STUDYID, USUBJID) + by = get_admiral_option("subject_keys") ) %>% ## Derive analysis start time ## Proposed imputations depending on situation: no needed -> highest imputation = ā€œnā€ @@ -84,7 +84,7 @@ adce03 <- derive_vars_joined( adce02, dataset_add = adperiods, - by_vars = exprs(STUDYID, USUBJID), + by_vars = get_admiral_option("subject_keys"), filter_join = ASTDT >= APERSDT & ASTDT <= APEREDT, join_type = "all" ) %>% @@ -121,7 +121,7 @@ adce05 <- adce04 %>% ## Derive ASEQ derive_var_obs_number( new_var = ASEQ, - by_vars = exprs(STUDYID, USUBJID), + by_vars = get_admiral_option("subject_keys"), order = exprs(CEDECOD, CELAT, CETPTREF, APERIOD), check_type = "error" ) %>% @@ -146,7 +146,7 @@ adsl_list <- adsl %>% adce <- adce05 %>% derive_vars_merged( dataset_add = adsl_list, - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) From a91f51da3fcbe1c5fbeeb4791f4741b5f9058540 Mon Sep 17 00:00:00 2001 From: Federico Baratin Date: Wed, 17 Jul 2024 15:05:04 +0200 Subject: [PATCH 05/14] Updated as per issue 240. --- inst/templates/ad_adface.R | 8 ++++---- inst/templates/ad_adsl.R | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/inst/templates/ad_adface.R b/inst/templates/ad_adface.R index 63e23699..8d476a26 100644 --- a/inst/templates/ad_adface.R +++ b/inst/templates/ad_adface.R @@ -73,7 +73,7 @@ adface <- derive_vars_merged_vaccine( derive_vars_merged( dataset_add = adsl, new_vars = adsl_vars, - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) %>% # Step 4 - Deriving Fever OCCUR records from VS if FAOBJ = "FEVER" records not present in FACE derive_fever_records( @@ -103,7 +103,7 @@ period_ref <- create_period_dataset( adface <- derive_vars_joined( adface, dataset_add = period_ref, - by_vars = exprs(STUDYID, USUBJID), + by_vars = get_admiral_option("subject_keys"), filter_join = ADT >= APERSDT & ADT <= APEREDT, join_type = "all" ) %>% @@ -208,7 +208,7 @@ lookup_dataset <- tribble( "MAXDIAM", "MDISW", 29, "Maximum Diameter", "SWELLING", "MAXSEV", "MAXSPIS", 30, "Maximum Severity", "PAIN AT INJECTION SITE", "OCCUR", "OCCVOM", 31, "Occurrence Indicator", "VOMITING", - "DIAMETER", "DIASWEL", 32, "Diameter", "SWELLING", + "DIAMETER", "DIASWEL", 32, "Diameter", "SWELLING" ) adface <- derive_vars_params( @@ -237,7 +237,7 @@ adsl <- adsl %>% adface <- derive_vars_merged( dataset = adface, dataset_add = select(adsl, !!!negate_vars(adsl_vars)), - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) %>% # Step 16 post processing post_process_reacto( diff --git a/inst/templates/ad_adsl.R b/inst/templates/ad_adsl.R index e067e7d1..dd566720 100644 --- a/inst/templates/ad_adsl.R +++ b/inst/templates/ad_adsl.R @@ -87,13 +87,13 @@ adsl <- dm %>% dataset_add = ex, filter_add = EXLNKGRP == "VACCINATION 1", new_vars = exprs(TRT01A = EXTRT), - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) %>% derive_vars_merged( dataset_add = ex, filter_add = EXLNKGRP == "VACCINATION 2", new_vars = exprs(TRT02A = EXTRT), - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) %>% ## derive treatment start date (TRTSDTM) ---- derive_vars_merged( @@ -105,7 +105,7 @@ adsl <- dm %>% new_vars = exprs(TRTSDTM = EXSTDTM), order = exprs(EXSTDTM, EXSEQ), mode = "first", - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) %>% ## derive treatment end date (TRTEDTM) ---- derive_vars_merged( @@ -116,7 +116,7 @@ adsl <- dm %>% new_vars = exprs(TRTEDTM = EXENDTM), order = exprs(EXENDTM, EXSEQ), mode = "last", - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) %>% ## Derive treatment end/start date TRTSDT/TRTEDT ---- derive_vars_dtm_to_dt(source_vars = exprs(TRTSDTM, TRTEDTM)) @@ -124,7 +124,7 @@ adsl <- dm %>% adsl <- derive_var_merged_exist_flag( dataset = adsl, dataset_add = ex, - by_vars = exprs(STUDYID, USUBJID), + by_vars = get_admiral_option("subject_keys"), new_var = SAFFL, condition = (EXDOSE > 0 | (EXDOSE == 0 & str_detect(EXTRT, "VACCINE"))) ) %>% From 414f9fb2e40e04633d6bfba3590723186428d703 Mon Sep 17 00:00:00 2001 From: Federico Baratin Date: Wed, 17 Jul 2024 15:08:59 +0200 Subject: [PATCH 06/14] Updated as per issue 240. --- vignettes/adce.Rmd | 8 ++++---- vignettes/adface.Rmd | 8 ++++---- vignettes/adsl.Rmd | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/vignettes/adce.Rmd b/vignettes/adce.Rmd index 7adb73a8..ee474ef5 100644 --- a/vignettes/adce.Rmd +++ b/vignettes/adce.Rmd @@ -104,7 +104,7 @@ adce <- adce %>% derive_vars_merged( dataset_add = adsl, new_vars = adsl_vars, - by = exprs(STUDYID, USUBJID) + by = get_admiral_option("subject_keys") ) %>% derive_vars_dt( dtc = CESTDTC, @@ -136,7 +136,7 @@ adce <- derive_vars_joined( adce, dataset_add = adperiods, - by_vars = exprs(STUDYID, USUBJID), + by_vars = get_admiral_option("subject_keys"), filter_join = ASTDT >= APERSDT & ASTDT <= APEREDT, join_type = "all" ) %>% @@ -193,7 +193,7 @@ dataset_vignette( adce <- adce %>% derive_var_obs_number( new_var = ASEQ, - by_vars = exprs(STUDYID, USUBJID), + by_vars = get_admiral_option("subject_keys"), order = exprs(CEDECOD, CELAT, CETPTREF, APERIOD), check_type = "error" ) %>% @@ -228,7 +228,7 @@ adsl_list <- adsl %>% adce <- adce %>% derive_vars_merged( dataset_add = adsl_list, - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) ``` diff --git a/vignettes/adface.Rmd b/vignettes/adface.Rmd index fbdd4642..c5110efe 100644 --- a/vignettes/adface.Rmd +++ b/vignettes/adface.Rmd @@ -141,7 +141,7 @@ adface <- derive_vars_merged( face, dataset_add = adsl, new_vars = adsl_vars, - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) ``` @@ -242,7 +242,7 @@ period_ref <- create_period_dataset( adface <- derive_vars_joined( adface, dataset_add = period_ref, - by_vars = exprs(STUDYID, USUBJID), + by_vars = get_admiral_option("subject_keys"), filter_join = ADT >= APERSDT & ADT <= APEREDT, join_type = "all" ) @@ -444,7 +444,7 @@ lookup_dataset <- tribble( "MAXDIAM", "MDISW", 29, "Maximum Diameter", "SWELLING", "MAXSEV", "MAXSPIS", 30, "Maximum Severity", "PAIN AT INJECTION SITE", "OCCUR", "OCCVOM", 31, "Occurrence Indicator", "VOMITING", - "DIAMETER", "DIASWEL", 32, "Diameter", "SWELLING", + "DIAMETER", "DIASWEL", 32, "Diameter", "SWELLING" ) ``` @@ -542,7 +542,7 @@ adsl <- adsl %>% adface <- derive_vars_merged( dataset = adface, dataset_add = select(adsl, !!!negate_vars(adsl_vars)), - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) ``` diff --git a/vignettes/adsl.Rmd b/vignettes/adsl.Rmd index 8ca085f6..d4a30cbe 100644 --- a/vignettes/adsl.Rmd +++ b/vignettes/adsl.Rmd @@ -99,13 +99,13 @@ adsl <- dm %>% dataset_add = ex, filter_add = EXLNKGRP == "VACCINATION 1", new_vars = exprs(TRT01A = EXTRT), - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) %>% derive_vars_merged( dataset_add = ex, filter_add = EXLNKGRP == "VACCINATION 2", new_vars = exprs(TRT02A = EXTRT), - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) ``` @@ -141,7 +141,7 @@ adsl <- adsl %>% new_vars = exprs(TRTSDTM = EXSTDTM), order = exprs(EXSTDTM, EXSEQ), mode = "first", - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) %>% derive_vars_merged( dataset_add = ex_ext, @@ -151,7 +151,7 @@ adsl <- adsl %>% new_vars = exprs(TRTEDTM = EXENDTM), order = exprs(EXENDTM, EXSEQ), mode = "last", - by_vars = exprs(STUDYID, USUBJID) + by_vars = get_admiral_option("subject_keys") ) ``` From 89e2ac34ebf1cb301267816985a5db164c2ee02c Mon Sep 17 00:00:00 2001 From: Federico Baratin Date: Thu, 18 Jul 2024 12:22:54 +0200 Subject: [PATCH 07/14] Put new datasets as per pharmaverse aligment. --- inst/templates/ad_adis.R | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/inst/templates/ad_adis.R b/inst/templates/ad_adis.R index e3bde0d5..b6819594 100644 --- a/inst/templates/ad_adis.R +++ b/inst/templates/ad_adis.R @@ -11,12 +11,14 @@ library(lubridate) library(rlang) library(admiralvaccine) library(metatools) +library(pharmaversesdtm) # Load source datasets ---- -data("vx_is") -data("vx_suppis") -data("vx_adsl") +data("is_vaccine") +data("suppis_vaccine") +data("admiralvaccine_adsl") + # When SAS datasets are imported into R using haven::read_sas(), missing # character values from SAS appear as "" characters in R, instead of appearing @@ -24,9 +26,9 @@ data("vx_adsl") # https://pharmaverse.github.io/admiral/articles/admiral.html#handling-of-missing-values # nolint -is <- convert_blanks_to_na(vx_is) -suppis <- convert_blanks_to_na(vx_suppis) -adsl <- convert_blanks_to_na(vx_adsl) +is <- convert_blanks_to_na(is_vaccine) +suppis <- convert_blanks_to_na(suppis_vaccine) +adsl <- convert_blanks_to_na(admiralvaccine_adsl) # Derivations ---- From 25b5cb3c05935e8e4d23b80a31b563a8648e59cb Mon Sep 17 00:00:00 2001 From: Federico Baratin Date: Fri, 19 Jul 2024 08:32:34 +0200 Subject: [PATCH 08/14] Updated vignette with pharmaverse SDTM data. --- vignettes/adis.Rmd | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/vignettes/adis.Rmd b/vignettes/adis.Rmd index 7bfcd1f7..7a9a1cc2 100644 --- a/vignettes/adis.Rmd +++ b/vignettes/adis.Rmd @@ -85,16 +85,17 @@ library(admiraldev) library(admiralvaccine) library(pharmaversesdtm) library(metatools) +library(pharmaversesdtm) # Load source datasets -data("vx_is") -data("vx_suppis") -data("vx_adsl") +data("is_vaccine") +data("suppis_vaccine") +data("admiralvaccine_adsl") # Convert blanks into NA -is <- convert_blanks_to_na(vx_is) -suppis <- convert_blanks_to_na(vx_suppis) -adsl <- convert_blanks_to_na(vx_adsl) +is <- convert_blanks_to_na(is_vaccine) +suppis <- convert_blanks_to_na(suppis_vaccine) +adsl <- convert_blanks_to_na(admiralvaccine_adsl) ``` From 309c434475d5d6db7ba5edde511c93ddb2d6c491 Mon Sep 17 00:00:00 2001 From: Federico Baratin Date: Fri, 19 Jul 2024 09:01:30 +0200 Subject: [PATCH 09/14] Updated with adsl dataset. --- inst/templates/ad_adis.R | 2 +- vignettes/adis.Rmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/templates/ad_adis.R b/inst/templates/ad_adis.R index b6819594..1df606b3 100644 --- a/inst/templates/ad_adis.R +++ b/inst/templates/ad_adis.R @@ -363,7 +363,7 @@ vx_adsl_vars <- exprs(RFSTDTC, PPROTFL) adis <- derive_vars_merged( dataset = adis, - dataset_add = select(vx_adsl, !!!negate_vars(vx_adsl_vars)), + dataset_add = select(adsl, !!!negate_vars(vx_adsl_vars)), by_vars = get_admiral_option("subject_keys") ) diff --git a/vignettes/adis.Rmd b/vignettes/adis.Rmd index 7a9a1cc2..fcd86b9d 100644 --- a/vignettes/adis.Rmd +++ b/vignettes/adis.Rmd @@ -595,7 +595,7 @@ vx_adsl_vars <- exprs(RFSTDTC, PPROTFL) adis <- derive_vars_merged( dataset = adis, - dataset_add = select(vx_adsl, !!!negate_vars(vx_adsl_vars)), + dataset_add = select(adsl, !!!negate_vars(vx_adsl_vars)), by_vars = get_admiral_option("subject_keys") ) ``` From 3d4715ade973a8b9513f7ef69928aba2be0a6193 Mon Sep 17 00:00:00 2001 From: Arjun Rubalingam <115066417+arjoon-r@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:10:37 +0530 Subject: [PATCH 10/14] #246 removed metatools from imports but moved suggests --- DESCRIPTION | 4 +- NAMESPACE | 1 - R/admiralvaccine.R | 1 - inst/templates/ad_adface.R | 12 +- inst/templates/ad_adis.R | 2 +- man/derive_vars_merged_vaccine.Rd | 25 +--- .../test-derive_vars_merged_vaccine.R | 123 +----------------- vignettes/adface.Rmd | 9 +- vignettes/adis.Rmd | 2 +- 9 files changed, 20 insertions(+), 159 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d2057e65..1a45738d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -58,7 +58,6 @@ Imports: lifecycle (>= 0.1.0), lubridate (>= 1.7.4), magrittr (>= 1.5), - metatools, purrr (>= 0.3.3), rlang (>= 0.4.4), stringr (>= 1.4.0), @@ -81,7 +80,8 @@ Suggests: styler, testthat, tibble, - usethis + usethis, + metatools VignetteBuilder: knitr Encoding: UTF-8 diff --git a/NAMESPACE b/NAMESPACE index 4db4d77c..6a3fbe90 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -87,7 +87,6 @@ importFrom(lubridate,years) importFrom(lubridate,ymd) importFrom(lubridate,ymd_hms) importFrom(magrittr,"%>%") -importFrom(metatools,combine_supp) importFrom(purrr,compose) importFrom(purrr,every) importFrom(purrr,flatten) diff --git a/R/admiralvaccine.R b/R/admiralvaccine.R index 8fcf9918..46099173 100644 --- a/R/admiralvaccine.R +++ b/R/admiralvaccine.R @@ -32,5 +32,4 @@ #' @importFrom admiraldev assert_logical_scalar assert_character_vector assert_vars #' assert_data_frame assert_character_scalar assert_numeric_vector assert_filter_cond #' assert_symbol assert_expr_list expect_dfs_equal -#' @importFrom metatools combine_supp "_PACKAGE" diff --git a/inst/templates/ad_adface.R b/inst/templates/ad_adface.R index 63e23699..f546f35d 100644 --- a/inst/templates/ad_adface.R +++ b/inst/templates/ad_adface.R @@ -58,13 +58,17 @@ face <- face %>% adsl_vars <- exprs(RFSTDTC, RFENDTC) +# Combine the parental datasets with their respective supp datasets (only if exist) +# User can use `combine_supp()` from {metatools} to combine the parental with supp dataset. + +face <- metatools::combine_supp(face, suppface) +ex <- metatools::combine_supp(ex, suppex) + # Step 2 - Merging supplementary datasets and FACE with EX adface <- derive_vars_merged_vaccine( dataset = face, dataset_ex = ex, - dataset_supp = suppface, - dataset_suppex = suppex, by_vars_sys = exprs(USUBJID, FATPTREF = EXLNKGRP), by_vars_adms = exprs(USUBJID, FATPTREF = EXLNKGRP, FALOC = EXLOC, FALAT = EXLAT), ex_vars = exprs(EXTRT, EXDOSE, EXSEQ, EXSTDTC, EXENDTC, VISIT, VISITNUM) @@ -261,13 +265,11 @@ keep_vars <- c( "APEREDT", "APERETM", "APEREDTM", "APERDY", "FAORRES" ) -adface <- adface %>% select( +admiralvaccine_adface <- adface %>% select( any_of(keep_vars), starts_with("TRT0"), starts_with("VAX"), starts_with("EVE"), starts_with("ANL") ) -admiralvaccine_adface <- adface - # Save output ---- dir <- tools::R_user_dir("admiralvaccine_templates_data", which = "cache") diff --git a/inst/templates/ad_adis.R b/inst/templates/ad_adis.R index 8d5b32d3..c4efe455 100644 --- a/inst/templates/ad_adis.R +++ b/inst/templates/ad_adis.R @@ -31,7 +31,7 @@ adsl <- convert_blanks_to_na(admiralvaccine_adsl) # STEP 1 - combine IS with SUPPIS. # Please, upload MOCK data -is_suppis <- combine_supp(is, suppis) +is_suppis <- metatools::combine_supp(is, suppis) # STEP 2 - Visits and timing variables derivation. diff --git a/man/derive_vars_merged_vaccine.Rd b/man/derive_vars_merged_vaccine.Rd index 16135696..9053af81 100644 --- a/man/derive_vars_merged_vaccine.Rd +++ b/man/derive_vars_merged_vaccine.Rd @@ -9,18 +9,16 @@ derive_vars_merged_vaccine( dataset_ex, by_vars_sys, by_vars_adms, - dataset_supp = NULL, - dataset_suppex = NULL, ex_vars ) } \arguments{ -\item{dataset}{Input dataset +\item{dataset}{Input dataset which should have been combined with the supplementary(if exists). The variables specified by the \code{by_vars} argument inside the \code{derive_vars_merged}are expected.} -\item{dataset_ex}{EX dataset to merge with the input dataset. +\item{dataset_ex}{\code{ex} dataset(combined with \code{suppex}) to merge with the input dataset. The variables specified by the \code{ex_vars} argument are expected.} @@ -28,18 +26,6 @@ The variables specified by the \code{ex_vars} argument are expected.} \item{by_vars_adms}{Grouping variables for administration site events.} -\item{dataset_supp}{Supplementary input dataset - -By default \code{dataset_supp} will be \code{NULL}, user has to provide -supplementary dataset to merge it back with original input dataset -if they have supplementary dataset in their case.} - -\item{dataset_suppex}{Supplementary EX dataset - -By default \code{dataset_suppex} will be \code{NULL}, user has to provide -supplementary dataset to merge it back with original \code{EX} dataset -if they have supplementary dataset in their case.} - \item{ex_vars}{Variables to be added to the output dataset from EX dataset} } \value{ @@ -61,8 +47,7 @@ is expected to handle if any pre-processing is required. Only the variables passed to the \code{ex_vars} will be added in the output dataset If the input dataset has multiple vaccination for a subject at same visit -then this function will not merge ex dataset and will return only the input -dataset merged with its supplementary dataset. +then this function will not merge ex dataset and will return the \code{dataset}. } \examples{ @@ -74,8 +59,6 @@ library(pharmaversesdtm) derive_vars_merged_vaccine( dataset = face_vaccine, dataset_ex = ex_vaccine, - dataset_supp = NULL, - dataset_suppex = NULL, by_vars_sys = exprs(USUBJID, FATPTREF = EXLNKGRP), by_vars_adms = exprs(USUBJID, FATPTREF = EXLNKGRP, FALOC = EXLOC, FALAT = EXLAT), ex_vars = exprs(EXTRT, EXDOSE, EXDOSU, EXSTDTC, EXENDTC) @@ -86,8 +69,6 @@ derive_vars_merged_vaccine( derive_vars_merged_vaccine( dataset = face_vaccine, dataset_ex = ex_vaccine, - dataset_supp = suppface_vaccine, - dataset_suppex = suppex_vaccine, by_vars_sys = exprs(USUBJID, FATPTREF = EXLNKGRP), by_vars_adms = exprs(USUBJID, FATPTREF = EXLNKGRP, FALOC = EXLOC, FALAT = EXLAT), ex_vars = exprs(EXTRT, EXDOSE, EXDOSU, EXSTDTC, EXENDTC) diff --git a/tests/testthat/test-derive_vars_merged_vaccine.R b/tests/testthat/test-derive_vars_merged_vaccine.R index d591d974..dde20dda 100644 --- a/tests/testthat/test-derive_vars_merged_vaccine.R +++ b/tests/testthat/test-derive_vars_merged_vaccine.R @@ -1,5 +1,3 @@ -## Test 1: Merging EXTRT variable from EX to FACE - test_that("derive_vars_merged_vaccine Test 1: Merging EXTRT variable from EX to FACE", { face <- tibble::tribble( ~USUBJID, ~FACAT, ~FASCAT, ~FATESTCD, ~FAOBJ, ~FATEST, ~FALOC, ~FALAT, ~FATPTREF, @@ -43,8 +41,6 @@ test_that("derive_vars_merged_vaccine Test 1: Merging EXTRT variable from EX to actual <- derive_vars_merged_vaccine( dataset = face, dataset_ex = ex, - dataset_supp = NULL, - dataset_suppex = NULL, by_vars_sys = exprs(USUBJID, FATPTREF = EXTPTREF), by_vars_adms = exprs(USUBJID, FATPTREF = EXTPTREF, FALOC = EXLOC, FALAT = EXLAT), ex_vars = exprs(EXTRT, EXDOSE) @@ -55,123 +51,8 @@ test_that("derive_vars_merged_vaccine Test 1: Merging EXTRT variable from EX to )) }) -## Test 2: Check if supp datasets merged properly if they exist - -test_that("derive_vars_merged_vaccine Test 2: Check if supp datasets merged - properly if they exist", { - face <- tibble::tribble( - ~STUDYID, ~DOMAIN, ~USUBJID, ~FACAT, ~FASCAT, ~FATESTCD, ~FAOBJ, ~FATEST, ~FALOC, ~FALAT, - ~FATPTREF, ~FASEQ, - "ABC", "FACE", "ABC101", "REACTO", "ADMINISTRATION SITE", "SEV", "Redness", "Severity", "ARM", - "RIGHT", "VAC 1", 1, - "ABC", "FACE", "ABC101", "REACTO", "ADMINISTRATION SITE", "DIAMETER", "Redness", "Diameter", - "ARM", "LEFT", "VAC 1", 2, - "ABC", "FACE", "ABC101", "REACTO", "ADMINISTRATION SITE", "DIAM", "Redness", "Diameter", - NA, NA, "VAC 2", 3, - "ABC", "FACE", "ABC101", "REACTO", "SYSTEMIC", "OCCUR", "Fatigue", "Occurrence", - "LEG", "LEFT", "VAC 3", 5, - "ABC", "FACE", "ABC101", "REACTO", "ADMINISTRATION SITE", "OCCUR", "Erythema", - "Occurrence", "LEG", "LEFT", "VAC 3", 6, - "ABC", "FACE", "ABC101", "REACTO", "ADMINISTRATION SITE", "SEV", "Swelling", - "Severity", NA, NA, "VAC 4", 7, - "ABC", "FACE", "ABC101", "REACTO", "ADMINISTRATION SITE", "OCCUR", "Swelling", - "Occurrence", NA, NA, "VAC 4", 8, - "ABC", "FACE", "ABC102", "REACTO", "ADMINISTRATION SITE", "OCCUR", "Swelling", - "Occurrence", NA, NA, "VAC 1", 1 - ) - - ex <- tibble::tribble( - ~STUDYID, ~DOMAIN, ~USUBJID, ~EXSTDTC, ~VISITNUM, ~EXTRT, ~EXTPTREF, ~VISIT, ~EXLOC, ~EXLAT, - ~EXDOSE, ~EXSEQ, - "ABC", "EX", "ABC101", "2015-01-10", 1, "DRUG A", "VAC 1", "VISIT 1", "ARM", "RIGHT", 20, 1, - "ABC", "EX", "ABC101", "2015-01-11", 2, "DRUG A", "VAC 2", "VISIT 2", NA, NA, 30, 2, - "ABC", "EX", "ABC101", "2015-01-12", 3, "DRUG B", "VAC 3", "VISIT 3", "LEG", "LEFT", 25, 3, - "ABC", "EX", "ABC101", "2015-01-13", 4, "DRUG C", "VAC 4", "VISIT 4", NA, NA, 30, 4, - "ABC", "EX", "ABC102", "2015-01-13", 1, "DRUG B", "VAC 1", "VISIT 5", NA, NA, 10, 1 - ) - - suppface <- tibble::tribble( - ~STUDYID, ~USUBJID, ~RDOMAIN, ~IDVAR, ~IDVARVAL, ~QNAM, ~QVAL, ~QLABEL, ~QORIG, - "ABC", "ABC101", "FACE", "FASEQ", 1, "CLTYP", "DAIRY", "Collection Type", - "Predecessor", - "ABC", "ABC101", "FACE", "FASEQ", 2, "CLTYP", "CRF", "Collection Type", - "Predecessor" - ) - - suppex <- tibble::tribble( - ~STUDYID, ~USUBJID, ~RDOMAIN, ~IDVAR, ~IDVARVAL, ~QNAM, ~QVAL, ~QLABEL, ~QORIG, - "ABC", "ABC101", "EX", "EXSEQ", 1, "EXTDV", "N", "Temporary Delay of Vaccination", - "ASSIGNED", - "ABC", "ABC101", "EX", "EXSEQ", 2, "EXTDV", "Y", "Temporary Delay of Vaccination", - "ASSIGNED" - ) - - temp <- suppface %>% - pivot_wider( - id_cols = c(USUBJID, IDVAR, IDVARVAL), - names_from = QNAM, - values_from = QVAL - ) %>% - mutate(FASEQ = IDVARVAL) %>% - select(-c(IDVAR, IDVARVAL)) - facef <- left_join(face, temp, by = c("USUBJID", "FASEQ"), keep = FALSE) - face1 <- facef %>% - mutate(LOC = FALOC, LAT = FALAT, TPTREF = FATPTREF) - - tempex <- suppex %>% - pivot_wider( - id_cols = c(USUBJID, IDVAR, IDVARVAL), - names_from = QNAM, - values_from = QVAL - ) %>% - mutate(EXSEQ = IDVARVAL) %>% - select(-c(IDVAR, IDVARVAL)) - exf <- left_join(ex, tempex, by = c("USUBJID", "EXSEQ"), keep = FALSE) - - ex1 <- exf %>% - mutate(LOC = EXLOC, LAT = EXLAT, TPTREF = EXTPTREF) %>% - select(-c( - "VISITNUM", "VISIT", "EXLOC", "EXLAT", "EXSTDTC", - "EXTPTREF", "STUDYID", "DOMAIN", "EXSEQ" - )) - - admin <- face1 %>% - filter(FASCAT == "ADMINISTRATION SITE") - expected1 <- left_join(admin, - ex1, - by = c("USUBJID", "LOC", "LAT", "TPTREF"), keep = FALSE - ) %>% - select(-c("LOC", "LAT", "TPTREF")) - - sys <- face1 %>% filter(FASCAT == "SYSTEMIC") - expected2 <- left_join(sys, - ex1, - by = c("USUBJID", "TPTREF"), keep = FALSE - ) %>% - select(-c("TPTREF", "LOC.x", "LOC.y", "LAT.x", "LAT.y")) - - expected <- bind_rows(expected1, expected2) - - - actual <- derive_vars_merged_vaccine( - dataset = face, - dataset_ex = ex, - dataset_supp = suppface, - dataset_suppex = suppex, - by_vars_sys = exprs(USUBJID, FATPTREF = EXTPTREF), - by_vars_adms = exprs(USUBJID, FATPTREF = EXTPTREF, FALOC = EXLOC, FALAT = EXLAT), - ex_vars = exprs(EXTRT, EXDOSE, EXTDV) - ) - expect_dfs_equal(actual, expected, keys = c( - "USUBJID", "FAOBJ", "FATESTCD", "FATPTREF", - "FALOC", "FALAT" - )) -}) - - -## Test 3: Check if warning is raised when there are multiple vaccination in same visit -test_that("derive_vars_merged_vaccine Test 3: Check if warning is raised when +test_that("derive_vars_merged_vaccine Test 2: Check if warning is raised when there are multiple vaccination in same ", { face <- tibble::tribble( ~STUDYID, ~DOMAIN, ~USUBJID, ~FACAT, ~FASCAT, ~FATESTCD, ~FAOBJ, ~FATEST, ~FALOC, ~FALAT, @@ -207,8 +88,6 @@ test_that("derive_vars_merged_vaccine Test 3: Check if warning is raised when derive_vars_merged_vaccine( dataset = face, dataset_ex = ex, - dataset_supp = NULL, - dataset_suppex = NULL, by_vars_sys = exprs(USUBJID, FATPTREF = EXTPTREF), by_vars_adms = exprs(USUBJID, FATPTREF = EXTPTREF, FALOC = EXLOC, FALAT = EXLAT), ex_vars = exprs(EXTRT, EXDOSE) diff --git a/vignettes/adface.Rmd b/vignettes/adface.Rmd index fbdd4642..49f009ef 100644 --- a/vignettes/adface.Rmd +++ b/vignettes/adface.Rmd @@ -84,12 +84,15 @@ adsl <- convert_blanks_to_na(admiralvaccine_adsl) ## Pre-processing of Input Dataset {#input} This step involves company-specific pre-processing of required input dataset for -further analysis. In this step, we will filter records that has only reactogenicity events. +further analysis. In this step, we will filter records that has only reactogenicity events and +combine the `face` and `ex` with their supplementary datasets `suppface` and `suppex` respectively. ```{r eval=TRUE} face <- face %>% filter(FACAT == "REACTOGENICITY" & grepl("ADMIN|SYS", FASCAT)) %>% - mutate(FAOBJ = str_to_upper(FAOBJ)) + mutate(FAOBJ = str_to_upper(FAOBJ)) %>% + metatools::combine_supp(suppface) +ex <- metatools::combine_supp(ex, suppex) ``` ```{r, echo=FALSE} @@ -109,8 +112,6 @@ The function `derive_vars_merged_vaccine()` is used to merge `face` with `ex` do adface <- derive_vars_merged_vaccine( dataset = face, dataset_ex = ex, - dataset_supp = suppface, - dataset_suppex = suppex, by_vars_sys = exprs(USUBJID, FATPTREF = EXLNKGRP), by_vars_adms = exprs(USUBJID, FATPTREF = EXLNKGRP, FALOC = EXLOC, FALAT = EXLAT), ex_vars = exprs(EXTRT, EXDOSE, EXSEQ, EXSTDTC, EXENDTC, VISIT, VISITNUM) diff --git a/vignettes/adis.Rmd b/vignettes/adis.Rmd index c568b655..882c3153 100644 --- a/vignettes/adis.Rmd +++ b/vignettes/adis.Rmd @@ -102,7 +102,7 @@ adsl <- convert_blanks_to_na(admiralvaccine_adsl) ## Combine IS with SUPPIS {#combine_supp} Combine `IS` with its supplemental domain `SUPPIS`. ```{r eval=TRUE} -is_suppis <- combine_supp(is, suppis) +is_suppis <- metatools::combine_supp(is, suppis) ``` From f429c662efc12a622eb44d98707a4f6faf6cf810 Mon Sep 17 00:00:00 2001 From: Arjun Rubalingam <115066417+arjoon-r@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:11:05 +0530 Subject: [PATCH 11/14] #246 removed supp dataset args --- R/derive_vars_merged_vaccine.R | 47 +++++----------------------------- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/R/derive_vars_merged_vaccine.R b/R/derive_vars_merged_vaccine.R index cf666435..2d43f239 100644 --- a/R/derive_vars_merged_vaccine.R +++ b/R/derive_vars_merged_vaccine.R @@ -4,27 +4,15 @@ #' The variables to be added to the output dataset will be based on input variables #' passed on `ex_vars` argument. #' -#' @param dataset Input dataset +#' @param dataset Input dataset which should have been combined with the supplementary(if exists). #' #' The variables specified by the `by_vars` argument inside the #' `derive_vars_merged`are expected. #' -#' @param dataset_ex EX dataset to merge with the input dataset. +#' @param dataset_ex `ex` dataset(combined with `suppex`) to merge with the input dataset. #' #' The variables specified by the `ex_vars` argument are expected. #' -#' @param dataset_supp Supplementary input dataset -#' -#' By default `dataset_supp` will be `NULL`, user has to provide -#' supplementary dataset to merge it back with original input dataset -#' if they have supplementary dataset in their case. -#' -#' @param dataset_suppex Supplementary EX dataset -#' -#' By default `dataset_suppex` will be `NULL`, user has to provide -#' supplementary dataset to merge it back with original `EX` dataset -#' if they have supplementary dataset in their case. -#' #' @param by_vars_sys Grouping variables for systemic events. #' #' @param by_vars_adms Grouping variables for administration site events. @@ -45,8 +33,7 @@ #' Only the variables passed to the `ex_vars` will be added in the output dataset #' #' If the input dataset has multiple vaccination for a subject at same visit -#' then this function will not merge ex dataset and will return only the input -#' dataset merged with its supplementary dataset. +#' then this function will not merge ex dataset and will return the `dataset`. #' #' @author Vikram S #' @@ -66,8 +53,6 @@ #' derive_vars_merged_vaccine( #' dataset = face_vaccine, #' dataset_ex = ex_vaccine, -#' dataset_supp = NULL, -#' dataset_suppex = NULL, #' by_vars_sys = exprs(USUBJID, FATPTREF = EXLNKGRP), #' by_vars_adms = exprs(USUBJID, FATPTREF = EXLNKGRP, FALOC = EXLOC, FALAT = EXLAT), #' ex_vars = exprs(EXTRT, EXDOSE, EXDOSU, EXSTDTC, EXENDTC) @@ -78,38 +63,21 @@ #' derive_vars_merged_vaccine( #' dataset = face_vaccine, #' dataset_ex = ex_vaccine, -#' dataset_supp = suppface_vaccine, -#' dataset_suppex = suppex_vaccine, #' by_vars_sys = exprs(USUBJID, FATPTREF = EXLNKGRP), #' by_vars_adms = exprs(USUBJID, FATPTREF = EXLNKGRP, FALOC = EXLOC, FALAT = EXLAT), #' ex_vars = exprs(EXTRT, EXDOSE, EXDOSU, EXSTDTC, EXENDTC) -#' ) %>% -#' filter(CLTYP == "DAIRY") %>% -#' select(USUBJID, FATPTREF, CLTYP, EXTRT, EXDOSE, EXDOSU, EXSTDTC, EXENDTC) +#' ) +#' derive_vars_merged_vaccine <- function(dataset, dataset_ex, by_vars_sys, by_vars_adms, - dataset_supp = NULL, - dataset_suppex = NULL, ex_vars) { assert_data_frame(dataset) assert_vars(by_vars_sys) assert_vars(by_vars_adms) assert_vars(ex_vars) - assert_data_frame(dataset_supp, optional = TRUE) assert_data_frame(dataset_ex) - assert_data_frame(dataset_suppex, optional = TRUE) - - # combine face and suppface dataset - if (!is.null(dataset_supp)) { - dataset <- combine_supp(dataset, dataset_supp) - } - - # combine face and suppex dataset - if (!is.null(dataset_suppex)) { - dataset_ex <- combine_supp(dataset_ex, dataset_suppex) - } if ("VISIT" %in% names(dataset_ex)) { ex_distinct <- dataset_ex %>% distinct(USUBJID, VISIT, .keep_all = TRUE) @@ -119,8 +87,7 @@ derive_vars_merged_vaccine <- function(dataset, if (nrow(dataset_ex) != nrow(ex_distinct)) { warning("Subjects have multiple vaccinations at same visit") - - dataset <- dataset + return(dataset) } else { # Filter records for ADMINISTRATION SITE events and merge it with EX dataset dataset_adminstration <- dataset %>% @@ -145,6 +112,6 @@ derive_vars_merged_vaccine <- function(dataset, ) # bind face1 and face2 datasets - bind_rows(face1, face2) + return(bind_rows(face1, face2)) } } From 2e8c2bc66ae15c624a441e32fe4d45c4590102d3 Mon Sep 17 00:00:00 2001 From: Arjun Rubalingam <115066417+arjoon-r@users.noreply.github.com> Date: Wed, 31 Jul 2024 16:08:28 +0530 Subject: [PATCH 12/14] #246 --- NEWS.md | 4 ++++ man/derive_vars_merged_vaccine.Rd | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 1bc01627..67ca2151 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,8 @@ # admiralvaccine (development version) +# admiralvaccine 0.3.0 + +## Updates to Templates and Function +- Removed `dataset_supp` and `dataset_suppex` arguments from `derive_vars_merged_vaccine()` as we are not combining the parental with supplementary inside the function, but can be combined in the ADCE, ADFACE and ADIS template using `combine_supp()` from {metatools} as the {metatools} has been removed from dependency. # admiralvaccine 0.2.0 diff --git a/man/derive_vars_merged_vaccine.Rd b/man/derive_vars_merged_vaccine.Rd index 9053af81..b1c9eb97 100644 --- a/man/derive_vars_merged_vaccine.Rd +++ b/man/derive_vars_merged_vaccine.Rd @@ -72,9 +72,8 @@ derive_vars_merged_vaccine( by_vars_sys = exprs(USUBJID, FATPTREF = EXLNKGRP), by_vars_adms = exprs(USUBJID, FATPTREF = EXLNKGRP, FALOC = EXLOC, FALAT = EXLAT), ex_vars = exprs(EXTRT, EXDOSE, EXDOSU, EXSTDTC, EXENDTC) -) \%>\% - filter(CLTYP == "DAIRY") \%>\% - select(USUBJID, FATPTREF, CLTYP, EXTRT, EXDOSE, EXDOSU, EXSTDTC, EXENDTC) +) + } \seealso{ Other der_var: From 915a430edfc36f39cf1c4eb60b05f272e949d51f Mon Sep 17 00:00:00 2001 From: ahasoplakus Date: Wed, 31 Jul 2024 11:09:03 +0000 Subject: [PATCH 13/14] update news.md --- NEWS.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 67ca2151..d25a87e2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,12 @@ -# admiralvaccine (development version) # admiralvaccine 0.3.0 -## Updates to Templates and Function -- Removed `dataset_supp` and `dataset_suppex` arguments from `derive_vars_merged_vaccine()` as we are not combining the parental with supplementary inside the function, but can be combined in the ADCE, ADFACE and ADIS template using `combine_supp()` from {metatools} as the {metatools} has been removed from dependency. +## Breaking Changes + +- Removed `dataset_supp` and `dataset_suppex` arguments from `derive_vars_merged_vaccine()` as we are not combining the parental with supplementary inside the function, but can be optionally combined in the ADCE, ADFACE and ADIS templates using `combine_supp()` function from {metatools}. (#246) + +## Updates to Templates + +- Supplementary domains are now optionally combined with parental domain within the template. (#246) # admiralvaccine 0.2.0 From 712dbdb30d49ec1233c72305d524a3e96518e306 Mon Sep 17 00:00:00 2001 From: ahasoplakus Date: Wed, 31 Jul 2024 11:28:34 +0000 Subject: [PATCH 14/14] remove redundant library calls --- inst/templates/ad_adis.R | 5 ----- 1 file changed, 5 deletions(-) diff --git a/inst/templates/ad_adis.R b/inst/templates/ad_adis.R index b93bdba1..a97dd680 100644 --- a/inst/templates/ad_adis.R +++ b/inst/templates/ad_adis.R @@ -4,13 +4,8 @@ # # Input: is, suppis, adsl library(admiral) -library(admiral.test) # Contains example datasets from the CDISC pilot project -library(metatools) library(dplyr) -library(lubridate) -library(rlang) library(admiralvaccine) -library(metatools) library(pharmaversesdtm)