From 8f5210f958e17aee92aaf5015ecb6264699ff0a4 Mon Sep 17 00:00:00 2001 From: Vinh Nguyen Date: Wed, 8 Nov 2023 19:52:07 -0500 Subject: [PATCH 01/40] 233 - iRecist vignette initial draft --- _pkgdown.yml | 2 + vignettes/irecist.Rmd | 858 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 860 insertions(+) create mode 100644 vignettes/irecist.Rmd diff --git a/_pkgdown.yml b/_pkgdown.yml index 5d3c9368..022243fb 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -77,3 +77,5 @@ navbar: href: articles/adtr.html - text: Creating and Using New Anti-Cancer Start Date href: articles/nactdt.html + - text: Creating ADRS with iRECIST endpoints + href: articles/irecist.html diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd new file mode 100644 index 00000000..77968cf5 --- /dev/null +++ b/vignettes/irecist.Rmd @@ -0,0 +1,858 @@ +--- +title: "Creating ADRS with iRECIST endpoints" +output: + rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Creating ADRS with iRECIST endpoints} + %\VignetteEncoding{UTF-8} + %\VignetteEngine{knitr::rmarkdown} +--- + +```{r setup, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +library(admiral) + +link <- function(text, url) { + return( + paste0( + "[", text, "]", + "(", url, ")" + ) + ) +} +dyn_link <- function(text, + base_url, + relative_url = "", + # Change to TRUE when admiral adopts multiversion docs + is_multiversion = FALSE, + multiversion_default_ref = "main") { + url <- paste(base_url, relative_url, sep = "/") + if (is_multiversion) { + url <- paste( + base_url, + Sys.getenv("BRANCH_NAME", multiversion_default_ref), + relative_url, + sep = "/" + ) + } + return(link(text, url)) +} +# Other variables +admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" + +library(admiraldev) +``` + +# Introduction + +This article describes creating an `ADRS` ADaM with oncology endpoint parameters +based on iRECIST. It shows a similar way of deriving the endpoints presented in +[Creating ADRS (Including Non-standard Endpoints)](adrs.html). Most of the endpoints +are derived by calling `admiral::derive_extreme_event()`. Thus the examples in this +vignette can also be used as a starting point for implementing response criteria other +than iRECIST 1.1, e.g., RECIST 1.1 or International Myeloma Working Group (IMWG) +criteria for the diagnosis of multiple myeloma. + +For more information on the iRECIST guidelines user may visit +https://recist.eortc.org/recist-1-1-2/ + +Examples are currently presented and tested using `ADSL` (ADaM) and +`RS` (SDTM) inputs. However, other domains could be used. The functions +and workflow could similarly be used to create an intermediary `ADEVENT` ADaM. + +**Note**: *All examples assume CDISC SDTM and/or ADaM format as input +unless otherwise specified.* + +# Programming Workflow + +- [Read in Data](#readdata) +- [Pre-processing of Input Records](#input) +- [Derive Confirmed Progressive Disease Parameter](#pd) +- [Derive Response Parameter](#rsp) +- [Derive Clinical Benefit Parameter](#cb) +- [Derive Best Overall Response Parameter](#bor) +- [Derive Response Parameters requiring Confirmation](#confirm) + +## Read in Data {#readdata} + +To start, all data frames needed for the creation of `ADRS` should be +read into the environment. This will be a company specific process. Some +of the data frames needed may be `ADSL`, `RS` and `TU`. + +For example purpose, the SDTM and ADaM datasets (based on CDISC Pilot +test data)---which are included in `{pharmaversesdtm}` and `{pharmaverseadam}`---are used. + +```{r message=FALSE} +library(admiral) +library(admiralonco) +library(dplyr) +library(pharmaverseadam) +library(pharmaversesdtm) +library(lubridate) +library(stringr) +data("adsl") +data("rs_onco_irecist") + +adsl_onco <- adsl +rs <- rs_onco_irecist + +rs <- convert_blanks_to_na(rs) +``` + +```{r echo=FALSE} +# select subjects from adsl such that there is one subject without RS data +rs_subjects <- unique(rs$USUBJID) +adsl_subjects <- unique(adsl_onco$USUBJID) +adsl <- filter( + adsl_onco, + USUBJID %in% union(rs_subjects, setdiff(adsl_subjects, rs_subjects)[1]) +) +``` + +At this step, it may be useful to join `ADSL` to your `RS` domain. Only +the `ADSL` variables used for derivations are selected at this step. The +rest of the relevant `ADSL` would be added later. + +```{r eval=TRUE} +adsl_vars <- exprs(RANDDT) +adrs <- derive_vars_merged( + rs, + dataset_add = adsl, + new_vars = adsl_vars, + by_vars = exprs(STUDYID, USUBJID) +) +``` + +```{r, eval=TRUE, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, RSTESTCD, RSDTC, VISIT, RANDDT), + filter = RSTESTCD == "OVRLRESP" +) +``` + +## Pre-processing of Input Records {#input} + +The first step involves company-specific pre-processing of records for +the required input to the downstream parameter functions. It could involve +merging input data from other sources besides `RS`, such as `ADTR`. + +This step would include any required selection/derivation of `ADT` or +applying any necessary partial date imputations, updating `AVAL` (e.g. +this should be ordered from best to worst response), and setting +analysis flag `ANL01FL`. Common options for `ANL01FL` would be to set +null for invalid assessments or those occurring after new anti-cancer +therapy, or to only flag assessments on or after after date of first +treatment/randomization, or rules to cover the case when a patient has +multiple observations per visit (e.g. by selecting worst value). Another +consideration could be extra potential protocol-specific sources of +Progressive Disease such as radiological assessments, which could be +pre-processed here to create a PD record to feed downstream derivations. + +For the derivation of the parameters it is expected that the subject +identifier variables (usually `STUDYID` and `USUBJID`) and `ADT` are a +unique key. This can be achieved by deriving an analysis flag +(`ANLzzFL`). See [Derive `ANL01FL`](#anl01fl) for an example. + +The below shows an example of a possible company-specific implementation +of this step. + +### Select Overall Response Records and Set Parameter Details + +In this case we use the overall response records from `RS` from the +investigator as our starting point. The parameter details such as +`PARAMCD`, `PARAM` etc will always be company-specific, but an example +is shown below so that you can trace through how these records feed into +the other parameter derivations. + +```{r} +adrs <- adrs %>% + filter(RSEVAL == "INVESTIGATOR" & RSTESTCD == "OVRLRESP") %>% + mutate( + PARAMCD = "OVR", + PARAM = "Overall Response by Investigator", + PARCAT1 = "Tumor Response", + PARCAT2 = "Investigator", + PARCAT3 = "iRecist" + ) +``` + +```{r, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, VISIT, RSTESTCD, RSEVAL, PARAMCD, PARAM, PARCAT1, PARCAT2, PARCAT3) +) +``` + +### Partial Date Imputation and Deriving `ADT`, `ADTF`, `AVISIT` etc + +If your data collection allows for partial dates, you could apply a +company-specific imputation rule at this stage when deriving `ADT`. For +this example, here we impute missing day to last possible date. + +```{r} +adrs <- adrs %>% + derive_vars_dt( + dtc = RSDTC, + new_vars_prefix = "A", + highest_imputation = "D", + date_imputation = "last" + ) %>% + mutate(AVISIT = VISIT) +``` + +```{r, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, AVISIT, PARAMCD, PARAM, RSSTRESC, RSDTC, ADT, ADTF) +) +``` + +### Derive `AVALC` and `AVAL` + +Here we populate `AVALC` and create the numeric version as `AVAL` +(ordered from best to worst response). The `AVAL` values are not considered in +the parameter derivations below, and so changing `AVAL` here would not change +the result of those derivations. + +iRECIST ordering will be used or if you'd like to provide your own company-specific ordering here you +could do this as follows: + +```{r} +aval_resp_new <- function(arg) { + case_when( + arg == "iCR" ~ 8, + arg == "iPR" ~ 7, + arg == "iSD" ~ 6, + arg == "NON-iCR/NON-iUPD" ~ 5, + arg == "iCPD" ~ 4, + arg == "iUPD" ~ 3, + arg == "NE" ~ 2, + arg == "MISSING" ~ 1, + TRUE ~ NA_real_ + ) +} + +adrs <- adrs %>% + mutate( + AVALC = RSSTRESC, + AVAL = aval_resp_new(AVALC) + ) +``` + +```{r, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, AVISIT, PARAMCD, PARAM, RSSTRESC, AVALC, AVAL) +) +``` + +### Flag Worst Assessment at Each Date (`ANL01FL`) {#anl01fl} + +When deriving `ANL01FL` this is an opportunity to exclude any records +that should not contribute to any downstream parameter derivations. In +the below example this includes only selecting valid assessments and +those occurring on or after randomization date. If there is more than +one assessment at a date, the worst one is flagged. + +```{r} +adrs <- adrs %>% + restrict_derivation( + derivation = derive_var_extreme_flag, + args = params( + by_vars = exprs(STUDYID, USUBJID, ADT), + order = exprs(AVAL, RSSEQ), + new_var = ANL01FL, + mode = "last" + ), + filter = !is.na(AVAL) & ADT >= RANDDT + ) +``` + +```{r, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, AVISIT, PARAMCD, PARAM, AVALC, ADT, RANDDT, ANL01FL) +) +``` + +Here is an alternative example where those records occurring after new +anti-cancer therapy are additionally excluded (where `NACTDT` would be +pre-derived as first date of new anti-cancer therapy. See `{admiralonco}` +[Creating and Using New Anti-Cancer Start Date](nactdt.html) for deriving this +variable). + +```{r, eval=FALSE} +adrs <- adrs %>% + mutate( + ANL01FL = case_when( + !is.na(AVAL) & ADT >= RANDDT & ADT < NACTDT ~ "Y", + TRUE ~ NA_character_ + ) + ) +``` + +### Flag Assessments up to First PD (`ANL02FL`) {#anl02fl} + +To restrict response data up to and including first reported progressive disease +`ANL02FL` flag could be created by using `{admiral}` function +`admiral::derive_var_relative_flag()`. + +```{r} +adrs <- adrs %>% + derive_var_relative_flag( + by_vars = exprs(STUDYID, USUBJID), + order = exprs(ADT, RSSEQ), + new_var = ANL02FL, + condition = AVALC == "iCPD", + mode = "first", + selection = "before", + inclusive = TRUE + ) +``` + +```{r, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, AVISIT, PARAMCD, AVALC, ADT, ANL01FL, ANL02FL) +) +``` + +### Select Source Assessments for Parameter derivations + +For most parameter derivations the post-baseline overall response assessments up +to and including first PD are considered. +```{r} +ovr <- filter(adrs, PARAMCD == "OVR" & ANL01FL == "Y" & ANL02FL == "Y") +``` + +```{r, echo=FALSE} +dataset_vignette( + ovr, + display_vars = exprs(USUBJID, AVISIT, AVALC, ADT, RANDDT) +) +``` + +## Define Events + +The building blocks for the events that contribute to deriving common endpoints +like what constitutes a responder, or a Best Overall Response of complete +response (CR), ... are predefined in admiralonco for Recist 1.1 (see [Pre-Defined +Response Event Objects](../reference/event_objects.html)). New Response Event Objects +are needed for iRECIST and any study-specific needs. Here the confirmation period +and the `keep_source_vars` argument is updated, as well as the `first_cond` and `condition` for the iRECIST values. + +```{r} +confirmation_period <- 21 + +icbor_icr <- event_joined( + description = paste( + "Define complete response (iCR) for confirmed best overall response (iCBOR) as", + "iCR followed by iCR at least", + confirmation_period, + "days later and at most one NE in between" + ), + dataset_name = "ovr", + join_vars = exprs(AVALC, ADT), + join_type = "after", + first_cond = AVALC.join == "iCR" & + ADT.join >= ADT + confirmation_period, + condition = AVALC == "iCR" & + all(AVALC.join %in% c("iCR", "NE")) & + count_vals(var = AVALC.join, val = "NE") <= 1, + set_values_to = exprs(AVALC = "iCR") +) + +icbor_ipr <- event_joined( + description = paste( + "Define partial response (iPR) for confirmed best overall response (iCBOR) as", + "iPR followed by iCR or iPR at least", + confirmation_period, + "28 days later, at most one NE in between, and no iPR after iCR" + ), + dataset_name = "ovr", + join_vars = exprs(AVALC, ADT), + join_type = "after", + first_cond = AVALC.join %in% c("iCR", "iPR") & + ADT.join >= ADT + confirmation_period, + condition = AVALC == "iPR" & + all(AVALC.join %in% c("iCR", "iPR", "NE")) & + count_vals(var = AVALC.join, val = "NE") <= 1 & + ( + min_cond( + var = ADT.join, + cond = AVALC.join == "iCR" + ) > max_cond(var = ADT.join, cond = AVALC.join == "iPR") | + count_vals(var = AVALC.join, val = "iCR") == 0 | + count_vals(var = AVALC.join, val = "iPR") == 0 + ), + set_values_to = exprs(AVALC = "iPR") +) + +no_data_n <- event( + description = "Define no response for all patients in adsl (should be used as last event)", + dataset_name = "adsl", + condition = TRUE, + set_values_to = exprs(AVALC = "N"), + keep_source_vars = adsl_vars +) + +no_data_missing <- event( + description = paste( + "Define missing response (MISSING) for all patients in adsl (should be used", + "as last event)" + ), + dataset_name = "adsl", + condition = TRUE, + set_values_to = exprs(AVALC = "MISSING"), + keep_source_vars = adsl_vars +) +``` + +## Derive Confirmed Progressive Disease Parameter {#pd} + +Now that we have the input records prepared above with any +company-specific requirements, we can start to derive new parameter +records. For the parameter derivations, all values except those +overwritten by `set_values_to` argument are kept from the earliest +occurring input record fulfilling the required criteria. + +The function `admiral::derive_extreme_records()` can be used to find +the date of first `iCPD`. + +```{r} +adrs <- adrs %>% + derive_extreme_records( + dataset_ref = adsl, + dataset_add = adrs, + by_vars = exprs(STUDYID, USUBJID), + filter_add = PARAMCD == "OVR" & AVALC == "iCPD" & ANL01FL == "Y", + order = exprs(ADT, RSSEQ), + mode = "first", + exist_flag = AVALC, + set_values_to = exprs( + PARAMCD = "ICPD", + PARAM = "Immune Confirmation of Disease Progression by Investigator", + PARCAT1 = "Tumor Response", + PARCAT2 = "Investigator", + PARCAT3 = "iRecist", + AVAL = yn_to_numeric(AVALC), + ANL01FL = "Y" + ) + ) +``` + +```{r, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, AVISIT, PARAMCD, PARAM, AVALC, ADT, ANL01FL), + filter = PARAMCD == "ICPD" +) +``` + +For progressive disease response shown in steps here and below, in our +examples we show these as `ADRS` parameters, but they could equally be +achieved via `ADSL` dates or `ADEVENT` parameters.If you prefer to store +as an ADSL date, then the function `admiral::derive_var_extreme_dt()` +could be used to find the date of first `iCPD` as a variable, rather than +as a new parameter record. + +## Derive Response Parameter {#rsp} + +The function `admiral::derive_extreme_event()` can then be used to find the date +of first response. In the below example, the response condition has been defined +as `iCR` or `iPR` via the event `irsp_y` that was created for iRECIST. + + + +```{r} +irsp_y <- event( + description = "Define iCR or iPR as (unconfirmed) response", + dataset_name = "ovr", + condition = AVALC %in% c("iCR", "iPR"), + set_values_to = exprs(AVALC = "Y") +) +``` + +```{r} +adrs <- adrs %>% + derive_extreme_event( + by_vars = exprs(STUDYID, USUBJID), + order = exprs(ADT), + mode = "first", + events = list(irsp_y, no_data_n), + source_datasets = list( + ovr = ovr, + adsl = adsl + ), + set_values_to = exprs( + PARAMCD = "IRSP", + PARAM = "Immune Response by Investigator (confirmation not required)", + PARCAT1 = "Tumor Response", + PARCAT2 = "Investigator", + PARCAT3 = "iRecist", + AVAL = yn_to_numeric(AVALC), + ANL01FL = "Y" + ) + ) +``` + +```{r, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, AVISIT, PARAMCD, PARAM, AVALC, ADT, ANL01FL), + filter = PARAMCD == "IRSP" +) +``` + +## Derive Clinical Benefit Parameter {#cb} + +The function `admiral::derive_extreme_event()` can then be used to derive the +clinical benefit parameter, which we define as a patient having had a response +or a sustained period of time before first `iCPD`. This could also be known as +disease control. In this example the "sustained period" has been defined as 42 +days after randomization date via the created `icb_y` event. + + +```{r} +icb_y <- event( + description = paste( + "Define iCR, iPR, iSD, or NON-iCR/NON-iPD occuring at least 42 days after", + "randomization as clinical benefit" + ), + dataset_name = "ovr", + condition = AVALC %in% c("iCR", "iPR", "iSD", "NON-iCR/NON-iUPD") & + ADT >= RANDDT + 42, + set_values_to = exprs(AVALC = "Y") +) +``` + +Please note that the result `AVALC = "Y"` is defined by the first _two_ events +specified for `events`. For subjects with observations fulfilling both events +the one with the earlier date should be selected (and not the first one in the +list). Thus `ignore_event_order = TRUE` is specified. + +```{r} +adrs <- adrs %>% + derive_extreme_event( + by_vars = exprs(STUDYID, USUBJID), + order = exprs(desc(AVALC), ADT), + mode = "first", + events = list(irsp_y, icb_y, no_data_n), + source_datasets = list( + ovr = ovr, + adsl = adsl + ), + ignore_event_order = TRUE, + set_values_to = exprs( + PARAMCD = "ICB", + PARAM = "Immune Clinical Benefit by Investigator (confirmation for response not required)", + PARCAT1 = "Tumor Response", + PARCAT2 = "Investigator", + PARCAT3 = "iRecist", + AVAL = yn_to_numeric(AVALC), + ANL01FL = "Y" + ), + check_type = "none" + ) +``` + +```{r, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, AVISIT, PARAMCD, PARAM, AVALC, ADT, RANDDT, ANL01FL), + filter = PARAMCD == "ICB" +) +``` + +## Derive Best Overall Response Parameter {#bor} + +The function `admiral::derive_extreme_event()` can be used to derive the best +overall response (without confirmation required) parameter. Similar to the above +function you can optionally decide what period would you consider an `iSD` or +`NON-iCR/NON-iUPD` as being eligible from. In this example, 42 days after +randomization date has been used again. + +Please note that the order of the events specified for `events` is important. +For example, a subject with `iPR`, `iPR`, `iCR` qualifies for both `ibor_icr` and +`ibor_ipr`. As `ibor_icr` is listed before `ibor_ipr`, `iCR` is selected as best overall +response for this subject. + +```{r} +ibor_icr <- event( + description = "Define complete response (iCR) for best overall response (iBOR)", + dataset_name = "ovr", + condition = AVALC == "iCR", + set_values_to = exprs(AVALC = "iCR") +) + +ibor_ipr <- event( + description = "Define partial response (iPR) for best overall response (iBOR)", + dataset_name = "ovr", + condition = AVALC == "iPR", + set_values_to = exprs(AVALC = "iPR") +) + +ibor_isd <- event( + description = paste( + "Define stable disease (iSD) for best overall response (iBOR) as iCR, iPR, or iSD", + "occurring at least 42 days after randomization" + ), + dataset_name = "ovr", + condition = AVALC %in% c("iCR", "iPR", "iSD") & ADT >= RANDDT + 42, + set_values_to = exprs(AVALC = "iSD") +) + +ibor_non_icripd <- event( + description = paste( + "Define NON-iCR/NON-iUPD for best overall response (iBOR) as NON-iCR/NON-iUPD", + "occuring at least 42 days after randomization" + ), + dataset_name = "ovr", + condition = AVALC == "NON-iCR/NON-iUPD" & ADT >= RANDDT + 42, + set_values_to = exprs(AVALC = "NON-iCR/NON-iUPD") +) + +ibor_icpd <- event( + description = "Define progressive disease (iCPD) for best overall response (iBOR)", + dataset_name = "ovr", + condition = AVALC == "iCPD", + set_values_to = exprs(AVALC = "iCPD") +) + +ibor_iupd <- event( + description = "Define progressive disease (iUPD) for best overall response (iBOR)", + dataset_name = "ovr", + condition = AVALC == "iUPD", + set_values_to = exprs(AVALC = "iUPD") +) + +ibor_ne <- event( + description = paste( + "Define not evaluable (NE) for best overall response (iBOR) as iSD, NON-iCR/NON-iUPD,", + "or NE (should be specified after ibor_isd and ibor_non_icripd)" + ), + dataset_name = "ovr", + condition = AVALC %in% c("iSD", "NON-iCR/NON-iUPD", "NE"), + set_values_to = exprs(AVALC = "NE") +) + + +adrs <- adrs %>% + derive_extreme_event( + by_vars = exprs(STUDYID, USUBJID), + order = exprs(ADT), + mode = "first", + source_datasets = list( + ovr = ovr, + adsl = adsl + ), + events = list(ibor_icr, ibor_ipr, ibor_isd, ibor_non_icripd, ibor_icpd, ibor_iupd, ibor_ne, no_data_missing), + set_values_to = exprs( + PARAMCD = "IBOR", + PARAM = "Immune Best Overall Response by Investigator (confirmation not required)", + PARCAT1 = "Tumor Response", + PARCAT2 = "Investigator", + PARCAT3 = "iRecist", + AVAL = aval_resp_new(AVALC), + ANL01FL = "Y" + ) + ) +``` + +```{r, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, AVISIT, PARAMCD, PARAM, AVALC, ADT, RANDDT, ANL01FL), + filter = PARAMCD == "IBOR" +) +``` + +## Derive Response Parameters requiring Confirmation {#confirm} + +Any of the above response parameters can be repeated for "confirmed" responses +only. For these the function `admiral::derive_extreme_event()` can be used with +different events. Some of the other functions from above can then be re-used +passing in these confirmed response records. See the examples below of derived +parameters requiring confirmation. The assessment and the confirmatory +assessment here need to occur at least 28 days apart *(without any +1 applied to +this calculation of days between visits)*, using the `icrsp_y_cr`[^1], +`icrsp_y_ipr`[^2], `icbor_icr`[^3], and `icbor_ipr`[^4] event. + +[^1]: +```{r} +icrsp_y_icr <- event_joined( + description = paste( + "Define confirmed response as iCR followed by CR at least 28 days later and", + "at most one NE in between" + ), + dataset_name = "ovr", + join_vars = exprs(AVALC, ADT), + join_type = "after", + order = exprs(ADT), + first_cond = AVALC.join == "CR" & + ADT.join >= ADT + days(28), + condition = AVALC == "iCR" & + all(AVALC.join %in% c("iCR", "NE")) & + count_vals(var = AVALC.join, val = "NE") <= 1, + set_values_to = exprs(AVALC = "Y") +) +``` +[^2]: +```{r} +icrsp_y_ipr <- event_joined( + description = paste( + "Define confirmed response as iPR followed by iCR or PR at least 28 days later,", + "at most one NE in between, and no iPR after iCR" + ), + dataset_name = "ovr", + join_vars = exprs(AVALC, ADT), + join_type = "after", + order = exprs(ADT), + first_cond = AVALC.join %in% c("iCR", "iPR") & + ADT.join >= ADT + days(28), + condition = AVALC == "iPR" & + all(AVALC.join %in% c("iCR", "iPR", "NE")) & + count_vals(var = AVALC.join, val = "NE") <= 1 & + ( + min_cond( + var = ADT.join, + cond = AVALC.join == "iCR" + ) > max_cond(var = ADT.join, cond = AVALC.join == "iPR") | + count_vals(var = AVALC.join, val = "iCR") == 0 | + count_vals(var = AVALC.join, val = "iPR") == 0 + ), + set_values_to = exprs(AVALC = "Y") +) +``` +[^3]: +```{r} +icbor_icr <- event_joined( + description = paste( + "Define complete response (iCR) for confirmed best overall response (ICBOR) as", + "iCR followed by iCR at least 28 days later and at most one NE in between" + ), + dataset_name = "ovr", + join_vars = exprs(AVALC, ADT), + join_type = "after", + first_cond = AVALC.join == "iCR" & + ADT.join >= ADT + 28, + condition = AVALC == "iCR" & + all(AVALC.join %in% c("iCR", "NE")) & + count_vals(var = AVALC.join, val = "NE") <= 1, + set_values_to = exprs(AVALC = "iCR") +) +``` +[^4]: +```{r} +icbor_ipr <- event_joined( + description = paste( + "Define partial response (iPR) for confirmed best overall response (ICBOR) as", + "iPR followed by iCR or iPR at least 28 days later, at most one NE in between,", + "and no iPR after iCR" + ), + dataset_name = "ovr", + join_vars = exprs(AVALC, ADT), + join_type = "after", + first_cond = AVALC.join %in% c("iCR", "iPR") & + ADT.join >= ADT + 28, + condition = AVALC == "iPR" & + all(AVALC.join %in% c("iCR", "iPR", "NE")) & + count_vals(var = AVALC.join, val = "NE") <= 1 & + ( + min_cond( + var = ADT.join, + cond = AVALC.join == "iCR" + ) > max_cond(var = ADT.join, cond = AVALC.join == "iPR") | + count_vals(var = AVALC.join, val = "iCR") == 0 | + count_vals(var = AVALC.join, val = "iPR") == 0 + ), + set_values_to = exprs(AVALC = "iPR") +) +``` + +Please note that the result `AVALC = "Y"` for confirmed clinical benefit is +defined by the first _two_ events specified for `events`. For subjects with +observations fulfilling both events the one with the earlier date should be +selected (and not the first one in the list). Thus `ignore_event_order = TRUE` +is specified. + +```{r} +adrs <- adrs %>% + derive_extreme_event( + by_vars = exprs(STUDYID, USUBJID), + order = exprs(desc(AVALC), ADT), + mode = "first", + source_datasets = list( + ovr = ovr, + adsl = adsl + ), + events = list(icrsp_y_icr, icrsp_y_ipr, no_data_n), + ignore_event_order = TRUE, + set_values_to = exprs( + PARAMCD = "ICRSP", + PARAM = "Immune Response by Investigator (confirmation required)", + PARCAT1 = "Tumor Response", + PARCAT2 = "Investigator", + PARCAT3 = "iRecist", + AVAL = yn_to_numeric(AVALC), + ANL01FL = "Y" + ) + ) + +adrs <- adrs %>% + derive_extreme_event( + by_vars = exprs(STUDYID, USUBJID), + order = exprs(desc(AVALC), ADT), + mode = "first", + events = list(icrsp_y_icr, icrsp_y_ipr, icb_y, no_data_n), + source_datasets = list( + ovr = ovr, + adsl = adsl + ), + ignore_event_order = TRUE, + set_values_to = exprs( + PARAMCD = "ICCB", + PARAM = "Immune Clinical Benefit by Investigator (confirmation required)", + PARCAT1 = "Tumor Response", + PARCAT2 = "Investigator", + PARCAT3 = "iRecist", + AVAL = yn_to_numeric(AVALC), + ANL01FL = "Y" + ), + check_type = "none" + ) + +adrs <- adrs %>% + derive_extreme_event( + by_vars = exprs(STUDYID, USUBJID), + order = exprs(ADT), + mode = "first", + events = list(icbor_icr, icbor_ipr, ibor_isd, ibor_non_icripd, ibor_icpd, ibor_iupd, ibor_ne, no_data_missing), + source_datasets = list( + ovr = ovr, + adsl = adsl + ), + set_values_to = exprs( + PARAMCD = "ICBOR", + PARAM = "Immune Best Overall Response by Investigator (confirmation required)", + PARCAT1 = "Tumor Response", + PARCAT2 = "Investigator", + PARCAT3 = "Recist 1.1", + AVAL = aval_resp(AVALC), + ANL01FL = "Y" + ) + ) +``` + +```{r, echo=FALSE} +dataset_vignette( + adrs, + display_vars = exprs(USUBJID, AVISIT, PARAMCD, PARAM, AVALC, ADT, RANDDT, ANL01FL), + filter = PARAMCD %in% c("ICRSP", "ICCB", "ICBOR") +) +``` From 1e76de7ef7e6814496a46a2a40dcc87a30d57cb7 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Thu, 9 Nov 2023 11:46:03 +0000 Subject: [PATCH 02/40] #256 admiral_updates: updates due to changes in "joined" functions --- R/check_crpr.R | 6 ++++-- R/derive_param_confirmed_bor.R | 10 ++++++---- R/derive_param_confirmed_resp.R | 10 ++++++---- vignettes/adtr.Rmd | 1 + 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/R/check_crpr.R b/R/check_crpr.R index 931579be..45640ce8 100644 --- a/R/check_crpr.R +++ b/R/check_crpr.R @@ -61,21 +61,23 @@ signal_crpr <- function(dataset, crpr_data <- filter_joined( dataset, + dataset_add = dataset, by_vars = subject_keys, order = order, join_vars = exprs(AVALC), join_type = "after", - filter = AVALC == "CR" & AVALC.join == "PR" + filter_join = AVALC == "CR" & AVALC.join == "PR" ) if (nrow(crpr_data) > 0) { pr_data <- filter_joined( dataset, + dataset_add = dataset, by_vars = subject_keys, order = order, join_vars = exprs(AVALC), join_type = "before", - filter = AVALC == "PR" & AVALC.join == "CR" + filter_join = AVALC == "PR" & AVALC.join == "CR" ) crpr_data <- bind_rows(crpr_data, pr_data) %>% diff --git a/R/derive_param_confirmed_bor.R b/R/derive_param_confirmed_bor.R index 595d9780..0e4401cc 100644 --- a/R/derive_param_confirmed_bor.R +++ b/R/derive_param_confirmed_bor.R @@ -410,13 +410,14 @@ derive_param_confirmed_bor <- function(dataset, # Create observations for potential responses cr_data <- filter_joined( source_data, + dataset_add = source_data, by_vars = subject_keys, join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join == "CR" & + first_cond_upper = AVALC.join == "CR" & ADT.join >= ADT + days(!!ref_confirm), - filter = AVALC == "CR" & + filter_join = AVALC == "CR" & all(AVALC.join %in% c("CR", "NE")) & count_vals(var = AVALC.join, val = "NE") <= !!max_nr_ne ) %>% @@ -429,13 +430,14 @@ derive_param_confirmed_bor <- function(dataset, } pr_data <- filter_joined( source_data, + dataset_add = source_data, by_vars = subject_keys, join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join %in% c("CR", "PR") & + first_cond_upper = AVALC.join %in% c("CR", "PR") & ADT.join >= ADT + days(!!ref_confirm), - filter = AVALC == "PR" & + filter_join = AVALC == "PR" & all(AVALC.join %in% c("CR", "PR", "SD", "NE")) & count_vals(var = AVALC.join, val = "NE") <= !!max_nr_ne & count_vals(var = AVALC.join, val = "SD") <= !!max_nr_sd & diff --git a/R/derive_param_confirmed_resp.R b/R/derive_param_confirmed_resp.R index deb38621..6629db52 100644 --- a/R/derive_param_confirmed_resp.R +++ b/R/derive_param_confirmed_resp.R @@ -342,13 +342,14 @@ derive_param_confirmed_resp <- function(dataset, # Create observations for potential responses cr_data <- filter_joined( source_data, + dataset_add = source_data, by_vars = subject_keys, join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join == "CR" & + first_cond_upper = AVALC.join == "CR" & ADT.join >= ADT + days(!!ref_confirm), - filter = AVALC == "CR" & + filter_join = AVALC == "CR" & all(AVALC.join %in% c("CR", "NE")) & count_vals(var = AVALC.join, val = "NE") <= !!max_nr_ne ) %>% @@ -363,13 +364,14 @@ derive_param_confirmed_resp <- function(dataset, } pr_data <- filter_joined( source_data, + dataset_add = source_data, by_vars = subject_keys, join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join %in% c("CR", "PR") & + first_cond_upper = AVALC.join %in% c("CR", "PR") & ADT.join >= ADT + days(!!ref_confirm), - filter = AVALC == "PR" & + filter_join = AVALC == "PR" & all(AVALC.join %in% c("CR", "PR", "SD", "NE")) & count_vals(var = AVALC.join, val = "NE") <= !!max_nr_ne & count_vals(var = AVALC.join, val = "SD") <= !!max_nr_sd & diff --git a/vignettes/adtr.Rmd b/vignettes/adtr.Rmd index 6f5be879..b8855ba7 100644 --- a/vignettes/adtr.Rmd +++ b/vignettes/adtr.Rmd @@ -447,6 +447,7 @@ adtr_sum <- adtr_sum %>% order = exprs(AVAL), new_vars = exprs(NADIR = AVAL), join_vars = exprs(ADY), + join_type = "all", filter_add = ANL01FL == "Y", filter_join = ADY.join < ADY, mode = "first", From 0acac773e22961c24905506bc7ded0f7f2586ba8 Mon Sep 17 00:00:00 2001 From: cicdguy <26552821+cicdguy@users.noreply.github.com> Date: Thu, 9 Nov 2023 10:34:32 -0600 Subject: [PATCH 03/40] Add history section and article for previous versions --- .github/workflows/common.yml | 2 +- _pkgdown.yml | 12 +++- vignettes/articles/website-versions.Rmd | 82 +++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 vignettes/articles/website-versions.Rmd diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 8af3e029..00675f56 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -93,7 +93,7 @@ jobs: # Whether to skip multiversion docs # Note that if you have multiple versions of docs, # your URL links are likely to break due to path changes - skip-multiversion-docs: false + skip-multiversion-docs: true latest-tag-alt-name: main multiversion-docs-landing-page: main branches-or-tags-to-list: >- diff --git a/_pkgdown.yml b/_pkgdown.yml index 2ec516ae..daa3a266 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -14,6 +14,10 @@ repo: user: https://github.com/ news: cran_dates: true + +development: + mode: auto + reference: - title: Derivations for Adding Parameters @@ -56,8 +60,8 @@ reference: navbar: structure: - left: [getstarted, reference, articles, news] - right: [search, slack, newissue, github] + left: [getstarted, reference, articles, news, versions] + right: [search, slack, history, newissue, github] components: getstarted: text: Get Started @@ -78,6 +82,10 @@ navbar: href: articles/adtr.html - text: Creating and Using New Anti-Cancer Start Date href: articles/nactdt.html + history: + icon: fa-history + href: articles/website-versions.html + aria-label: Previous Release Websites slack: icon: fa-slack href: https://app.slack.com/client/T028PB489D3/C02M8KN8269 diff --git a/vignettes/articles/website-versions.Rmd b/vignettes/articles/website-versions.Rmd new file mode 100644 index 00000000..5143f6d2 --- /dev/null +++ b/vignettes/articles/website-versions.Rmd @@ -0,0 +1,82 @@ +--- +title: "Previous Versions of Website" +--- + +```{r, include = FALSE} +# TO USE THIS ARTICLE, THE DESCRIPTION FILE MUST INCLUDE +# Config/Needs/website: gert +# Make sure to copy the gh-pages branch to your local git + +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +```{r setup, include=FALSE} +base_url <- + "https://pharmaverse.github.io/admiralonco/" # include the trailing backslash! + +# get list of all files in the `gh-pages` branch +df_all_files <- tryCatch(gert::git_ls(ref = "gh-pages"), error = function(x) FALSE) + +# if a local user (not on CI) does not have a copy of the `gh-pages` branch, exit silently +if (!isTRUE(as.logical(Sys.getenv("CI"))) && isFALSE(df_all_files)) { + knitr::knit_exit() +} +``` + +```{r include=FALSE} +# extract all folders in the root of the branch +all_folders <- + sub("/.*", "", df_all_files$path)[grepl( + x = df_all_files$path, + pattern = "/", + fixed = TRUE + )] |> + unique() + +# subset to all version folders +all_version_folders <- + all_folders[grep("^v[0-9]+|dev", x = all_folders)] |> + rev() +# more dev first if it appears +if ("dev" %in% all_version_folders) { + all_version_folders <- c("dev", all_version_folders) |> unique() +} + +# release dates of prior tags +df_tags <- gert::git_tag_list() +df_tags <- df_tags[df_tags$name %in% all_version_folders, ] +df_tags$date <- + lapply( + df_tags$commit, + FUN = function(x) { + tryCatch( + gert::git_commit_info(ref = x)$time |> as.Date() |> as.character(), + error = function(x) NA + ) + } + ) |> + unlist() +df_tags <- df_tags[!is.na(df_tags$date), ] + +lst_tag_dates <- + paste0(" (", df_tags$date, ")") |> + as.list() |> + setNames(df_tags$name) + +# string with all markdown links +str_website_links <- + lapply( + X = all_version_folders, + FUN = function(x) { + x_label <- ifelse(x %in% "dev", "Development Site", x) + paste0("[", x_label, lst_tag_dates[[x]], "](", paste0(base_url, x), ")") + } + ) |> + unlist() |> + paste(collapse = "\n\n") +``` + +`r str_website_links` From c45366cdec63285ead3959ce45c043240932b8ab Mon Sep 17 00:00:00 2001 From: cicdguy <26552821+cicdguy@users.noreply.github.com> Date: Thu, 9 Nov 2023 10:43:07 -0600 Subject: [PATCH 04/40] Remove dynamic linking functionality --- README.Rmd | 32 -------------------------------- README.md | 1 - 2 files changed, 33 deletions(-) diff --git a/README.Rmd b/README.Rmd index 9d952987..59c3ecf3 100644 --- a/README.Rmd +++ b/README.Rmd @@ -4,39 +4,7 @@ output: md_document date: '2022-10-04' --- -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE) -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = TRUE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral" -``` - - # admiralonco diff --git a/README.md b/README.md index 289c1725..027bd8a2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ - # admiralonco From 7fad1bbb5ec9976124aa42a19b90ed4d541b71e7 Mon Sep 17 00:00:00 2001 From: cicdguy <26552821+cicdguy@users.noreply.github.com> Date: Thu, 9 Nov 2023 11:09:26 -0600 Subject: [PATCH 05/40] Remove dynamic linking functionality --- vignettes/admiralonco.Rmd | 29 +---------------------------- vignettes/adrs.Rmd | 31 +------------------------------ vignettes/adrs_basic.Rmd | 31 +------------------------------ vignettes/adtr.Rmd | 30 +----------------------------- vignettes/adtte.Rmd | 32 ++------------------------------ vignettes/nactdt.Rmd | 28 ---------------------------- 6 files changed, 6 insertions(+), 175 deletions(-) diff --git a/vignettes/admiralonco.Rmd b/vignettes/admiralonco.Rmd index 33347b16..b75dcebb 100644 --- a/vignettes/admiralonco.Rmd +++ b/vignettes/admiralonco.Rmd @@ -12,39 +12,12 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" ``` # Introduction As this is a package extension, if you are new to `{admiral}` then the best place to first start -reading would be this `r dyn_link("Get Started", admiral_homepage, "articles/admiral.html")` +reading would be this [Get Started](https://pharmaverse.github.io/admiral/articles/admiral.html) guide. This extension package follows the same main idea and conventions, and re-uses many functions from `{admiral}`, so it is important to thoroughly understand these to be able to use `{admiralonco}`. diff --git a/vignettes/adrs.Rmd b/vignettes/adrs.Rmd index 2dc5b14d..40da390b 100644 --- a/vignettes/adrs.Rmd +++ b/vignettes/adrs.Rmd @@ -15,35 +15,6 @@ knitr::opts_chunk$set( ) library(admiral) - -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" - library(admiraldev) ``` @@ -1109,4 +1080,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADRS | `r dyn_link("ad_adrs.R", "https://github.com/pharmaverse/admiralonco/blob", "inst/templates/ad_adrs.R", is_multiversion = TRUE)` +ADRS | [ad_adrs.R](https://github.com/pharmaverse/admiralonco/blob/main/inst/templates/ad_adrs.R) diff --git a/vignettes/adrs_basic.Rmd b/vignettes/adrs_basic.Rmd index 973ceba2..6f267b88 100644 --- a/vignettes/adrs_basic.Rmd +++ b/vignettes/adrs_basic.Rmd @@ -15,35 +15,6 @@ knitr::opts_chunk$set( ) library(admiral) - -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" - library(admiraldev) ``` @@ -872,4 +843,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADRS_BASIC | `r dyn_link("ad_adrs_basic.R", "https://github.com/pharmaverse/admiralonco/blob", "inst/templates/ad_adrs_basic.R", is_multiversion = TRUE)` +ADRS_BASIC | [ad_adrs_basic.R](https://github.com/pharmaverse/admiralonco/blob/main/inst/templates/ad_adrs_basic.R) diff --git a/vignettes/adtr.Rmd b/vignettes/adtr.Rmd index 6f5be879..b3593865 100644 --- a/vignettes/adtr.Rmd +++ b/vignettes/adtr.Rmd @@ -14,34 +14,6 @@ knitr::opts_chunk$set( comment = "#>" ) library(admiral) -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral" -library(admiraldev) ``` # Introduction @@ -745,7 +717,7 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -`ADTR` | `r dyn_link("ad_adtr.R", "https://github.com/pharmaverse/admiralonco/blob", "inst/templates/ad_adtr.R", is_multiversion = TRUE)` +`ADTR` | [ad_adtr.R](https://github.com/pharmaverse/admiralonco/blob/main/inst/templates/ad_adtr.R) diff --git a/vignettes/adtte.Rmd b/vignettes/adtte.Rmd index 34c26d54..99f08108 100644 --- a/vignettes/adtte.Rmd +++ b/vignettes/adtte.Rmd @@ -13,34 +13,6 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" - library(admiraldev) ``` @@ -219,7 +191,7 @@ dataset_vignette( ### Creating Your Own Time-to-Event Source Objects {#tteobj} We advise you consult the `{admiral}` -`r dyn_link("Creating a BDS Time-to-Event ADaM vignette", admiral_homepage, "articles/bds_tte.html")` +[Creating a BDS Time-to-Event ADaM vignette](https://pharmaverse.github.io/admiral/articles/bds_tte.html) for further guidance on the different options available and more examples. One extra common oncology case we include here is around PFS when censoring @@ -375,4 +347,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADTTE | `r dyn_link("ad_adtte.R", "https://github.com/pharmaverse/admiralonco/blob", "inst/templates/ad_adtte.R", is_multiversion = TRUE)` +ADTTE | [ad_adtte.R](https://github.com/pharmaverse/admiralonco/blob/main/inst/templates/ad_adtte.R) \ No newline at end of file diff --git a/vignettes/nactdt.Rmd b/vignettes/nactdt.Rmd index 94c5decf..bbe2c8b7 100644 --- a/vignettes/nactdt.Rmd +++ b/vignettes/nactdt.Rmd @@ -14,34 +14,6 @@ knitr::opts_chunk$set( comment = "#>" ) library(admiralonco) -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" - library(admiraldev) ``` From 70e5350a9ae045fa1b50ae3efc3b145e8305ca88 Mon Sep 17 00:00:00 2001 From: Vinh Nguyen Date: Wed, 15 Nov 2023 13:58:46 -0500 Subject: [PATCH 06/40] 233 - irecist vignette review update 1 --- vignettes/irecist.Rmd | 64 ++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index 77968cf5..957c8e38 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -52,13 +52,10 @@ library(admiraldev) This article describes creating an `ADRS` ADaM with oncology endpoint parameters based on iRECIST. It shows a similar way of deriving the endpoints presented in [Creating ADRS (Including Non-standard Endpoints)](adrs.html). Most of the endpoints -are derived by calling `admiral::derive_extreme_event()`. Thus the examples in this -vignette can also be used as a starting point for implementing response criteria other -than iRECIST 1.1, e.g., RECIST 1.1 or International Myeloma Working Group (IMWG) -criteria for the diagnosis of multiple myeloma. +are derived by calling `admiral::derive_extreme_event()`. For more information on the iRECIST guidelines user may visit -https://recist.eortc.org/recist-1-1-2/ +https://recist.eortc.org/irecist/ Examples are currently presented and tested using `ADSL` (ADaM) and `RS` (SDTM) inputs. However, other domains could be used. The functions @@ -76,6 +73,7 @@ unless otherwise specified.* - [Derive Clinical Benefit Parameter](#cb) - [Derive Best Overall Response Parameter](#bor) - [Derive Response Parameters requiring Confirmation](#confirm) +- [Other Endpoints](#Other) ## Read in Data {#readdata} @@ -95,9 +93,9 @@ library(pharmaversesdtm) library(lubridate) library(stringr) data("adsl") +# iRECIST oncology data data("rs_onco_irecist") -adsl_onco <- adsl rs <- rs_onco_irecist rs <- convert_blanks_to_na(rs) @@ -106,9 +104,9 @@ rs <- convert_blanks_to_na(rs) ```{r echo=FALSE} # select subjects from adsl such that there is one subject without RS data rs_subjects <- unique(rs$USUBJID) -adsl_subjects <- unique(adsl_onco$USUBJID) +adsl_subjects <- unique(adsl$USUBJID) adsl <- filter( - adsl_onco, + adsl, USUBJID %in% union(rs_subjects, setdiff(adsl_subjects, rs_subjects)[1]) ) ``` @@ -138,8 +136,11 @@ dataset_vignette( ## Pre-processing of Input Records {#input} The first step involves company-specific pre-processing of records for -the required input to the downstream parameter functions. It could involve -merging input data from other sources besides `RS`, such as `ADTR`. +the required input to the downstream parameter functions. Note that this +could be needed multiple times (e.g. once for investigator and once for +Independent Review Facility (IRF)/Blinded Independent Central Review +(BICR) records). It could even involve merging input data from other +sources besides `RS`, such as `ADTR`. This step would include any required selection/derivation of `ADT` or applying any necessary partial date imputations, updating `AVAL` (e.g. @@ -296,7 +297,7 @@ adrs <- adrs %>% ) ``` -### Flag Assessments up to First PD (`ANL02FL`) {#anl02fl} +### Flag Assessments up to First iCPD (`ANL02FL`) {#anl02fl} To restrict response data up to and including first reported progressive disease `ANL02FL` flag could be created by using `{admiral}` function @@ -372,7 +373,7 @@ icbor_ipr <- event_joined( "Define partial response (iPR) for confirmed best overall response (iCBOR) as", "iPR followed by iCR or iPR at least", confirmation_period, - "28 days later, at most one NE in between, and no iPR after iCR" + "days later, at most one NE in between, and no iPR after iCR" ), dataset_name = "ovr", join_vars = exprs(AVALC, ADT), @@ -454,7 +455,7 @@ dataset_vignette( ) ``` -For progressive disease response shown in steps here and below, in our +For progressive disease and response shown in steps here and below, in our examples we show these as `ADRS` parameters, but they could equally be achieved via `ADSL` dates or `ADEVENT` parameters.If you prefer to store as an ADSL date, then the function `admiral::derive_var_extreme_dt()` @@ -513,7 +514,7 @@ dataset_vignette( The function `admiral::derive_extreme_event()` can then be used to derive the clinical benefit parameter, which we define as a patient having had a response -or a sustained period of time before first `iCPD`. This could also be known as +or a sustained period of time before first `iUPD`. This could also be known as disease control. In this example the "sustained period" has been defined as 42 days after randomization date via the created `icb_y` event. @@ -521,7 +522,7 @@ days after randomization date via the created `icb_y` event. ```{r} icb_y <- event( description = paste( - "Define iCR, iPR, iSD, or NON-iCR/NON-iPD occuring at least 42 days after", + "Define iCR, iPR, iSD, or NON-iCR/NON-iUPD occuring at least 42 days after", "randomization as clinical benefit" ), dataset_name = "ovr", @@ -618,14 +619,14 @@ ibor_non_icripd <- event( ) ibor_icpd <- event( - description = "Define progressive disease (iCPD) for best overall response (iBOR)", + description = "Define confirmed progressive disease (iCPD) for best overall response (iBOR)", dataset_name = "ovr", condition = AVALC == "iCPD", set_values_to = exprs(AVALC = "iCPD") ) ibor_iupd <- event( - description = "Define progressive disease (iUPD) for best overall response (iBOR)", + description = "Define unconfirmed progressive disease (iUPD) for best overall response (iBOR)", dataset_name = "ovr", condition = AVALC == "iUPD", set_values_to = exprs(AVALC = "iUPD") @@ -685,17 +686,18 @@ this calculation of days between visits)*, using the `icrsp_y_cr`[^1], [^1]: ```{r} +confirmation_period <- 28 icrsp_y_icr <- event_joined( description = paste( - "Define confirmed response as iCR followed by CR at least 28 days later and", + "Define confirmed response as iCR followed by iCR at least 28 days later and", "at most one NE in between" ), dataset_name = "ovr", join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join == "CR" & - ADT.join >= ADT + days(28), + first_cond = AVALC.join == "iCR" & + ADT.join >= ADT + days(confirmation_period), condition = AVALC == "iCR" & all(AVALC.join %in% c("iCR", "NE")) & count_vals(var = AVALC.join, val = "NE") <= 1, @@ -704,9 +706,10 @@ icrsp_y_icr <- event_joined( ``` [^2]: ```{r} +confirmation_period <- 28 icrsp_y_ipr <- event_joined( description = paste( - "Define confirmed response as iPR followed by iCR or PR at least 28 days later,", + "Define confirmed response as iPR followed by iCR or iPR at least 28 days later,", "at most one NE in between, and no iPR after iCR" ), dataset_name = "ovr", @@ -714,7 +717,7 @@ icrsp_y_ipr <- event_joined( join_type = "after", order = exprs(ADT), first_cond = AVALC.join %in% c("iCR", "iPR") & - ADT.join >= ADT + days(28), + ADT.join >= ADT + days(confirmation_period), condition = AVALC == "iPR" & all(AVALC.join %in% c("iCR", "iPR", "NE")) & count_vals(var = AVALC.join, val = "NE") <= 1 & @@ -731,16 +734,17 @@ icrsp_y_ipr <- event_joined( ``` [^3]: ```{r} +confirmation_period <- 28 icbor_icr <- event_joined( description = paste( - "Define complete response (iCR) for confirmed best overall response (ICBOR) as", + "Define complete response (iCR) for confirmed best overall response (iCBOR) as", "iCR followed by iCR at least 28 days later and at most one NE in between" ), dataset_name = "ovr", join_vars = exprs(AVALC, ADT), join_type = "after", first_cond = AVALC.join == "iCR" & - ADT.join >= ADT + 28, + ADT.join >= ADT + confirmation_period, condition = AVALC == "iCR" & all(AVALC.join %in% c("iCR", "NE")) & count_vals(var = AVALC.join, val = "NE") <= 1, @@ -749,9 +753,10 @@ icbor_icr <- event_joined( ``` [^4]: ```{r} +confirmation_period <- 28 icbor_ipr <- event_joined( description = paste( - "Define partial response (iPR) for confirmed best overall response (ICBOR) as", + "Define partial response (iPR) for confirmed best overall response (iCBOR) as", "iPR followed by iCR or iPR at least 28 days later, at most one NE in between,", "and no iPR after iCR" ), @@ -759,7 +764,7 @@ icbor_ipr <- event_joined( join_vars = exprs(AVALC, ADT), join_type = "after", first_cond = AVALC.join %in% c("iCR", "iPR") & - ADT.join >= ADT + 28, + ADT.join >= ADT + confirmation_period, condition = AVALC == "iPR" & all(AVALC.join %in% c("iCR", "iPR", "NE")) & count_vals(var = AVALC.join, val = "NE") <= 1 & @@ -842,17 +847,20 @@ adrs <- adrs %>% PARAM = "Immune Best Overall Response by Investigator (confirmation required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "iRecist", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) ) ``` -```{r, echo=FALSE} +```{r, eval=TRUE, echo=FALSE} dataset_vignette( adrs, display_vars = exprs(USUBJID, AVISIT, PARAMCD, PARAM, AVALC, ADT, RANDDT, ANL01FL), filter = PARAMCD %in% c("ICRSP", "ICCB", "ICBOR") ) ``` +## Other Endpoints {#other} + +For additional endpoints that can be added please see [Creating ADRS (Including Non-standard Endpoints)](adrs.html). From 10f3aa4cd57fe99e6956671cfb76c7a9a0d7460e Mon Sep 17 00:00:00 2001 From: Vinh Nguyen Date: Sun, 19 Nov 2023 20:41:19 -0500 Subject: [PATCH 07/40] 233 - iRECIST vignette - addressed 1st round comments --- vignettes/irecist.Rmd | 221 ++++++++++++++++++++++-------------------- 1 file changed, 116 insertions(+), 105 deletions(-) diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index 957c8e38..ad42eae3 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -54,12 +54,16 @@ based on iRECIST. It shows a similar way of deriving the endpoints presented in [Creating ADRS (Including Non-standard Endpoints)](adrs.html). Most of the endpoints are derived by calling `admiral::derive_extreme_event()`. -For more information on the iRECIST guidelines user may visit +This vignette follows the iRECIST guidelines, for more information user may visit https://recist.eortc.org/irecist/ Examples are currently presented and tested using `ADSL` (ADaM) and -`RS` (SDTM) inputs. However, other domains could be used. The functions -and workflow could similarly be used to create an intermediary `ADEVENT` ADaM. +`RS` (SDTM) inputs. However, other domains could be used. The `RS` test data +contains iRECIST response for target, non-target and overall response. Further +pre-processing and considerations may be needed if iRECIST are only collected +after RECIST 1.1 progression and input data contains multiple response criteria. +The functions and workflow could similarly be used to create an intermediary +`ADEVENT` ADaM. **Note**: *All examples assume CDISC SDTM and/or ADaM format as input unless otherwise specified.* @@ -93,7 +97,7 @@ library(pharmaversesdtm) library(lubridate) library(stringr) data("adsl") -# iRECIST oncology data +# iRECIST oncology sdtm data data("rs_onco_irecist") rs <- rs_onco_irecist @@ -178,7 +182,7 @@ adrs <- adrs %>% PARAM = "Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "iRecist" + PARCAT3 = "iRECIST" ) ``` @@ -230,8 +234,8 @@ aval_resp_new <- function(arg) { arg == "iPR" ~ 7, arg == "iSD" ~ 6, arg == "NON-iCR/NON-iUPD" ~ 5, - arg == "iCPD" ~ 4, - arg == "iUPD" ~ 3, + arg == "iUPD" ~ 4, + arg == "iCPD" ~ 3, arg == "NE" ~ 2, arg == "MISSING" ~ 1, TRUE ~ NA_real_ @@ -270,7 +274,7 @@ adrs <- adrs %>% new_var = ANL01FL, mode = "last" ), - filter = !is.na(AVAL) & ADT >= RANDDT + filter = !is.na(AVAL) & AVALC !="MISSING" & ADT >= RANDDT ) ``` @@ -326,7 +330,7 @@ dataset_vignette( ### Select Source Assessments for Parameter derivations For most parameter derivations the post-baseline overall response assessments up -to and including first PD are considered. +to and including first iCPD are considered. ```{r} ovr <- filter(adrs, PARAMCD == "OVR" & ANL01FL == "Y" & ANL02FL == "Y") ``` @@ -344,54 +348,33 @@ The building blocks for the events that contribute to deriving common endpoints like what constitutes a responder, or a Best Overall Response of complete response (CR), ... are predefined in admiralonco for Recist 1.1 (see [Pre-Defined Response Event Objects](../reference/event_objects.html)). New Response Event Objects -are needed for iRECIST and any study-specific needs. Here the confirmation period -and the `keep_source_vars` argument is updated, as well as the `first_cond` and `condition` for the iRECIST values. +are needed for iRECIST and any study-specific needs. ```{r} -confirmation_period <- 21 - -icbor_icr <- event_joined( +icpd_y <- event_joined( description = paste( - "Define complete response (iCR) for confirmed best overall response (iCBOR) as", - "iCR followed by iCR at least", - confirmation_period, - "days later and at most one NE in between" + "Define confirmed progressive disease (iCPD) as", + "iUPD followed by iCPD with only other iUPD and NE responses in between" ), dataset_name = "ovr", join_vars = exprs(AVALC, ADT), join_type = "after", - first_cond = AVALC.join == "iCR" & - ADT.join >= ADT + confirmation_period, - condition = AVALC == "iCR" & - all(AVALC.join %in% c("iCR", "NE")) & - count_vals(var = AVALC.join, val = "NE") <= 1, - set_values_to = exprs(AVALC = "iCR") + first_cond_upper = AVALC.join == "iCPD", + condition = AVALC == "iUPD" & + all(AVALC.join %in% c("iCPD", "iUPD", "NE" )), + set_values_to = exprs(AVALC = "Y") ) -icbor_ipr <- event_joined( +iupd_y <- event_joined( description = paste( - "Define partial response (iPR) for confirmed best overall response (iCBOR) as", - "iPR followed by iCR or iPR at least", - confirmation_period, - "days later, at most one NE in between, and no iPR after iCR" + "Define unconfirmed progressive disease (iUPD) as", + "iUPD followed only by other iUPD or NE responses" ), dataset_name = "ovr", join_vars = exprs(AVALC, ADT), - join_type = "after", - first_cond = AVALC.join %in% c("iCR", "iPR") & - ADT.join >= ADT + confirmation_period, - condition = AVALC == "iPR" & - all(AVALC.join %in% c("iCR", "iPR", "NE")) & - count_vals(var = AVALC.join, val = "NE") <= 1 & - ( - min_cond( - var = ADT.join, - cond = AVALC.join == "iCR" - ) > max_cond(var = ADT.join, cond = AVALC.join == "iPR") | - count_vals(var = AVALC.join, val = "iCR") == 0 | - count_vals(var = AVALC.join, val = "iPR") == 0 - ), - set_values_to = exprs(AVALC = "iPR") + join_type = "all", + condition = ADT <= ADT.join & AVALC == "iUPD" & all(AVALC.join %in% c("iUPD", "NE")), + set_values_to = exprs(AVALC = "Y") ) no_data_n <- event( @@ -412,9 +395,10 @@ no_data_missing <- event( set_values_to = exprs(AVALC = "MISSING"), keep_source_vars = adsl_vars ) + ``` -## Derive Confirmed Progressive Disease Parameter {#pd} +## Derive Confirmed and Unconfirmed Progressive Disease Parameter {#pd} Now that we have the input records prepared above with any company-specific requirements, we can start to derive new parameter @@ -422,36 +406,69 @@ records. For the parameter derivations, all values except those overwritten by `set_values_to` argument are kept from the earliest occurring input record fulfilling the required criteria. -The function `admiral::derive_extreme_records()` can be used to find -the date of first `iCPD`. +When an `iCPD` occurs,the date would be that of the first `iUPD`. +The function `admiral::derive_extreme_records()`, in conjunction with the event `icpd_y`, +could be used to find the date of the first `iUPD`. + +For the Unconfirmed Progressive Disease Parameter, it can be of interest to look at `iUPD` that has +never been confirmed and no subsequent `iSD`, `iPR` or `iCR` has been observed. ```{r} adrs <- adrs %>% - derive_extreme_records( - dataset_ref = adsl, - dataset_add = adrs, + derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - filter_add = PARAMCD == "OVR" & AVALC == "iCPD" & ANL01FL == "Y", - order = exprs(ADT, RSSEQ), + order = exprs(ADT), mode = "first", - exist_flag = AVALC, + source_datasets = list( + ovr = ovr, + adsl = adsl + ), + events = list(icpd_y, no_data_n), set_values_to = exprs( PARAMCD = "ICPD", PARAM = "Immune Confirmation of Disease Progression by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "iRecist", + PARCAT3 = "iRECIST", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) ) + +ovr_orig <- ovr +ovr <- ovr %>% + group_by(USUBJID) %>% + filter(ADT >= max_cond(var = ADT, cond = AVALC == "iUPD")) %>% + ungroup(USUBJID) + +adrs <- adrs %>% + derive_extreme_event( + by_vars = exprs(STUDYID, USUBJID), + order = exprs(ADT), + mode = "first", + source_datasets = list( + ovr = ovr, + adsl = adsl + ), + events = list(iupd_y, no_data_n), + set_values_to = exprs( + PARAMCD = "IUPD", + PARAM = "Immune Unconfirmed Disease Progression by Investigator", + PARCAT1 = "Tumor Response", + PARCAT2 = "Investigator", + PARCAT3 = "iRECIST", + AVAL = yn_to_numeric(AVALC), + ANL01FL = "Y" + ) + ) +ovr <- ovr_orig ``` ```{r, echo=FALSE} dataset_vignette( adrs, display_vars = exprs(USUBJID, AVISIT, PARAMCD, PARAM, AVALC, ADT, ANL01FL), - filter = PARAMCD == "ICPD" + filter = PARAMCD %in% c("ICPD", "IUPD") ) ``` @@ -468,8 +485,6 @@ The function `admiral::derive_extreme_event()` can then be used to find the date of first response. In the below example, the response condition has been defined as `iCR` or `iPR` via the event `irsp_y` that was created for iRECIST. - - ```{r} irsp_y <- event( description = "Define iCR or iPR as (unconfirmed) response", @@ -477,9 +492,7 @@ irsp_y <- event( condition = AVALC %in% c("iCR", "iPR"), set_values_to = exprs(AVALC = "Y") ) -``` -```{r} adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), @@ -495,7 +508,7 @@ adrs <- adrs %>% PARAM = "Immune Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "iRecist", + PARCAT3 = "iRECIST", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -518,7 +531,6 @@ or a sustained period of time before first `iUPD`. This could also be known as disease control. In this example the "sustained period" has been defined as 42 days after randomization date via the created `icb_y` event. - ```{r} icb_y <- event( description = paste( @@ -535,7 +547,7 @@ icb_y <- event( Please note that the result `AVALC = "Y"` is defined by the first _two_ events specified for `events`. For subjects with observations fulfilling both events the one with the earlier date should be selected (and not the first one in the -list). Thus `ignore_event_order = TRUE` is specified. +list). Thus `ignore_event_order` and `tmp_event_nr_var` are not specified. ```{r} adrs <- adrs %>% @@ -548,13 +560,12 @@ adrs <- adrs %>% ovr = ovr, adsl = adsl ), - ignore_event_order = TRUE, set_values_to = exprs( PARAMCD = "ICB", PARAM = "Immune Clinical Benefit by Investigator (confirmation for response not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "iRecist", + PARCAT3 = "iRECIST", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ), @@ -608,7 +619,7 @@ ibor_isd <- event( set_values_to = exprs(AVALC = "iSD") ) -ibor_non_icripd <- event( +ibor_non_icriupd <- event( description = paste( "Define NON-iCR/NON-iUPD for best overall response (iBOR) as NON-iCR/NON-iUPD", "occuring at least 42 days after randomization" @@ -618,13 +629,22 @@ ibor_non_icripd <- event( set_values_to = exprs(AVALC = "NON-iCR/NON-iUPD") ) -ibor_icpd <- event( - description = "Define confirmed progressive disease (iCPD) for best overall response (iBOR)", + +ibor_icpd <- event_joined( + description = paste( + "Define confirmed progressive disease (iCPD) for best overall response (iBOR) as", + "iUPD followed by iCPD with only other iUPD and NE responses in between" + ), dataset_name = "ovr", - condition = AVALC == "iCPD", + join_vars = exprs(AVALC, ADT), + join_type = "after", + first_cond_upper = AVALC.join == "iCPD", + condition = AVALC == "iUPD" & + all(AVALC.join %in% c("iCPD", "iUPD", "NE")), set_values_to = exprs(AVALC = "iCPD") ) + ibor_iupd <- event( description = "Define unconfirmed progressive disease (iUPD) for best overall response (iBOR)", dataset_name = "ovr", @@ -635,30 +655,30 @@ ibor_iupd <- event( ibor_ne <- event( description = paste( "Define not evaluable (NE) for best overall response (iBOR) as iSD, NON-iCR/NON-iUPD,", - "or NE (should be specified after ibor_isd and ibor_non_icripd)" + "or NE (should be specified after ibor_isd and ibor_non_icriupd)" ), dataset_name = "ovr", condition = AVALC %in% c("iSD", "NON-iCR/NON-iUPD", "NE"), set_values_to = exprs(AVALC = "NE") ) - adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(ADT), + tmp_event_nr_var = event_nr, + order = exprs(event_nr,ADT), mode = "first", source_datasets = list( ovr = ovr, adsl = adsl ), - events = list(ibor_icr, ibor_ipr, ibor_isd, ibor_non_icripd, ibor_icpd, ibor_iupd, ibor_ne, no_data_missing), + events = list(ibor_icr, ibor_ipr, ibor_isd, ibor_non_icriupd, ibor_iupd, ibor_icpd, ibor_ne, no_data_missing), set_values_to = exprs( PARAMCD = "IBOR", PARAM = "Immune Best Overall Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "iRecist", + PARCAT3 = "iRECIST", AVAL = aval_resp_new(AVALC), ANL01FL = "Y" ) @@ -681,12 +701,14 @@ different events. Some of the other functions from above can then be re-used passing in these confirmed response records. See the examples below of derived parameters requiring confirmation. The assessment and the confirmatory assessment here need to occur at least 28 days apart *(without any +1 applied to -this calculation of days between visits)*, using the `icrsp_y_cr`[^1], -`icrsp_y_ipr`[^2], `icbor_icr`[^3], and `icbor_ipr`[^4] event. +this calculation of days between visits)*, using the `icrsp_y_cr`, +`icrsp_y_ipr`, `icbor_icr`, and `icbor_ipr` event. Here the confirmation period +and the `keep_source_vars` argument is updated, as well as the `first_cond_upper` and +`condition` for the iRECIST values. -[^1]: -```{r} +```{r } confirmation_period <- 28 + icrsp_y_icr <- event_joined( description = paste( "Define confirmed response as iCR followed by iCR at least 28 days later and", @@ -696,17 +718,14 @@ icrsp_y_icr <- event_joined( join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join == "iCR" & + first_cond_upper = AVALC.join == "iCR" & ADT.join >= ADT + days(confirmation_period), condition = AVALC == "iCR" & all(AVALC.join %in% c("iCR", "NE")) & count_vals(var = AVALC.join, val = "NE") <= 1, set_values_to = exprs(AVALC = "Y") ) -``` -[^2]: -```{r} -confirmation_period <- 28 + icrsp_y_ipr <- event_joined( description = paste( "Define confirmed response as iPR followed by iCR or iPR at least 28 days later,", @@ -716,7 +735,7 @@ icrsp_y_ipr <- event_joined( join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join %in% c("iCR", "iPR") & + first_cond_upper = AVALC.join %in% c("iCR", "iPR") & ADT.join >= ADT + days(confirmation_period), condition = AVALC == "iPR" & all(AVALC.join %in% c("iCR", "iPR", "NE")) & @@ -731,10 +750,7 @@ icrsp_y_ipr <- event_joined( ), set_values_to = exprs(AVALC = "Y") ) -``` -[^3]: -```{r} -confirmation_period <- 28 + icbor_icr <- event_joined( description = paste( "Define complete response (iCR) for confirmed best overall response (iCBOR) as", @@ -743,17 +759,14 @@ icbor_icr <- event_joined( dataset_name = "ovr", join_vars = exprs(AVALC, ADT), join_type = "after", - first_cond = AVALC.join == "iCR" & + first_cond_upper = AVALC.join == "iCR" & ADT.join >= ADT + confirmation_period, condition = AVALC == "iCR" & all(AVALC.join %in% c("iCR", "NE")) & count_vals(var = AVALC.join, val = "NE") <= 1, set_values_to = exprs(AVALC = "iCR") ) -``` -[^4]: -```{r} -confirmation_period <- 28 + icbor_ipr <- event_joined( description = paste( "Define partial response (iPR) for confirmed best overall response (iCBOR) as", @@ -763,7 +776,7 @@ icbor_ipr <- event_joined( dataset_name = "ovr", join_vars = exprs(AVALC, ADT), join_type = "after", - first_cond = AVALC.join %in% c("iCR", "iPR") & + first_cond_upper = AVALC.join %in% c("iCR", "iPR") & ADT.join >= ADT + confirmation_period, condition = AVALC == "iPR" & all(AVALC.join %in% c("iCR", "iPR", "NE")) & @@ -783,8 +796,7 @@ icbor_ipr <- event_joined( Please note that the result `AVALC = "Y"` for confirmed clinical benefit is defined by the first _two_ events specified for `events`. For subjects with observations fulfilling both events the one with the earlier date should be -selected (and not the first one in the list). Thus `ignore_event_order = TRUE` -is specified. +selected (and not the first one in the list). ```{r} adrs <- adrs %>% @@ -797,13 +809,12 @@ adrs <- adrs %>% adsl = adsl ), events = list(icrsp_y_icr, icrsp_y_ipr, no_data_n), - ignore_event_order = TRUE, set_values_to = exprs( PARAMCD = "ICRSP", - PARAM = "Immune Response by Investigator (confirmation required)", + PARAM = "Immune Confirmed Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "iRecist", + PARCAT3 = "iRECIST", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -819,13 +830,12 @@ adrs <- adrs %>% ovr = ovr, adsl = adsl ), - ignore_event_order = TRUE, set_values_to = exprs( PARAMCD = "ICCB", - PARAM = "Immune Clinical Benefit by Investigator (confirmation required)", + PARAM = "Immune Confirmed Clinical Benefit by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "iRecist", + PARCAT3 = "iRECIST", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ), @@ -835,19 +845,20 @@ adrs <- adrs %>% adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(ADT), + tmp_event_nr_var = event_nr, + order = exprs(event_nr,ADT), mode = "first", - events = list(icbor_icr, icbor_ipr, ibor_isd, ibor_non_icripd, ibor_icpd, ibor_iupd, ibor_ne, no_data_missing), + events = list(icbor_icr, icbor_ipr, ibor_isd, ibor_non_icriupd, ibor_iupd, ibor_icpd, ibor_ne, no_data_missing), source_datasets = list( ovr = ovr, adsl = adsl ), set_values_to = exprs( PARAMCD = "ICBOR", - PARAM = "Immune Best Overall Response by Investigator (confirmation required)", + PARAM = "Immune Best Confirmed Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "iRecist", + PARCAT3 = "iRECIST", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) From 169bcb67d95ea8cc81b559551f7cb5304795e84d Mon Sep 17 00:00:00 2001 From: Vinh Nguyen Date: Tue, 28 Nov 2023 10:01:17 -0500 Subject: [PATCH 08/40] 233 - iRECIST vignette - 2nd round comments --- vignettes/irecist.Rmd | 63 ++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index ad42eae3..49be3ed5 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -220,9 +220,11 @@ dataset_vignette( ### Derive `AVALC` and `AVAL` Here we populate `AVALC` and create the numeric version as `AVAL` -(ordered from best to worst response). The `AVAL` values are not considered in +(ordered from worst to best response). The `AVAL` values are not considered in the parameter derivations below, and so changing `AVAL` here would not change -the result of those derivations. +the result of those derivations. However, please note that the ordering of `AVAL` +will be used to determine `ANL01FL` in the subsequent step, ensure that the appropriate +`mode` is being set in the `admiral::derive_var_extreme_flag()`. iRECIST ordering will be used or if you'd like to provide your own company-specific ordering here you could do this as follows: @@ -272,7 +274,7 @@ adrs <- adrs %>% by_vars = exprs(STUDYID, USUBJID, ADT), order = exprs(AVAL, RSSEQ), new_var = ANL01FL, - mode = "last" + mode = "first" ), filter = !is.na(AVAL) & AVALC !="MISSING" & ADT >= RANDDT ) @@ -406,7 +408,8 @@ records. For the parameter derivations, all values except those overwritten by `set_values_to` argument are kept from the earliest occurring input record fulfilling the required criteria. -When an `iCPD` occurs,the date would be that of the first `iUPD`. +When an iCPD occurs, the date of progression would be the same as +RECIST 1.1 date (i.e., first `iUPD` date in that block/bar). The function `admiral::derive_extreme_records()`, in conjunction with the event `icpd_y`, could be used to find the date of the first `iUPD`. @@ -426,7 +429,7 @@ adrs <- adrs %>% events = list(icpd_y, no_data_n), set_values_to = exprs( PARAMCD = "ICPD", - PARAM = "Immune Confirmation of Disease Progression by Investigator", + PARAM = "iRECIST Confirmation of Disease Progression by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", PARCAT3 = "iRECIST", @@ -453,7 +456,7 @@ adrs <- adrs %>% events = list(iupd_y, no_data_n), set_values_to = exprs( PARAMCD = "IUPD", - PARAM = "Immune Unconfirmed Disease Progression by Investigator", + PARAM = "iRECIST Unconfirmed Disease Progression by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", PARCAT3 = "iRECIST", @@ -505,7 +508,7 @@ adrs <- adrs %>% ), set_values_to = exprs( PARAMCD = "IRSP", - PARAM = "Immune Response by Investigator (confirmation not required)", + PARAM = "iRECIST Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", PARCAT3 = "iRECIST", @@ -562,7 +565,7 @@ adrs <- adrs %>% ), set_values_to = exprs( PARAMCD = "ICB", - PARAM = "Immune Clinical Benefit by Investigator (confirmation for response not required)", + PARAM = "iRECIST Clinical Benefit by Investigator (confirmation for response not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", PARCAT3 = "iRECIST", @@ -672,10 +675,10 @@ adrs <- adrs %>% ovr = ovr, adsl = adsl ), - events = list(ibor_icr, ibor_ipr, ibor_isd, ibor_non_icriupd, ibor_iupd, ibor_icpd, ibor_ne, no_data_missing), + events = list(ibor_icr, ibor_ipr, ibor_isd, ibor_non_icriupd, ibor_icpd, ibor_iupd, ibor_ne, no_data_missing), set_values_to = exprs( PARAMCD = "IBOR", - PARAM = "Immune Best Overall Response by Investigator (confirmation not required)", + PARAM = "iRECIST Best Overall Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", PARCAT3 = "iRECIST", @@ -711,8 +714,9 @@ confirmation_period <- 28 icrsp_y_icr <- event_joined( description = paste( - "Define confirmed response as iCR followed by iCR at least 28 days later and", - "at most one NE in between" + "Define confirmed response as iCR followed by iCR at least", + confirmation_period, + "days later and at most one NE in between" ), dataset_name = "ovr", join_vars = exprs(AVALC, ADT), @@ -728,8 +732,9 @@ icrsp_y_icr <- event_joined( icrsp_y_ipr <- event_joined( description = paste( - "Define confirmed response as iPR followed by iCR or iPR at least 28 days later,", - "at most one NE in between, and no iPR after iCR" + "Define confirmed response as iPR followed by iCR or iPR at least", + confirmation_period, + "days later at most one NE in between, and no iPR after iCR" ), dataset_name = "ovr", join_vars = exprs(AVALC, ADT), @@ -754,7 +759,9 @@ icrsp_y_ipr <- event_joined( icbor_icr <- event_joined( description = paste( "Define complete response (iCR) for confirmed best overall response (iCBOR) as", - "iCR followed by iCR at least 28 days later and at most one NE in between" + "iCR followed by iCR at least", + confirmation_period, + "days later and at most one NE in between" ), dataset_name = "ovr", join_vars = exprs(AVALC, ADT), @@ -770,8 +777,9 @@ icbor_icr <- event_joined( icbor_ipr <- event_joined( description = paste( "Define partial response (iPR) for confirmed best overall response (iCBOR) as", - "iPR followed by iCR or iPR at least 28 days later, at most one NE in between,", - "and no iPR after iCR" + "iPR followed by iCR or iPR at least", + confirmation_period, + "days later, at most one NE in between and no iPR after iCR" ), dataset_name = "ovr", join_vars = exprs(AVALC, ADT), @@ -811,7 +819,7 @@ adrs <- adrs %>% events = list(icrsp_y_icr, icrsp_y_ipr, no_data_n), set_values_to = exprs( PARAMCD = "ICRSP", - PARAM = "Immune Confirmed Response by Investigator", + PARAM = "iRECIST Confirmed Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", PARCAT3 = "iRECIST", @@ -832,7 +840,7 @@ adrs <- adrs %>% ), set_values_to = exprs( PARAMCD = "ICCB", - PARAM = "Immune Confirmed Clinical Benefit by Investigator", + PARAM = "iRECIST Confirmed Clinical Benefit by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", PARCAT3 = "iRECIST", @@ -848,14 +856,14 @@ adrs <- adrs %>% tmp_event_nr_var = event_nr, order = exprs(event_nr,ADT), mode = "first", - events = list(icbor_icr, icbor_ipr, ibor_isd, ibor_non_icriupd, ibor_iupd, ibor_icpd, ibor_ne, no_data_missing), + events = list(icbor_icr, icbor_ipr, ibor_isd, ibor_non_icriupd, ibor_icpd, ibor_iupd, ibor_ne, no_data_missing), source_datasets = list( ovr = ovr, adsl = adsl ), set_values_to = exprs( PARAMCD = "ICBOR", - PARAM = "Immune Best Confirmed Overall Response by Investigator", + PARAM = "iRECIST Best Confirmed Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", PARCAT3 = "iRECIST", @@ -874,4 +882,15 @@ dataset_vignette( ``` ## Other Endpoints {#other} -For additional endpoints that can be added please see [Creating ADRS (Including Non-standard Endpoints)](adrs.html). +The following parameters may also be added: + +BCP - Best Overall Response of CR/PR by Investigator (confirmation not required)
+CBCP - Best Confirmed Overall Response of CR/PR by Investigator
+A1BOR - Best Overall Response by Investigator (confirmation not required) - Recist 1.1 adjusted for NED at Baseline
+ACCB - Alternative Confirmed Clinical Benefit by Investigator
+OVRB - Overall Response by BICR
+DEATH - Death
+LSTA - Last Disease Assessment by Investigator
+MDIS - Measurable Disease at Baseline by Investigator
%>% + +For examples on the additional endpoints, please see [Creating ADRS (Including Non-standard Endpoints)](adrs.html). From 9ffd0d7b8aa872cbb1b986fa30e1fb107901d8bf Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 29 Nov 2023 10:25:33 +0000 Subject: [PATCH 09/40] #233 iRECIST_vignette_main: add handling of RECIST/iRECIST mixture --- vignettes/irecist.Rmd | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index ad42eae3..dcab2c05 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -81,9 +81,13 @@ unless otherwise specified.* ## Read in Data {#readdata} -To start, all data frames needed for the creation of `ADRS` should be -read into the environment. This will be a company specific process. Some -of the data frames needed may be `ADSL`, `RS` and `TU`. +To start, all data frames needed for the creation of `ADRS` should be read into +the environment. This will be a company specific process. Some of the data +frames needed may be `ADSL`, `RS` and `TU`. For this vignette we assume that +`RS` provides the response values `"iCR"`, `"iPR"`, `"iSD"`, +`"NON-iCR/NON-iUPD"`, `"iUPD"`, `"iCP"`, and `"NE"`. All examples can be easily +modified to consider other response values (see [Handling Different Input +Response Values](#different_resp_vals)). For example purpose, the SDTM and ADaM datasets (based on CDISC Pilot test data)---which are included in `{pharmaversesdtm}` and `{pharmaverseadam}`---are used. @@ -398,6 +402,22 @@ no_data_missing <- event( ``` +### Handling Different Input Response Values {#different_resp_vals} +If `RS` contains other response values than the iRECIST responses, the `event()` +and `event_joined()` can be adjusted to cover this scenario. For example, if +RECIST responses (`"CR"`, `"PR"`, `"SD"`, ...) are collected up to first PD and +iRECIST responses (`"iCR"`, `"iPR"`, `"iSD"`, ...) thereafter, the `event()` +object defining unconfirmed response can be adjusted in the following way. +``` +irsp_y <- event( + description = "Define CR, iCR, PR, or iPR as (unconfirmed) response", + dataset_name = "ovr", + condition = AVALC %in% c("CR", "iCR", "PR", "iPR"), + set_values_to = exprs(AVALC = "Y") +) + +``` + ## Derive Confirmed and Unconfirmed Progressive Disease Parameter {#pd} Now that we have the input records prepared above with any From fee44c375ac16c73c4171b224ec3a5393bb2017d Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 29 Nov 2023 10:59:21 +0000 Subject: [PATCH 10/40] #233 iRECIST_vignette_main: fix links --- .github/ISSUE_TEMPLATE/05_onboard.yml | 40 --------------------------- .github/pull_request_template.md | 12 ++++---- 2 files changed, 5 insertions(+), 47 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/05_onboard.yml diff --git a/.github/ISSUE_TEMPLATE/05_onboard.yml b/.github/ISSUE_TEMPLATE/05_onboard.yml deleted file mode 100644 index 9f6897a0..00000000 --- a/.github/ISSUE_TEMPLATE/05_onboard.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Onboarding Tasks -description: Bringing a Core or non-Core member onto the admiral team [for admiral team only] -title: "Onboarding: " -labels: ["onboarding"] -assignees: - - octocat -body: - - type: markdown - attributes: - value: | - Welcome to the Team! We love contributors! - - type: checkboxes - id: core - attributes: - label: Onboarding tasks for Core (Roche-GSK) Team Members - description: - options: - - label: Given a tour of Github from a Core member - - label: Understand how to Create Issues and do a Pull Request - - label: Understand the Programming Strategy - - label: Read and understand [Developer Guides Articles](https://pharmaverse.github.io/admiraldev/devel/articles/index.html) - - label: Invited to all relevant meetings - Stand Ups, Retrospective, Sprint Planning, Question/Comments, Backlog, Community Meeting - - label: Given access to Box and relevant documents - - label: Given write access to Github Repository - - label: Slack channel invites to admiral and admiralonco_dev - - label: Introduction to Teams ways of working - - type: checkboxes - id: non-core - attributes: - label: Onboarding tasks for non-Core Team Members - description: - options: - - label: Given a tour of Github from a Core member - - label: Understand how to Create Issues and do a Pull Request - - label: Understand the Programming Strategy - - label: Read and understand [Developer Guides Articles](https://pharmaverse.github.io/admiraldev/devel/articles/index.html) - - label: Invited to all relevant meetings - Question/Comments, Community Meeting - - label: Given write access to Github Repository - - label: Slack channel invites to admiral - - label: Introduction to Teams ways of working diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7564ba9d..90dbadf3 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,13 +1,11 @@ -Please add "Closes #" to the title of the pull request. Then the -issue is closed automatically once it is merged to `main`. +Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiraldev/articles/development_process.html) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent. -Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiraldev/main/articles/development_process.html) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent. - -Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the `devel` branch until you have checked off each task. +Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the `main` branch until you have checked off each task. +- [ ] Place Closes # into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update). Then the issue is closed automatically once it is merged to `main`. - [ ] Code is formatted according to the [tidyverse style guide](https://style.tidyverse.org/). Run `styler::style_file()` to style R and Rmd files -- [ ] Updated relevant unit tests or have written new unit tests - See [Unit Test Guide](https://pharmaverse.github.io/admiraldev/main/articles/unit_test_guidance.html#writing-unit-tests-in-admiral) -- [ ] If you removed/replaced any function and/or function parameters, did you fully follow the [deprecation guidance](https://pharmaverse.github.io/admiraldev/main/articles/programming_strategy.html#deprecation)? +- [ ] Updated relevant unit tests or have written new unit tests - See [Unit Test Guide](https://pharmaverse.github.io/admiraldev/articles/unit_test_guidance.html#writing-unit-tests-in-admiral) +- [ ] If you removed/replaced any function and/or function parameters, did you fully follow the [deprecation guidance](https://pharmaverse.github.io/admiraldev/articles/programming_strategy.html#deprecation)? - [ ] Update to all relevant roxygen headers and examples - [ ] Run `devtools::document()` so all `.Rd` files in the `man` folder and the `NAMESPACE` file in the project root are updated appropriately - [ ] Address any updates needed for vignettes and/or templates From 4e15d527df1147f808b20a86ce9cf63f4e6e304d Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 29 Nov 2023 11:05:02 +0000 Subject: [PATCH 11/40] #233 iRECIST_vignette_main: fix spelling --- inst/WORDLIST | 6 ++++++ vignettes/irecist.Rmd | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/inst/WORDLIST b/inst/WORDLIST index 20951a07..1f0971bb 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,12 +1,15 @@ +ACCB ADRS ADSL ADTR ADTTE ADaM ADaMs +BCP BICR BOR Biologics +CBCP CDISC CRF GlaxoSmithKline @@ -14,7 +17,9 @@ Hoffmann IMWG IRF LLC +LSTA Myeloma +OVRB PFS Pre RECIST @@ -31,6 +36,7 @@ evaluable fil fmt funder +iCPD iRECIST myeloma pharmaverse diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index 8079d995..5514f4ef 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -352,7 +352,7 @@ dataset_vignette( The building blocks for the events that contribute to deriving common endpoints like what constitutes a responder, or a Best Overall Response of complete -response (CR), ... are predefined in admiralonco for Recist 1.1 (see [Pre-Defined +response (CR), ... are predefined in admiralonco for RECIST 1.1 (see [Pre-Defined Response Event Objects](../reference/event_objects.html)). New Response Event Objects are needed for iRECIST and any study-specific needs. @@ -906,11 +906,11 @@ The following parameters may also be added: BCP - Best Overall Response of CR/PR by Investigator (confirmation not required)
CBCP - Best Confirmed Overall Response of CR/PR by Investigator
-A1BOR - Best Overall Response by Investigator (confirmation not required) - Recist 1.1 adjusted for NED at Baseline
+A1BOR - Best Overall Response by Investigator (confirmation not required) - RECIST 1.1 adjusted for NED at Baseline
ACCB - Alternative Confirmed Clinical Benefit by Investigator
OVRB - Overall Response by BICR
DEATH - Death
LSTA - Last Disease Assessment by Investigator
-MDIS - Measurable Disease at Baseline by Investigator
%>% +MDIS - Measurable Disease at Baseline by Investigator For examples on the additional endpoints, please see [Creating ADRS (Including Non-standard Endpoints)](adrs.html). From ff65905ab26350b07ec4c03df461e28f96a77e98 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 29 Nov 2023 11:08:15 +0000 Subject: [PATCH 12/40] #233 iRECIST_vignette_main: style files --- vignettes/irecist.Rmd | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index 5514f4ef..04954c0f 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -280,7 +280,7 @@ adrs <- adrs %>% new_var = ANL01FL, mode = "first" ), - filter = !is.na(AVAL) & AVALC !="MISSING" & ADT >= RANDDT + filter = !is.na(AVAL) & AVALC != "MISSING" & ADT >= RANDDT ) ``` @@ -367,7 +367,7 @@ icpd_y <- event_joined( join_type = "after", first_cond_upper = AVALC.join == "iCPD", condition = AVALC == "iUPD" & - all(AVALC.join %in% c("iCPD", "iUPD", "NE" )), + all(AVALC.join %in% c("iCPD", "iUPD", "NE")), set_values_to = exprs(AVALC = "Y") ) @@ -401,7 +401,6 @@ no_data_missing <- event( set_values_to = exprs(AVALC = "MISSING"), keep_source_vars = adsl_vars ) - ``` ### Handling Different Input Response Values {#different_resp_vals} @@ -461,7 +460,7 @@ adrs <- adrs %>% ovr_orig <- ovr ovr <- ovr %>% group_by(USUBJID) %>% - filter(ADT >= max_cond(var = ADT, cond = AVALC == "iUPD")) %>% + filter(ADT >= max_cond(var = ADT, cond = AVALC == "iUPD")) %>% ungroup(USUBJID) adrs <- adrs %>% @@ -689,13 +688,13 @@ adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), tmp_event_nr_var = event_nr, - order = exprs(event_nr,ADT), + order = exprs(event_nr, ADT), mode = "first", source_datasets = list( ovr = ovr, adsl = adsl ), - events = list(ibor_icr, ibor_ipr, ibor_isd, ibor_non_icriupd, ibor_icpd, ibor_iupd, ibor_ne, no_data_missing), + events = list(ibor_icr, ibor_ipr, ibor_isd, ibor_non_icriupd, ibor_icpd, ibor_iupd, ibor_ne, no_data_missing), set_values_to = exprs( PARAMCD = "IBOR", PARAM = "iRECIST Best Overall Response by Investigator (confirmation not required)", @@ -735,7 +734,7 @@ confirmation_period <- 28 icrsp_y_icr <- event_joined( description = paste( "Define confirmed response as iCR followed by iCR at least", - confirmation_period, + confirmation_period, "days later and at most one NE in between" ), dataset_name = "ovr", @@ -780,7 +779,7 @@ icbor_icr <- event_joined( description = paste( "Define complete response (iCR) for confirmed best overall response (iCBOR) as", "iCR followed by iCR at least", - confirmation_period, + confirmation_period, "days later and at most one NE in between" ), dataset_name = "ovr", @@ -874,7 +873,7 @@ adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), tmp_event_nr_var = event_nr, - order = exprs(event_nr,ADT), + order = exprs(event_nr, ADT), mode = "first", events = list(icbor_icr, icbor_ipr, ibor_isd, ibor_non_icriupd, ibor_icpd, ibor_iupd, ibor_ne, no_data_missing), source_datasets = list( From aeb5fda18d2ca33695a966736958d6c1d78902d1 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Tue, 5 Dec 2023 11:36:41 +0000 Subject: [PATCH 13/40] #256 admiral_updates: update ADRS templates and source objects --- R/response_sources.R | 8 ++++---- inst/templates/ad_adrs.R | 28 +++++++++++++++++----------- inst/templates/ad_adrs_basic.R | 4 ++++ 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/R/response_sources.R b/R/response_sources.R index bae3005e..c79ed56e 100644 --- a/R/response_sources.R +++ b/R/response_sources.R @@ -172,7 +172,7 @@ crsp_y_cr <- event_joined( join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join == "CR" & + first_cond_upper = AVALC.join == "CR" & ADT.join >= ADT + days(28), condition = AVALC == "CR" & all(AVALC.join %in% c("CR", "NE")) & @@ -193,7 +193,7 @@ crsp_y_pr <- event_joined( join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join %in% c("CR", "PR") & + first_cond_upper = AVALC.join %in% c("CR", "PR") & ADT.join >= ADT + days(28), condition = AVALC == "PR" & all(AVALC.join %in% c("CR", "PR", "NE")) & @@ -221,7 +221,7 @@ cbor_cr <- event_joined( dataset_name = "ovr", join_vars = exprs(AVALC, ADT), join_type = "after", - first_cond = AVALC.join == "CR" & + first_cond_upper = AVALC.join == "CR" & ADT.join >= ADT + 28, condition = AVALC == "CR" & all(AVALC.join %in% c("CR", "NE")) & @@ -242,7 +242,7 @@ cbor_pr <- event_joined( dataset_name = "ovr", join_vars = exprs(AVALC, ADT), join_type = "after", - first_cond = AVALC.join %in% c("CR", "PR") & + first_cond_upper = AVALC.join %in% c("CR", "PR") & ADT.join >= ADT + 28, condition = AVALC == "PR" & all(AVALC.join %in% c("CR", "PR", "NE")) & diff --git a/inst/templates/ad_adrs.R b/inst/templates/ad_adrs.R index 0a75f46e..a63fc960 100644 --- a/inst/templates/ad_adrs.R +++ b/inst/templates/ad_adrs.R @@ -134,6 +134,7 @@ adrs <- adrs %>% order = exprs(ADT, RSSEQ), mode = "first", exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "PD", PARAM = "Disease Progression by Investigator", @@ -149,7 +150,8 @@ adrs <- adrs %>% adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(ADT), + order = exprs(event_nr, ADT), + tmp_event_nr_var = event_nr, mode = "first", events = list(rsp_y, no_data_n), source_datasets = list( @@ -171,14 +173,14 @@ adrs <- adrs %>% adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(desc(AVALC), ADT), + order = exprs(desc(AVALC), ADT, event_nr), + tmp_event_nr_var = event_nr, mode = "first", events = list(rsp_y, cb_y, no_data_n), source_datasets = list( ovr = ovr, adsl = adsl ), - ignore_event_order = TRUE, set_values_to = exprs( PARAMCD = "CB", PARAM = "Clinical Benefit by Investigator (confirmation for response not required)", @@ -199,7 +201,8 @@ adrs <- adrs %>% adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(ADT), + order = exprs(event_nr, ADT), + tmp_event_nr_var = event_nr, mode = "first", source_datasets = list( ovr = ovr, @@ -225,6 +228,7 @@ adrs <- adrs %>% by_vars = exprs(STUDYID, USUBJID), filter_add = PARAMCD == "BOR" & AVALC %in% c("CR", "PR"), exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "BCP", PARAM = "Best Overall Response of CR/PR by Investigator (confirmation not required)", @@ -240,14 +244,14 @@ adrs <- adrs %>% adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(desc(AVALC), ADT), + order = exprs(desc(AVALC), ADT, event_nr), + tmp_event_nr_var = event_nr, mode = "first", source_datasets = list( ovr = ovr, adsl = adsl ), events = list(crsp_y_cr, crsp_y_pr, no_data_n), - ignore_event_order = TRUE, set_values_to = exprs( PARAMCD = "CRSP", PARAM = "Confirmed Response by Investigator", @@ -262,14 +266,14 @@ adrs <- adrs %>% adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(desc(AVALC), ADT), + order = exprs(desc(AVALC), ADT, event_nr), + tmp_event_nr_var = event_nr, mode = "first", events = list(crsp_y_cr, crsp_y_pr, cb_y, no_data_n), source_datasets = list( ovr = ovr, adsl = adsl ), - ignore_event_order = TRUE, set_values_to = exprs( PARAMCD = "CCB", PARAM = "Confirmed Clinical Benefit by Investigator", @@ -278,14 +282,14 @@ adrs <- adrs %>% PARCAT3 = "Recist 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" - ), - check_type = "none" + ) ) adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(ADT), + order = exprs(event_nr, ADT), + tmp_event_nr_var = event_nr, mode = "first", events = list(cbor_cr, cbor_pr, bor_sd, bor_non_crpd, bor_pd, bor_ne, no_data_missing), source_datasets = list( @@ -308,6 +312,7 @@ adrs <- adrs %>% by_vars = exprs(STUDYID, USUBJID), filter_add = PARAMCD == "CBOR" & AVALC %in% c("CR", "PR"), exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "CBCP", PARAM = "Best Confirmed Overall Response of CR/PR by Investigator", @@ -330,6 +335,7 @@ adrs <- adrs %>% by_vars = exprs(STUDYID, USUBJID), filter_add = !is.na(DTHDT), exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "DEATH", PARAM = "Death", diff --git a/inst/templates/ad_adrs_basic.R b/inst/templates/ad_adrs_basic.R index a77cea5d..d8017ee4 100644 --- a/inst/templates/ad_adrs_basic.R +++ b/inst/templates/ad_adrs_basic.R @@ -107,6 +107,7 @@ adrs <- adrs %>% order = exprs(ADT, RSSEQ), mode = "first", exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "PD", PARAM = "Disease Progression by Investigator", @@ -201,6 +202,7 @@ adrs <- adrs %>% order = exprs(ADT, RSSEQ), mode = "first", exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "BCP", PARAM = "Best Overall Response of CR/PR by Investigator (confirmation not required)", @@ -282,6 +284,7 @@ adrs <- adrs %>% order = exprs(ADT, RSSEQ), mode = "first", exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "CBCP", PARAM = "Best Confirmed Overall Response of CR/PR by Investigator", @@ -304,6 +307,7 @@ adrs <- adrs %>% by_vars = exprs(STUDYID, USUBJID), filter_add = !is.na(DTHDT), exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "DEATH", PARAM = "Death", From 48ee1bb288d8cd1f9946dbb8f89fafef13a7047a Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Tue, 5 Dec 2023 14:28:56 +0000 Subject: [PATCH 14/40] #233 iRECIST_vignette_main: fix typos --- vignettes/irecist.Rmd | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index 04954c0f..d081eca0 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -85,7 +85,7 @@ To start, all data frames needed for the creation of `ADRS` should be read into the environment. This will be a company specific process. Some of the data frames needed may be `ADSL`, `RS` and `TU`. For this vignette we assume that `RS` provides the response values `"iCR"`, `"iPR"`, `"iSD"`, -`"NON-iCR/NON-iUPD"`, `"iUPD"`, `"iCP"`, and `"NE"`. All examples can be easily +`"NON-iCR/NON-iUPD"`, `"iUPD"`, `"iCPD"`, and `"NE"`. All examples can be easily modified to consider other response values (see [Handling Different Input Response Values](#different_resp_vals)). @@ -150,15 +150,14 @@ Independent Review Facility (IRF)/Blinded Independent Central Review (BICR) records). It could even involve merging input data from other sources besides `RS`, such as `ADTR`. -This step would include any required selection/derivation of `ADT` or -applying any necessary partial date imputations, updating `AVAL` (e.g. -this should be ordered from best to worst response), and setting -analysis flag `ANL01FL`. Common options for `ANL01FL` would be to set -null for invalid assessments or those occurring after new anti-cancer -therapy, or to only flag assessments on or after after date of first -treatment/randomization, or rules to cover the case when a patient has -multiple observations per visit (e.g. by selecting worst value). Another -consideration could be extra potential protocol-specific sources of +This step would include any required selection/derivation of `ADT` or applying +any necessary partial date imputations, updating `AVAL` (e.g. this should be +ordered from best to worst response), and setting analysis flag `ANL01FL`. +Common options for `ANL01FL` would be to set null for invalid assessments or +those occurring after new anti-cancer therapy, or to only flag assessments on or +after date of first treatment/randomization, or rules to cover the case when a +patient has multiple observations per visit (e.g. by selecting the worst value). +Another consideration could be extra potential protocol-specific sources of Progressive Disease such as radiological assessments, which could be pre-processed here to create a PD record to feed downstream derivations. From 6e6e516458eac087f32d302e27f526f52fa74b6d Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Tue, 5 Dec 2023 16:35:16 +0000 Subject: [PATCH 15/40] #256 admiral_updates: update ADRS vignettes and add previous versions page --- DESCRIPTION | 1 + _pkgdown.yml | 10 +- inst/templates/ad_adrs.R | 24 ++--- inst/templates/ad_adrs_basic.R | 24 ++--- vignettes/adrs.Rmd | 120 ++++++++++-------------- vignettes/adrs_basic.Rmd | 71 +++++--------- vignettes/articles/website-versions.Rmd | 82 ++++++++++++++++ 7 files changed, 187 insertions(+), 145 deletions(-) create mode 100644 vignettes/articles/website-versions.Rmd diff --git a/DESCRIPTION b/DESCRIPTION index e2fc77b5..980c7646 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -74,3 +74,4 @@ Suggests: DT VignetteBuilder: knitr Config/testthat/edition: 3 +Config/Needs/website: gert diff --git a/_pkgdown.yml b/_pkgdown.yml index 2ec516ae..98293920 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -14,6 +14,10 @@ repo: user: https://github.com/ news: cran_dates: true + +development: + mode: auto + reference: - title: Derivations for Adding Parameters @@ -57,7 +61,7 @@ reference: navbar: structure: left: [getstarted, reference, articles, news] - right: [search, slack, newissue, github] + right: [search, slack, history, newissue, github] components: getstarted: text: Get Started @@ -78,6 +82,10 @@ navbar: href: articles/adtr.html - text: Creating and Using New Anti-Cancer Start Date href: articles/nactdt.html + history: + icon: fa-history + href: articles/website-versions.html + aria-label: Previous Release Websites slack: icon: fa-slack href: https://app.slack.com/client/T028PB489D3/C02M8KN8269 diff --git a/inst/templates/ad_adrs.R b/inst/templates/ad_adrs.R index a63fc960..88be60aa 100644 --- a/inst/templates/ad_adrs.R +++ b/inst/templates/ad_adrs.R @@ -51,7 +51,7 @@ adrs <- adrs %>% PARAM = "Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1" + PARCAT3 = "RECIST 1.1" ) # Date imputations - here we impute missing day to last possible date @@ -140,7 +140,7 @@ adrs <- adrs %>% PARAM = "Disease Progression by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -163,7 +163,7 @@ adrs <- adrs %>% PARAM = "Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -186,7 +186,7 @@ adrs <- adrs %>% PARAM = "Clinical Benefit by Investigator (confirmation for response not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ), @@ -214,7 +214,7 @@ adrs <- adrs %>% PARAM = "Best Overall Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) @@ -234,7 +234,7 @@ adrs <- adrs %>% PARAM = "Best Overall Response of CR/PR by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -257,7 +257,7 @@ adrs <- adrs %>% PARAM = "Confirmed Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -279,7 +279,7 @@ adrs <- adrs %>% PARAM = "Confirmed Clinical Benefit by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -301,7 +301,7 @@ adrs <- adrs %>% PARAM = "Best Confirmed Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) @@ -318,7 +318,7 @@ adrs <- adrs %>% PARAM = "Best Confirmed Overall Response of CR/PR by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -361,7 +361,7 @@ adrs <- adrs %>% PARAM = "Last Disease Assessment by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", ANL01FL = "Y" ) ) @@ -381,7 +381,7 @@ adrs <- adrs %>% PARAMCD = "MDIS", PARAM = "Measurable Disease at Baseline by Investigator", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) diff --git a/inst/templates/ad_adrs_basic.R b/inst/templates/ad_adrs_basic.R index d8017ee4..9c1a2eef 100644 --- a/inst/templates/ad_adrs_basic.R +++ b/inst/templates/ad_adrs_basic.R @@ -59,7 +59,7 @@ adrs <- adrs %>% PARAM = "Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1" + PARCAT3 = "RECIST 1.1" ) # Date imputations - here we impute missing day to last possible date @@ -113,7 +113,7 @@ adrs <- adrs %>% PARAM = "Disease Progression by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -138,7 +138,7 @@ adrs <- adrs %>% PARAM = "Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -166,7 +166,7 @@ adrs <- adrs %>% PARAM = "Clinical Benefit by Investigator (confirmation for response not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -186,7 +186,7 @@ adrs <- adrs %>% PARAM = "Best Overall Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) @@ -208,7 +208,7 @@ adrs <- adrs %>% PARAM = "Best Overall Response of CR/PR by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -227,7 +227,7 @@ adrs <- adrs %>% PARAM = "Confirmed Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -253,7 +253,7 @@ adrs <- adrs %>% PARAM = "Confirmed Clinical Benefit by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -271,7 +271,7 @@ adrs <- adrs %>% PARAM = "Best Confirmed Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) @@ -290,7 +290,7 @@ adrs <- adrs %>% PARAM = "Best Confirmed Overall Response of CR/PR by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -333,7 +333,7 @@ adrs <- adrs %>% PARAM = "Last Disease Assessment by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", ANL01FL = "Y" ) ) @@ -353,7 +353,7 @@ adrs <- adrs %>% PARAMCD = "MDIS", PARAM = "Measurable Disease at Baseline by Investigator", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) diff --git a/vignettes/adrs.Rmd b/vignettes/adrs.Rmd index 2dc5b14d..fffc3103 100644 --- a/vignettes/adrs.Rmd +++ b/vignettes/adrs.Rmd @@ -14,36 +14,6 @@ knitr::opts_chunk$set( comment = "#>" ) -library(admiral) - -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" - library(admiraldev) ``` @@ -95,20 +65,21 @@ read into the environment. This will be a company specific process. Some of the data frames needed may be `ADSL`, `RS` and `TU`. For example purpose, the SDTM and ADaM datasets (based on CDISC Pilot -test data)---which are included in `{pharmaversesdtm}`---are used. +test data)---which are included in `{pharmaversesdtm}` and +`{pharmaverseadam}`---are used. ```{r message=FALSE} library(admiral) library(admiralonco) library(dplyr) library(pharmaversesdtm) +library(pharmaverseadam) library(lubridate) library(stringr) -data("admiral_adsl") +data("adsl") data("rs_onco_recist") data("tu_onco_recist") -adsl <- admiral_adsl rs <- rs_onco_recist tu <- tu_onco_recist @@ -193,7 +164,7 @@ adrs <- adrs %>% PARAM = "Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1" + PARCAT3 = "RECIST 1.1" ) ``` @@ -359,7 +330,7 @@ crsp_y_cr <- event_joined( join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join == "CR" & + first_cond_upper = AVALC.join == "CR" & ADT.join >= ADT + days(confirmation_period), condition = AVALC == "CR" & all(AVALC.join %in% c("CR", "NE")) & @@ -377,7 +348,7 @@ crsp_y_pr <- event_joined( join_vars = exprs(AVALC, ADT), join_type = "after", order = exprs(ADT), - first_cond = AVALC.join %in% c("CR", "PR") & + first_cond_upper = AVALC.join %in% c("CR", "PR") & ADT.join >= ADT + days(confirmation_period), condition = AVALC == "PR" & all(AVALC.join %in% c("CR", "PR", "NE")) & @@ -403,7 +374,7 @@ cbor_cr <- event_joined( dataset_name = "ovr", join_vars = exprs(AVALC, ADT), join_type = "after", - first_cond = AVALC.join == "CR" & + first_cond_upper = AVALC.join == "CR" & ADT.join >= ADT + confirmation_period, condition = AVALC == "CR" & all(AVALC.join %in% c("CR", "NE")) & @@ -421,7 +392,7 @@ cbor_pr <- event_joined( dataset_name = "ovr", join_vars = exprs(AVALC, ADT), join_type = "after", - first_cond = AVALC.join %in% c("CR", "PR") & + first_cond_upper = AVALC.join %in% c("CR", "PR") & ADT.join >= ADT + confirmation_period, condition = AVALC == "PR" & all(AVALC.join %in% c("CR", "PR", "NE")) & @@ -478,12 +449,13 @@ adrs <- adrs %>% order = exprs(ADT, RSSEQ), mode = "first", exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "PD", PARAM = "Disease Progression by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -520,7 +492,8 @@ rsp_y adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(ADT), + order = exprs(ADT, event_nr), + tmp_event_nr_var = event_nr, mode = "first", events = list(rsp_y, no_data_n), source_datasets = list( @@ -532,7 +505,7 @@ adrs <- adrs %>% PARAM = "Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -569,24 +542,23 @@ list). Thus `ignore_event_order = TRUE` is specified. adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(desc(AVALC), ADT), + order = exprs(desc(AVALC), ADT, event_nr), + tmp_event_nr_var = event_nr, mode = "first", events = list(rsp_y, cb_y, no_data_n), source_datasets = list( ovr = ovr, adsl = adsl ), - ignore_event_order = TRUE, set_values_to = exprs( PARAMCD = "CB", PARAM = "Clinical Benefit by Investigator (confirmation for response not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" - ), - check_type = "none" + ) ) ``` @@ -615,7 +587,8 @@ response for this subject. adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(ADT), + order = exprs(event_nr, ADT), + tmp_event_nr_var = event_nr, mode = "first", source_datasets = list( ovr = ovr, @@ -627,7 +600,7 @@ adrs <- adrs %>% PARAM = "Best Overall Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) @@ -683,12 +656,13 @@ adrs <- adrs %>% by_vars = exprs(STUDYID, USUBJID), filter_add = PARAMCD == "BOR" & AVALC %in% c("CR", "PR"), exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "BCP", PARAM = "Best Overall Response of CR/PR by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -741,20 +715,20 @@ is specified. adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(desc(AVALC), ADT), + order = exprs(desc(AVALC), ADT, event_nr), + tmp_event_nr_var = event_nr, mode = "first", source_datasets = list( ovr = ovr, adsl = adsl ), events = list(crsp_y_cr, crsp_y_pr, no_data_n), - ignore_event_order = TRUE, set_values_to = exprs( PARAMCD = "CRSP", PARAM = "Confirmed Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -763,30 +737,30 @@ adrs <- adrs %>% adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(desc(AVALC), ADT), + order = exprs(desc(AVALC), ADT, event_nr), + tmp_event_nr_var = event_nr, mode = "first", events = list(crsp_y_cr, crsp_y_pr, cb_y, no_data_n), source_datasets = list( ovr = ovr, adsl = adsl ), - ignore_event_order = TRUE, set_values_to = exprs( PARAMCD = "CCB", PARAM = "Confirmed Clinical Benefit by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" - ), - check_type = "none" + ) ) adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(ADT), + order = exprs(event_nr, ADT), + tmp_event_nr_var = event_nr, mode = "first", events = list(cbor_cr, cbor_pr, bor_sd, bor_non_crpd, bor_pd, bor_ne, no_data_missing), source_datasets = list( @@ -798,7 +772,7 @@ adrs <- adrs %>% PARAM = "Best Confirmed Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) @@ -809,12 +783,13 @@ adrs <- adrs %>% by_vars = exprs(STUDYID, USUBJID), filter_add = PARAMCD == "CBOR" & AVALC %in% c("CR", "PR"), exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "CBCP", PARAM = "Best Confirmed Overall Response of CR/PR by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -854,24 +829,23 @@ cb_y_pd <- event( adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(desc(AVALC), ADT), + order = exprs(desc(AVALC), ADT, event_nr), + tmp_event_nr_var = event_nr, mode = "first", events = list(crsp_y_cr, crsp_y_pr, cb_y, cb_y_pd, no_data_n), source_datasets = list( ovr = ovr, adsl = adsl ), - ignore_event_order = TRUE, set_values_to = exprs( PARAMCD = "ACCB", PARAM = "Alternative Confirmed Clinical Benefit by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" - ), - check_type = "none" + ) ) ``` @@ -896,7 +870,8 @@ bor_ned <- event( adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(ADT), + order = exprs(event_nr, ADT), + tmp_event_nr_var = event_nr, mode = "first", source_datasets = list( ovr = ovr, @@ -907,11 +882,11 @@ adrs <- adrs %>% PARAMCD = "A1BOR", PARAM = paste( "Best Overall Response by Investigator (confirmation not required)", - "- Recist 1.1 adjusted for NED at Baseline" + "- RECIST 1.1 adjusted for NED at Baseline" ), PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1 adjusted for NED at Baseline", + PARCAT3 = "RECIST 1.1 adjusted for NED at Baseline", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) @@ -937,7 +912,7 @@ adrs_bicr <- rs %>% PARAM = "Overall Response by BICR", PARCAT1 = "Tumor Response", PARCAT2 = "Blinded Independent Central Review", - PARCAT3 = "Recist 1.1" + PARCAT3 = "RECIST 1.1" ) ``` @@ -970,6 +945,7 @@ adrs <- adrs %>% by_vars = exprs(STUDYID, USUBJID), filter_add = !is.na(DTHDT), exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "DEATH", PARAM = "Death", @@ -1009,7 +985,7 @@ adrs <- adrs %>% PARAM = "Last Disease Assessment by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", ANL01FL = "Y" ) ) @@ -1047,7 +1023,7 @@ adrs <- adrs %>% PARAMCD = "MDIS", PARAM = "Measurable Disease at Baseline by Investigator", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -1109,4 +1085,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADRS | `r dyn_link("ad_adrs.R", "https://github.com/pharmaverse/admiralonco/blob", "inst/templates/ad_adrs.R", is_multiversion = TRUE)` +ADRS | `use_ad_template("ADRS")` diff --git a/vignettes/adrs_basic.Rmd b/vignettes/adrs_basic.Rmd index 973ceba2..60939eec 100644 --- a/vignettes/adrs_basic.Rmd +++ b/vignettes/adrs_basic.Rmd @@ -14,36 +14,6 @@ knitr::opts_chunk$set( comment = "#>" ) -library(admiral) - -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" - library(admiraldev) ``` @@ -93,21 +63,22 @@ To start, all data frames needed for the creation of `ADRS` should be read into the environment. This will be a company specific process. Some of the data frames needed may be `ADSL`, `RS` and `TU`. -For example purpose, the SDTM and ADaM datasets (based on CDISC Pilot -test data)---which are included in `{pharmaversesdtm}`---are used. +For example purpose, the SDTM and ADaM datasets (based on CDISC Pilot test +data)---which are included in `{pharmaversesdtm}` and `{pharmaverseadam}`---are +used. ```{r message=FALSE} library(admiral) library(admiralonco) library(dplyr) library(pharmaversesdtm) +library(pharmaverseadam) library(lubridate) library(stringr) -data("admiral_adsl") +data("adsl") data("rs_onco_recist") data("tu_onco_recist") -adsl <- admiral_adsl rs <- rs_onco_recist tu <- tu_onco_recist @@ -192,7 +163,7 @@ adrs <- adrs %>% PARAM = "Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1" + PARCAT3 = "RECIST 1.1" ) ``` @@ -344,12 +315,13 @@ adrs <- adrs %>% order = exprs(ADT, RSSEQ), mode = "first", exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "PD", PARAM = "Disease Progression by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -414,7 +386,7 @@ adrs <- adrs %>% PARAM = "Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -464,7 +436,7 @@ adrs <- adrs %>% PARAM = "Clinical Benefit by Investigator (confirmation for response not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -501,7 +473,7 @@ adrs <- adrs %>% PARAM = "Best Overall Response by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) @@ -558,12 +530,13 @@ adrs <- adrs %>% order = exprs(ADT, RSSEQ), mode = "first", exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "BCP", PARAM = "Best Overall Response of CR/PR by Investigator (confirmation not required)", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -602,7 +575,7 @@ adrs <- adrs %>% PARAM = "Confirmed Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -628,7 +601,7 @@ adrs <- adrs %>% PARAM = "Confirmed Clinical Benefit by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -646,7 +619,7 @@ adrs <- adrs %>% PARAM = "Best Confirmed Overall Response by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = aval_resp(AVALC), ANL01FL = "Y" ) @@ -659,12 +632,13 @@ adrs <- adrs %>% order = exprs(ADT, RSSEQ), mode = "first", exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "CBCP", PARAM = "Best Confirmed Overall Response of CR/PR by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -700,7 +674,7 @@ adrs_bicr <- rs %>% PARAM = "Overall Response by BICR", PARCAT1 = "Tumor Response", PARCAT2 = "Blinded Independent Central Review", - PARCAT3 = "Recist 1.1" + PARCAT3 = "RECIST 1.1" ) ``` @@ -733,6 +707,7 @@ adrs <- adrs %>% by_vars = exprs(STUDYID, USUBJID), filter_add = !is.na(DTHDT), exist_flag = AVALC, + false_value = "N", set_values_to = exprs( PARAMCD = "DEATH", PARAM = "Death", @@ -772,7 +747,7 @@ adrs <- adrs %>% PARAM = "Last Disease Assessment by Investigator", PARCAT1 = "Tumor Response", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", ANL01FL = "Y" ) ) @@ -810,7 +785,7 @@ adrs <- adrs %>% PARAMCD = "MDIS", PARAM = "Measurable Disease at Baseline by Investigator", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = yn_to_numeric(AVALC), ANL01FL = "Y" ) @@ -872,4 +847,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADRS_BASIC | `r dyn_link("ad_adrs_basic.R", "https://github.com/pharmaverse/admiralonco/blob", "inst/templates/ad_adrs_basic.R", is_multiversion = TRUE)` +ADRS_BASIC | `use_ad_template("ADRS_BASIC")` diff --git a/vignettes/articles/website-versions.Rmd b/vignettes/articles/website-versions.Rmd new file mode 100644 index 00000000..5143f6d2 --- /dev/null +++ b/vignettes/articles/website-versions.Rmd @@ -0,0 +1,82 @@ +--- +title: "Previous Versions of Website" +--- + +```{r, include = FALSE} +# TO USE THIS ARTICLE, THE DESCRIPTION FILE MUST INCLUDE +# Config/Needs/website: gert +# Make sure to copy the gh-pages branch to your local git + +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +```{r setup, include=FALSE} +base_url <- + "https://pharmaverse.github.io/admiralonco/" # include the trailing backslash! + +# get list of all files in the `gh-pages` branch +df_all_files <- tryCatch(gert::git_ls(ref = "gh-pages"), error = function(x) FALSE) + +# if a local user (not on CI) does not have a copy of the `gh-pages` branch, exit silently +if (!isTRUE(as.logical(Sys.getenv("CI"))) && isFALSE(df_all_files)) { + knitr::knit_exit() +} +``` + +```{r include=FALSE} +# extract all folders in the root of the branch +all_folders <- + sub("/.*", "", df_all_files$path)[grepl( + x = df_all_files$path, + pattern = "/", + fixed = TRUE + )] |> + unique() + +# subset to all version folders +all_version_folders <- + all_folders[grep("^v[0-9]+|dev", x = all_folders)] |> + rev() +# more dev first if it appears +if ("dev" %in% all_version_folders) { + all_version_folders <- c("dev", all_version_folders) |> unique() +} + +# release dates of prior tags +df_tags <- gert::git_tag_list() +df_tags <- df_tags[df_tags$name %in% all_version_folders, ] +df_tags$date <- + lapply( + df_tags$commit, + FUN = function(x) { + tryCatch( + gert::git_commit_info(ref = x)$time |> as.Date() |> as.character(), + error = function(x) NA + ) + } + ) |> + unlist() +df_tags <- df_tags[!is.na(df_tags$date), ] + +lst_tag_dates <- + paste0(" (", df_tags$date, ")") |> + as.list() |> + setNames(df_tags$name) + +# string with all markdown links +str_website_links <- + lapply( + X = all_version_folders, + FUN = function(x) { + x_label <- ifelse(x %in% "dev", "Development Site", x) + paste0("[", x_label, lst_tag_dates[[x]], "](", paste0(base_url, x), ")") + } + ) |> + unlist() |> + paste(collapse = "\n\n") +``` + +`r str_website_links` From 24127e6c765853c346015c32da32ecea2f89787e Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Tue, 5 Dec 2023 17:44:45 +0000 Subject: [PATCH 16/40] #256 admiral_updates: update ADTR and ADTTE vignettes and templates --- inst/templates/ad_adrs.R | 4 +- inst/templates/ad_adrs_basic.R | 4 +- inst/templates/ad_adtr.R | 49 ++++----------- inst/templates/ad_adtte.R | 8 +-- vignettes/adtr.Rmd | 111 +++++++-------------------------- vignettes/adtte.Rmd | 46 +++----------- 6 files changed, 52 insertions(+), 170 deletions(-) diff --git a/inst/templates/ad_adrs.R b/inst/templates/ad_adrs.R index 88be60aa..495d7328 100644 --- a/inst/templates/ad_adrs.R +++ b/inst/templates/ad_adrs.R @@ -6,6 +6,7 @@ library(admiral) library(admiralonco) library(pharmaversesdtm) # Contains example datasets from the CDISC pilot project +library(pharmaverseadam) # Contains example datasets from the CDISC pilot project library(dplyr) library(lubridate) library(stringr) @@ -16,11 +17,10 @@ library(stringr) # as needed and assign to the variables below. # For illustration purposes read in pharmaverse test data -data("admiral_adsl") +data("adsl") data("rs_onco_recist") data("tu_onco_recist") -adsl <- admiral_adsl rs <- rs_onco_recist tu <- tu_onco_recist diff --git a/inst/templates/ad_adrs_basic.R b/inst/templates/ad_adrs_basic.R index 9c1a2eef..05e8150a 100644 --- a/inst/templates/ad_adrs_basic.R +++ b/inst/templates/ad_adrs_basic.R @@ -14,6 +14,7 @@ library(admiral) library(admiralonco) library(pharmaversesdtm) # Contains example datasets from the CDISC pilot project +library(pharmaverseadam) # Contains example datasets from the CDISC pilot project library(dplyr) library(lubridate) library(stringr) @@ -24,11 +25,10 @@ library(stringr) # as needed and assign to the variables below. # For illustration purposes read in pharmaverse test data -data("admiral_adsl") +data("adsl") data("rs_onco_recist") data("tu_onco_recist") -adsl <- admiral_adsl rs <- rs_onco_recist tu <- tu_onco_recist diff --git a/inst/templates/ad_adtr.R b/inst/templates/ad_adtr.R index 516f75fe..83376184 100644 --- a/inst/templates/ad_adtr.R +++ b/inst/templates/ad_adtr.R @@ -6,6 +6,7 @@ library(admiral) library(admiralonco) library(pharmaversesdtm) # Contains example datasets from the CDISC pilot project +library(pharmaverseadam) # Contains example datasets from the CDISC pilot project library(dplyr) library(lubridate) library(stringr) @@ -15,11 +16,10 @@ library(stringr) # Use e.g. haven::read_sas to read in .sas7bdat, or other suitable functions # as needed and assign to the variables below. # For illustration purposes read in pharmaverse test data -data("admiral_adsl") +data("adsl") data("rs_onco_recist") data("tu_onco_recist") data("tr_onco_recist") -adsl <- admiral_adsl tu <- tu_onco_recist tr <- tr_onco_recist rs <- rs_onco_recist @@ -107,26 +107,27 @@ adtr <- bind_rows( mutate( PARCAT1 = "Target Lesion(s)", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = TRSTRESN, ANL01FL = if_else(!is.na(AVAL), "Y", NA_character_) ) %>% select(-tmp_lesion_nr) # Derive parameter for sum of diameter (SDIAM) ---- -adtr_sum <- get_summary_records( - adtr, +adtr_sum <- derive_summary_records( + dataset_add = adtr, by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, AVISIT, AVISITN), - filter = (str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | + filter_add = (str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | (str_starts(PARAMCD, "NLDIAM") & TULOCGR1 == "NODAL"), - analysis_var = AVAL, - summary_fun = function(x) sum(x, na.rm = TRUE), set_values_to = exprs( + AVAL = sum(AVAL, na.rm = TRUE), + ADY = min(ADY, na.rm = TRUE), + ADT = min(ADT, na.rm = TRUE), PARAMCD = "SDIAM", PARAM = "Target Lesions Sum of Diameters by Investigator", PARCAT1 = "Target Lesion(s)", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1" + PARCAT3 = "RECIST 1.1" ) ) @@ -138,44 +139,19 @@ adtr_sum <- adtr_sum %>% filter_add = AVISIT == "BASELINE" & ((str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | (str_starts(PARAMCD, "NLDIAM") & TULOCGR1 == "NODAL")), - new_var = LSEXP, - analysis_var = TRLNKID, - summary_fun = function(x) paste(sort(x), collapse = ", ") + new_vars = exprs(LSEXP = paste(sort(TRLNKID), collapse = ", ")) ) %>% derive_var_merged_summary( dataset_add = adtr, by_vars = exprs(USUBJID, AVISIT), filter_add = ((str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | (str_starts(PARAMCD, "NLDIAM") & TULOCGR1 == "NODAL")) & ANL01FL == "Y", - new_var = LSASS, - analysis_var = TRLNKID, - summary_fun = function(x) paste(sort(x), collapse = ", ") + new_vars = exprs(LSASS = paste(sort(TRLNKID), collapse = ", ")) ) %>% mutate( ANL01FL = if_else(LSEXP == LSASS, "Y", NA_character_) ) -# Derive timing variables for sums (ADT, ADY) ---- -adtr_sum <- adtr_sum %>% - derive_var_merged_summary( - dataset_add = adtr, - by_vars = exprs(USUBJID, AVISIT), - filter_add = (str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | - (str_starts(PARAMCD, "NLDIAM") & TULOCGR1 == "NODAL"), - new_var = ADY, - analysis_var = ADY, - summary_fun = function(x) min(x, na.rm = TRUE) - ) %>% - derive_var_merged_summary( - dataset_add = adtr, - by_vars = exprs(USUBJID, AVISIT), - filter_add = (str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | - (str_starts(PARAMCD, "NLDIAM") & TULOCGR1 == "NODAL"), - new_var = ADT, - analysis_var = ADT, - summary_fun = function(x) min(x, na.rm = TRUE) - ) - # Derive baseline (ABLFL, BASE) ---- adtr_sum <- adtr_sum %>% restrict_derivation( @@ -200,6 +176,7 @@ adtr_sum <- adtr_sum %>% order = exprs(AVAL), new_vars = exprs(NADIR = AVAL), join_vars = exprs(ADY), + join_type = "all", filter_add = ANL01FL == "Y", filter_join = ADY.join < ADY, mode = "first", diff --git a/inst/templates/ad_adtte.R b/inst/templates/ad_adtte.R index 80d0b470..0b8dcef8 100644 --- a/inst/templates/ad_adtte.R +++ b/inst/templates/ad_adtte.R @@ -5,6 +5,7 @@ # Input: adsl, adrs, tte_source objects library(admiral) library(admiralonco) +library(pharmaverseadam) # Contains example datasets from the CDISC pilot project library(dplyr) library(lubridate) @@ -14,11 +15,10 @@ library(lubridate) # as needed and assign to the variables below. # For illustration purposes read in admiral test data -data("admiral_adsl") -data("admiral_adrs") +data("adsl") +data("adrs_onco") -adsl <- admiral_adsl -adrs <- admiral_adrs +adrs <- adrs_onco # Derivations ---- diff --git a/vignettes/adtr.Rmd b/vignettes/adtr.Rmd index b8855ba7..ee14c0ce 100644 --- a/vignettes/adtr.Rmd +++ b/vignettes/adtr.Rmd @@ -13,34 +13,6 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) -library(admiral) -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral" library(admiraldev) ``` @@ -78,6 +50,7 @@ The examples of this vignette require the following packages. library(admiral) library(dplyr) library(pharmaversesdtm) +library(pharmaverseadam) library(lubridate) library(stringr) library(admiralonco) @@ -104,8 +77,8 @@ To start, all data frames needed for the creation of `ADTR` should be read into Some of the data frames needed may be `ADSL`, `ADRS` ,`RS`, `TU`, `TR`, `SUPPTU` `SUPPTR`. For example purposes, the SDTM and ADaM datasets (based on CDISC Pilot test -data)---which are included in `{pharmaversesdtm}`---are used. Also, see -[Handling of Missing +data)---which are included in `{pharmaversesdtm}` and `{pharmaverseadam}`---are +used. Also, see [Handling of Missing Values](https://pharmaverse.github.io/admiral/cran-release/articles/admiral.html#handling-of-missing-values) explains why we need to use the `convert_blanks_to_na()` function. @@ -116,13 +89,12 @@ then the template code where we derive parameters for lesions diameters should be updated accordingly. ```{r} -data("admiral_adsl") -data("admiral_adrs") +data("adsl") +data("adrs_onco") data("rs_onco_recist") data("tu_onco_recist") data("tr_onco_recist") -adsl <- admiral_adsl -adrs <- admiral_adrs +adrs <- adrs_onco tu <- tu_onco_recist tr <- tr_onco_recist rs <- rs_onco_recist @@ -272,7 +244,7 @@ adtr <- bind_rows( mutate( PARCAT1 = "Target Lesion(s)", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1", + PARCAT3 = "RECIST 1.1", AVAL = TRSTRESN, ANL01FL = if_else(!is.na(AVAL), "Y", NA_character_) ) %>% @@ -302,21 +274,24 @@ flags therefore should be setup according to your company specifications. In the example below, the lesion sizes are counted and grouped according to the by variables specified, in this case we group by the visit (`AVISIT` and `AVISITN`) to ensure that the correct lesion measurements are summed together. +If there are different analysis day/dates (`ADY`/`ADT`) associated with a +particular visit, we take the minimum day/date. ```{r} -adtr_sum <- get_summary_records( - adtr, +adtr_sum <- derive_summary_records( + dataset_add = adtr, by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, AVISIT, AVISITN), - filter = (str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | + filter_add = (str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | (str_starts(PARAMCD, "NLDIAM") & TULOCGR1 == "NODAL"), - analysis_var = AVAL, - summary_fun = function(x) sum(x, na.rm = TRUE), set_values_to = exprs( + AVAL = sum(AVAL, na.rm = TRUE), + ADY = min(ADY, na.rm = TRUE), + ADT = min(ADT, na.rm = TRUE), PARAMCD = "SDIAM", PARAM = "Target Lesions Sum of Diameters by Investigator", PARCAT1 = "Target Lesion(s)", PARCAT2 = "Investigator", - PARCAT3 = "Recist 1.1" + PARCAT3 = "RECIST 1.1" ) ) ``` @@ -325,10 +300,10 @@ adtr_sum <- get_summary_records( dataset_vignette( adtr_sum %>% arrange(USUBJID, AVISITN) %>% - select(USUBJID, PARAMCD, PARAM, AVISIT, AVAL, everything()), - display_vars = exprs(USUBJID, PARAMCD, PARAM, AVISIT, AVAL) + select(USUBJID, PARAMCD, PARAM, AVISIT, AVAL, ADT, ADY, everything()), + display_vars = exprs(USUBJID, PARAMCD, PARAM, AVISIT, AVAL, ADT, ADY) ) -``` +``` The analysis flag `ANL01FL` flags the sum of diameters where the number of lesions assessed at baseline and at post-baseline match. To assess whether the number of lesions expected and assessed match, you could compare lesion identifiers (`TR.TRLNKID`) or use the previous variables set up earlier to compare lesion expected (`LSEXP`) vs lesion assessed (`LSASS`) or check for target lesion response (from `RS`) = `NE`. A target lesion response of `NE` means all lesions from baseline are not measured at that post-baseline visit. @@ -354,58 +329,20 @@ adtr_sum <- adtr_sum %>% filter_add = AVISIT == "BASELINE" & ((str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | (str_starts(PARAMCD, "NLDIAM") & TULOCGR1 == "NODAL")), - new_var = LSEXP, - analysis_var = TRLNKID, - summary_fun = function(x) paste(sort(x), collapse = ", ") + new_vars = exprs(LSEXP = paste(sort(TRLNKID), collapse = ", ")) ) %>% derive_var_merged_summary( dataset_add = adtr, by_vars = exprs(USUBJID, AVISIT), filter_add = ((str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | (str_starts(PARAMCD, "NLDIAM") & TULOCGR1 == "NODAL")) & ANL01FL == "Y", - new_var = LSASS, - analysis_var = TRLNKID, - summary_fun = function(x) paste(sort(x), collapse = ", ") + new_vars = exprs(LSASS = paste(sort(TRLNKID), collapse = ", ")) ) %>% mutate( ANL01FL = if_else(LSEXP == LSASS, "Y", NA_character_) ) ``` -In the next step we include the analysis day and date (`ADY`/`ADT`) variables to -the sum of diameter parameter dataset. If there are different analysis -day/dates associated with a particular visit, we take the minimum day/date. - -```{r} -adtr_sum <- adtr_sum %>% - derive_var_merged_summary( - dataset_add = adtr, - by_vars = exprs(USUBJID, AVISIT), - filter_add = (str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | - (str_starts(PARAMCD, "NLDIAM") & TULOCGR1 == "NODAL"), - new_var = ADY, - analysis_var = ADY, - summary_fun = function(x) min(x, na.rm = TRUE) - ) %>% - derive_var_merged_summary( - dataset_add = adtr, - by_vars = exprs(USUBJID, AVISIT), - filter_add = (str_starts(PARAMCD, "LDIAM") & TULOCGR1 == "NON-NODAL") | - (str_starts(PARAMCD, "NLDIAM") & TULOCGR1 == "NODAL"), - new_var = ADT, - analysis_var = ADT, - summary_fun = function(x) min(x, na.rm = TRUE) - ) -``` - -```{r, echo=FALSE} -dataset_vignette( - arrange(adtr_sum, USUBJID, AVISITN), - display_vars = exprs(USUBJID, PARAMCD, AVISIT, LSEXP, LSASS, ANL01FL, ADT, ADY) -) -``` - - ## Derive Baseline (`ABLFL`, `BASE`) {#base} These functions are available in `admiral`, below examples show its usage for @@ -746,8 +683,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -`ADTR` | `r dyn_link("ad_adtr.R", "https://github.com/pharmaverse/admiralonco/blob", "inst/templates/ad_adtr.R", is_multiversion = TRUE)` - - - - +`ADTR` | `use_ad_template("ADTR)` diff --git a/vignettes/adtte.Rmd b/vignettes/adtte.Rmd index 34c26d54..acb390f3 100644 --- a/vignettes/adtte.Rmd +++ b/vignettes/adtte.Rmd @@ -13,34 +13,6 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" - library(admiraldev) ``` @@ -70,6 +42,7 @@ The examples of this vignette require the following packages. ```{r, warning=FALSE, message=FALSE} library(admiral) library(admiralonco) +library(pharmaverseadam) library(dplyr) library(lubridate) ``` @@ -87,15 +60,14 @@ library(lubridate) To start, all datasets needed for the creation of the time-to-event dataset should be read into the environment. This will be a company specific process. -For example purpose, the ADaM datasets---which are included -in `{admiral}` and `{admiralonco}`---are used. An alternative might be to use -`ADEVENT` as input. +For example purpose, the ADaM datasets---which are included in +`{pharmaverseadam}`---are used. An alternative might be to use `ADEVENT` as +input. ```{r} -data("admiral_adsl") -data("admiral_adrs") -adsl <- admiral_adsl -adrs <- admiral_adrs +data("adsl") +data("adrs_onco") +adrs <- adrs_onco ``` ## Derive Parameters (`CNSR`, `ADT`, `STARTDT`) {#parameters} @@ -219,7 +191,7 @@ dataset_vignette( ### Creating Your Own Time-to-Event Source Objects {#tteobj} We advise you consult the `{admiral}` -`r dyn_link("Creating a BDS Time-to-Event ADaM vignette", admiral_homepage, "articles/bds_tte.html")` +[Creating a BDS Time-to-Event ADaM vignette](https://pharmaverse.github.io/admiral/articles/bds_tte.html) for further guidance on the different options available and more examples. One extra common oncology case we include here is around PFS when censoring @@ -375,4 +347,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADTTE | `r dyn_link("ad_adtte.R", "https://github.com/pharmaverse/admiralonco/blob", "inst/templates/ad_adtte.R", is_multiversion = TRUE)` +ADTTE | `use_ad_template("ADTTE")` From 6597e7e2e216ebabbf482661372178209036ae29 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 6 Dec 2023 11:53:16 +0000 Subject: [PATCH 17/40] #256 admiral_updates: update NACDT vignette, supersede functions, clean up reference page --- NAMESPACE | 1 - NEWS.md | 17 ++++++ R/derive_param_bor.R | 9 ++- R/derive_param_clinbenefit.R | 9 ++- R/derive_param_confirmed_bor.R | 9 ++- R/derive_param_confirmed_resp.R | 9 ++- R/derive_param_response.R | 9 ++- R/filter_pd.R | 8 ++- R/utils.R | 58 ------------------- _pkgdown.yml | 27 +++------ man/call_aval_fun.Rd | 43 -------------- man/derive_param_bor.Rd | 12 ++-- man/derive_param_clinbenefit.Rd | 12 ++-- man/derive_param_confirmed_bor.Rd | 12 ++-- man/derive_param_confirmed_resp.Rd | 12 ++-- man/derive_param_response.Rd | 12 ++-- man/filter_pd.Rd | 15 ++++- vignettes/nactdt.Rmd | 90 ++++++++++++------------------ 18 files changed, 151 insertions(+), 213 deletions(-) delete mode 100644 R/utils.R delete mode 100644 man/call_aval_fun.Rd diff --git a/NAMESPACE b/NAMESPACE index 265b3115..4bdf6159 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,7 +7,6 @@ export(bor_non_crpd) export(bor_pd) export(bor_pr) export(bor_sd) -export(call_aval_fun) export(cb_y) export(cbor_cr) export(cbor_pr) diff --git a/NEWS.md b/NEWS.md index 94bb5da0..de140f7a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,23 @@ - Website now has button/links to Slack channel and GitHub Issues. (#262) +## Documentation + +- All vignettes and templates were updated to be in line with the changes in +`{admiral}` (see [Breaking +Changes](https://pharmaverse.github.io/admiral/news/index.html#breaking-changes-1-0-0) +for details)(#256). + +## Breaking Changes + +- The `derive_*()` functions were superseded in favor of +`derive_extreme_event()`. (#256) + +- The `filter_pd()` function was superseded in favor of `filter_relative()`. (#256) + +- The function `call_aval_fun()`, which was deprecated in admiralonco 0.4.0, +has been removed. (#256) + # admiralonco 0.5.0 ## New Features diff --git a/R/derive_param_bor.R b/R/derive_param_bor.R index 9932aefc..10911356 100644 --- a/R/derive_param_bor.R +++ b/R/derive_param_bor.R @@ -1,5 +1,9 @@ #' Adds a Parameter for Best Overall Response (without confirmation) #' +#' @description +#' `r lifecycle::badge("superseded")` The `derive_param_bor()` function has been +#' superseded in favor of `derive_extreme_event()`. +#' #' Adds a parameter for best overall response, without confirmation, optionally up to #' first progressive disease #' @@ -252,9 +256,8 @@ #' #' @author Stephen Gormley #' -#' @family der_prm_adrs -#' -#' @keywords der_prm_adrs +#' @family superseded +#' @keywords superseded #' #' @return The dataframe passed in the `dataset` argument with additional columns and/or #' rows as set in the `set_values_to` argument. diff --git a/R/derive_param_clinbenefit.R b/R/derive_param_clinbenefit.R index 96af16f9..b67d8e6b 100644 --- a/R/derive_param_clinbenefit.R +++ b/R/derive_param_clinbenefit.R @@ -1,5 +1,9 @@ #' Adds a Parameter for Clinical Benefit #' +#' @description +#' `r lifecycle::badge("superseded")` The `derive_param_clinbenefit()` function +#' has been superseded in favor of `derive_extreme_event()`. +#' #' Adds a parameter for clinical benefit/disease control #' #' @details @@ -114,9 +118,8 @@ #' #' @return The input dataset with a new parameter for clinical benefit #' -#' @family der_prm_adrs -#' -#' @keywords der_prm_adrs +#' @family superseded +#' @keywords superseded #' #' @export #' diff --git a/R/derive_param_confirmed_bor.R b/R/derive_param_confirmed_bor.R index 0e4401cc..545290c8 100644 --- a/R/derive_param_confirmed_bor.R +++ b/R/derive_param_confirmed_bor.R @@ -1,5 +1,9 @@ #' Adds a Parameter for Confirmed Best Overall Response #' +#' @description +#' `r lifecycle::badge("superseded")` The `derive_param_confirmed_bor()` +#' function has been superseded in favor of `derive_extreme_event()`. +#' #' Adds a parameter for confirmed best overall response (BOR) #' #' @param dataset Input dataset @@ -187,9 +191,8 @@ #' @return The input dataset with a new parameter for confirmed best overall #' response #' -#' @family der_prm_adrs -#' -#' @keywords der_prm_adrs +#' @family superseded +#' @keywords superseded #' #' @author Stefan Bundfuss #' diff --git a/R/derive_param_confirmed_resp.R b/R/derive_param_confirmed_resp.R index 6629db52..164b6ca8 100644 --- a/R/derive_param_confirmed_resp.R +++ b/R/derive_param_confirmed_resp.R @@ -1,5 +1,9 @@ #' Adds a Parameter for Confirmed Response #' +#' @description +#' `r lifecycle::badge("superseded")` The `derive_param_confirmed_resp()` +#' function has been superseded in favor of `derive_extreme_event()`. +#' #' Adds a parameter for confirmed response #' #' @param dataset Input dataset @@ -135,9 +139,8 @@ #' #' @return The input dataset with a new parameter for confirmed response #' -#' @family der_prm_adrs -#' -#' @keywords der_prm_adrs +#' @family superseded +#' @keywords superseded #' #' @author Stefan Bundfuss #' diff --git a/R/derive_param_response.R b/R/derive_param_response.R index e5fe61b1..0cd7eeda 100644 --- a/R/derive_param_response.R +++ b/R/derive_param_response.R @@ -1,6 +1,10 @@ #' Adds a Parameter Indicating If a Subject Had a Response before Progressive #' Disease #' +#' @description +#' `r lifecycle::badge("superseded")` The `derive_param_response()` function has +#' been superseded in favor of `derive_extreme_event()`. +#' #' Adds a parameter indicating if a response has been observed. #' If a response has been observed, `AVALC` is set to "Y", `AVAL` to 1 and `ADT` #' is set to the @@ -104,9 +108,8 @@ #' @return The input dataset with a new parameter indicating if and when a #' response occurred #' -#' @family der_prm_adrs -#' -#' @keywords der_prm_adrs +#' @family superseded +#' @keywords superseded #' #' @export #' diff --git a/R/filter_pd.R b/R/filter_pd.R index 4a39c479..c788b4b0 100644 --- a/R/filter_pd.R +++ b/R/filter_pd.R @@ -1,5 +1,9 @@ #' Filter up to First PD (Progressive Disease) Date #' +#' @description +#' `r lifecycle::badge("superseded")` The `filter_pd()` function has been +#' superseded in favor of `filter_relative()`. +#' #' Filter a dataset to only include the source parameter records up to and #' including the first PD (progressive disease). These records are passed to #' downstream derivations regarding responses such as BOR (best overall @@ -45,8 +49,8 @@ #' #' @export #' -#' @keywords utils_fil -#' @family utils_fil +#' @family superseded +#' @keywords superseded #' #' @examples #' diff --git a/R/utils.R b/R/utils.R deleted file mode 100644 index 5d73cb01..00000000 --- a/R/utils.R +++ /dev/null @@ -1,58 +0,0 @@ -#' Creates `AVAL` from `AVALC` by Calling User Function -#' -#' @description -#' `r lifecycle::badge("deprecated")` -#' -#' This function is *deprecated*, please use -#' `admiraldev::process_set_values_to()` instead. -#' -#' Create `AVAL` from `AVALC` by calling a function provided by the user. If -#' calling the function fails, the error is caught and a helpful error message -#' provided. -#' -#' @param dataset Input dataset -#' -#' The variable `AVALC` is expected. -#' -#' *Permitted Values*: a dataframe -#' -#' @param aval_fun Function returning the `AVALC` values -#' -#' The specified function must expect one argument expecting a character -#' vector and must return a numeric vector. -#' -#' *Permitted Values*: a function -#' -#' @details The new variable `AVAL` is set to `aval_fun(AVALC)`. -#' -#' @author Stefan Bundfuss -#' -#' @returns The input dataset with `AVAL` added -#' -#' @keywords deprecated -#' @family deprecated -#' -#' @export -call_aval_fun <- function(dataset, - aval_fun) { - assert_data_frame(dataset, required_vars = exprs(AVALC)) - assert_function(aval_fun) - - deprecate_warn("0.4.0", "call_aval_fun()", "admiraldev::process_set_values_to()") - - tryCatch( - mutate( - dataset, - AVAL = aval_fun(AVALC) - ), - error = function(cnd) { - abort( - paste0( - "Assigning new AVAL records with aval_fun (`AVAL = aval_fun(AVALC)`) has failed.\n", - "Error message:\n ", - cnd - ) - ) - } - ) -} diff --git a/_pkgdown.yml b/_pkgdown.yml index 98293920..9251a627 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -20,14 +20,7 @@ development: reference: - - title: Derivations for Adding Parameters - - subtitle: ADRS-specific - desc: Parameter Derivation Functions helpful for building the ADRS dataset - - contents: - - has_keyword("der_prm_adrs") - - - title: Advanced Functions - - subtitle: Pre-Defined Objects + - title: Pre-Defined Objects desc: 'Objects defined by {admiralonco} that can be used as input for derivations' - contents: - has_keyword("source_specifications") @@ -41,22 +34,18 @@ reference: - contents: - has_keyword('utils_ds_chk') - - subtitle: Utilities for Filtering Observations - - contents: - - has_keyword('utils_fil') - - title: Example Datasets desc: You can run `admiral::use_ad_template()` to produce additional datasets - contents: - has_keyword('datasets') - - title: Relocated/Deprecated - - subtitle: Functions moved to another admiraldev package - - contents: - - has_keyword("move_adm_dev") - - subtitle: Deprecated - - contents: - - has_keyword("deprecated") + - title: Superseded + desc: | + Superseded functions have been replaced with better functions. However, we + will not be removing these functions from `{admiralonco}`. We do strongly + encourage you to make the switch over. + contents: + - has_keyword("superseded") navbar: structure: diff --git a/man/call_aval_fun.Rd b/man/call_aval_fun.Rd deleted file mode 100644 index d0c2f761..00000000 --- a/man/call_aval_fun.Rd +++ /dev/null @@ -1,43 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{call_aval_fun} -\alias{call_aval_fun} -\title{Creates \code{AVAL} from \code{AVALC} by Calling User Function} -\usage{ -call_aval_fun(dataset, aval_fun) -} -\arguments{ -\item{dataset}{Input dataset - -The variable \code{AVALC} is expected. - -\emph{Permitted Values}: a dataframe} - -\item{aval_fun}{Function returning the \code{AVALC} values - -The specified function must expect one argument expecting a character -vector and must return a numeric vector. - -\emph{Permitted Values}: a function} -} -\value{ -The input dataset with \code{AVAL} added -} -\description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} - -This function is \emph{deprecated}, please use -\code{admiraldev::process_set_values_to()} instead. - -Create \code{AVAL} from \code{AVALC} by calling a function provided by the user. If -calling the function fails, the error is caught and a helpful error message -provided. -} -\details{ -The new variable \code{AVAL} is set to \code{aval_fun(AVALC)}. -} -\author{ -Stefan Bundfuss -} -\concept{deprecated} -\keyword{deprecated} diff --git a/man/derive_param_bor.Rd b/man/derive_param_bor.Rd index 73f36043..986d665e 100644 --- a/man/derive_param_bor.Rd +++ b/man/derive_param_bor.Rd @@ -119,6 +119,9 @@ The dataframe passed in the \code{dataset} argument with additional columns and/ rows as set in the \code{set_values_to} argument. } \description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}} The \code{derive_param_bor()} function has been +superseded in favor of \code{derive_extreme_event()}. + Adds a parameter for best overall response, without confirmation, optionally up to first progressive disease } @@ -270,14 +273,15 @@ derive_param_bor( filter(PARAMCD == "BOR") } \seealso{ -ADRS Functions for adding Parameters: +Other superseded: \code{\link{derive_param_clinbenefit}()}, \code{\link{derive_param_confirmed_bor}()}, \code{\link{derive_param_confirmed_resp}()}, -\code{\link{derive_param_response}()} +\code{\link{derive_param_response}()}, +\code{\link{filter_pd}()} } \author{ Stephen Gormley } -\concept{der_prm_adrs} -\keyword{der_prm_adrs} +\concept{superseded} +\keyword{superseded} diff --git a/man/derive_param_clinbenefit.Rd b/man/derive_param_clinbenefit.Rd index 030a79d1..be7b0884 100644 --- a/man/derive_param_clinbenefit.Rd +++ b/man/derive_param_clinbenefit.Rd @@ -80,6 +80,9 @@ used to uniquely identify subjects.} The input dataset with a new parameter for clinical benefit } \description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}} The \code{derive_param_clinbenefit()} function +has been superseded in favor of \code{derive_extreme_event()}. + Adds a parameter for clinical benefit/disease control } \details{ @@ -206,14 +209,15 @@ derive_param_clinbenefit( filter(PARAMCD == "CBR") } \seealso{ -ADRS Functions for adding Parameters: +Other superseded: \code{\link{derive_param_bor}()}, \code{\link{derive_param_confirmed_bor}()}, \code{\link{derive_param_confirmed_resp}()}, -\code{\link{derive_param_response}()} +\code{\link{derive_param_response}()}, +\code{\link{filter_pd}()} } \author{ Andrew Smith } -\concept{der_prm_adrs} -\keyword{der_prm_adrs} +\concept{superseded} +\keyword{superseded} diff --git a/man/derive_param_confirmed_bor.Rd b/man/derive_param_confirmed_bor.Rd index 7c375b8e..b9b6f5b4 100644 --- a/man/derive_param_confirmed_bor.Rd +++ b/man/derive_param_confirmed_bor.Rd @@ -132,6 +132,9 @@ The input dataset with a new parameter for confirmed best overall response } \description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}} The \code{derive_param_confirmed_bor()} +function has been superseded in favor of \code{derive_extreme_event()}. + Adds a parameter for confirmed best overall response (BOR) } \details{ @@ -334,14 +337,15 @@ derive_param_confirmed_bor( filter(PARAMCD == "CBOR") } \seealso{ -ADRS Functions for adding Parameters: +Other superseded: \code{\link{derive_param_bor}()}, \code{\link{derive_param_clinbenefit}()}, \code{\link{derive_param_confirmed_resp}()}, -\code{\link{derive_param_response}()} +\code{\link{derive_param_response}()}, +\code{\link{filter_pd}()} } \author{ Stefan Bundfuss } -\concept{der_prm_adrs} -\keyword{der_prm_adrs} +\concept{superseded} +\keyword{superseded} diff --git a/man/derive_param_confirmed_resp.Rd b/man/derive_param_confirmed_resp.Rd index 55ff439a..313b9dfc 100644 --- a/man/derive_param_confirmed_resp.Rd +++ b/man/derive_param_confirmed_resp.Rd @@ -104,6 +104,9 @@ A list of symbols created using \code{exprs()} is expected.} The input dataset with a new parameter for confirmed response } \description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}} The \code{derive_param_confirmed_resp()} +function has been superseded in favor of \code{derive_extreme_event()}. + Adds a parameter for confirmed response } \details{ @@ -268,14 +271,15 @@ derive_param_confirmed_resp( filter(PARAMCD == "CRSP") } \seealso{ -ADRS Functions for adding Parameters: +Other superseded: \code{\link{derive_param_bor}()}, \code{\link{derive_param_clinbenefit}()}, \code{\link{derive_param_confirmed_bor}()}, -\code{\link{derive_param_response}()} +\code{\link{derive_param_response}()}, +\code{\link{filter_pd}()} } \author{ Stefan Bundfuss } -\concept{der_prm_adrs} -\keyword{der_prm_adrs} +\concept{superseded} +\keyword{superseded} diff --git a/man/derive_param_response.Rd b/man/derive_param_response.Rd index 3ee56c42..c51e628a 100644 --- a/man/derive_param_response.Rd +++ b/man/derive_param_response.Rd @@ -88,6 +88,9 @@ The input dataset with a new parameter indicating if and when a response occurred } \description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}} The \code{derive_param_response()} function has +been superseded in favor of \code{derive_extreme_event()}. + Adds a parameter indicating if a response has been observed. If a response has been observed, \code{AVALC} is set to "Y", \code{AVAL} to 1 and \code{ADT} is set to the @@ -179,14 +182,15 @@ derive_param_response( arrange(USUBJID, PARAMCD, ADT) } \seealso{ -ADRS Functions for adding Parameters: +Other superseded: \code{\link{derive_param_bor}()}, \code{\link{derive_param_clinbenefit}()}, \code{\link{derive_param_confirmed_bor}()}, -\code{\link{derive_param_confirmed_resp}()} +\code{\link{derive_param_confirmed_resp}()}, +\code{\link{filter_pd}()} } \author{ Samia Kabi } -\concept{der_prm_adrs} -\keyword{der_prm_adrs} +\concept{superseded} +\keyword{superseded} diff --git a/man/filter_pd.Rd b/man/filter_pd.Rd index 01584822..3f2e147d 100644 --- a/man/filter_pd.Rd +++ b/man/filter_pd.Rd @@ -38,6 +38,9 @@ A list of symbols created using \code{exprs()} is expected.} A subset of the input dataset } \description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}} The \code{filter_pd()} function has been +superseded in favor of \code{filter_relative()}. + Filter a dataset to only include the source parameter records up to and including the first PD (progressive disease). These records are passed to downstream derivations regarding responses such as BOR (best overall @@ -187,8 +190,16 @@ filter_pd( source_datasets = list(adrs = adrs) ) } +\seealso{ +Other superseded: +\code{\link{derive_param_bor}()}, +\code{\link{derive_param_clinbenefit}()}, +\code{\link{derive_param_confirmed_bor}()}, +\code{\link{derive_param_confirmed_resp}()}, +\code{\link{derive_param_response}()} +} \author{ Teckla Akinyi, Stefan Bundfuss } -\concept{utils_fil} -\keyword{utils_fil} +\concept{superseded} +\keyword{superseded} diff --git a/vignettes/nactdt.Rmd b/vignettes/nactdt.Rmd index 94c5decf..7df6f161 100644 --- a/vignettes/nactdt.Rmd +++ b/vignettes/nactdt.Rmd @@ -13,35 +13,6 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) -library(admiralonco) -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" - library(admiraldev) ``` @@ -72,7 +43,9 @@ library(admiral) library(pharmaverseadam) library(dplyr) +data("adsl") adsl_onco <- adsl +data("adrs_onco") cm <- tribble( ~STUDYID, ~USUBJID, ~CMCAT, ~CMSCAT, ~CMTRT, ~CMSTDTC, @@ -121,24 +94,29 @@ dataset_vignette( ## Multiple Sources - Prerequisite Steps {#multiinput} -To derive the New Anti-Cancer Therapy start date with data from multiple sources, the function `admiral::derive_var_extreme_dt()` can be used, or if time part is needed, `admiral::derive_var_extreme_dtm()` can be used. - +To derive the New Anti-Cancer Therapy start date with data from multiple +sources, the function `admiral::derive_vars_extreme_event()` can be used. ### Prerequisite -Prior to calling the function, an input `date_source` object must be created for each source dataset using `admiral::date_source()`. Within this function, any company-specific subsetting can be passed to the `filter` argument. If numeric version of the dates will be needed, `admiral::convert_dtc_to_dt()`, or if time part is needed, `admiral::convert_dtc_to_dtm()` can be used as part of an expression for the `new_vars` argument. +Prior to calling the function, an input `event` object must be created for each +source dataset using `admiral::event()`. Within this function, any +company-specific subsetting can be passed to the `condition` argument. If +numeric version of the dates will be needed, `admiral::convert_dtc_to_dt()`, or +if time part is needed, `admiral::convert_dtc_to_dtm()` can be used as part of +an expression for the `set_values_to` argument. ```{r message=FALSE} -cm_date <- date_source( +cm_date <- event( dataset_name = "cm", - filter = CMSCAT == "CHEMOTHERAPY" & CMCAT == "ON TREATMENT" & !is.na(CMSTDTC), - date = convert_dtc_to_dt(CMSTDTC) + condition = CMSCAT == "CHEMOTHERAPY" & CMCAT == "ON TREATMENT" & !is.na(CMSTDTC), + set_values_to = exprs(NACTDT = convert_dtc_to_dt(CMSTDTC)) ) -pr_date <- date_source( +pr_date <- event( dataset_name = "pr", - filter = PRCAT == "CANCER RELATED" & PRSCAT == "ON TREATMENT" & !is.na(PRSTDTC), - date = convert_dtc_to_dt(PRSTDTC) + condition = PRCAT == "CANCER RELATED" & PRSCAT == "ON TREATMENT" & !is.na(PRSTDTC), + set_values_to = exprs(NACTDT = convert_dtc_to_dt(PRSTDTC)) ) ``` @@ -148,9 +126,11 @@ After completion of the prerequisite step, the new anti-cancer date can be deriv ```{r message=FALSE} adsl <- adsl_onco %>% - derive_var_extreme_dt( - new_var = NACTDT, - cm_date, pr_date, + derive_vars_extreme_event( + by_vars = exprs(STUDYID, USUBJID), + order = exprs(NACTDT), + new_vars = exprs(NACTDT), + events = list(cm_date, pr_date), source_datasets = list( cm = cm, pr = pr @@ -173,28 +153,32 @@ Please refer to `{admiralonco}` [Derive `ANL01FL`](adrs.html#anl01fl) for an exa ## Derive Date Parameter {#par} -As of `{admiral}` version 0.11.0, `admiral::derive_param_extreme_record()` is recommended to be used for deriving parameter based on the first or last observation from single and multiple sources. +The `{admiral}` function `admiral::derive_extreme_event()` can be used for +deriving parameter based on the first or last observation from single and +multiple sources. -Based on individual company standards, this parameter may be added to an event or date dataset such as `ADEVENT` or `ADDATES`, which are generally intermediate datasets to `ADTTE`. For demonstration purpose, a new anti-cancer date parameter will be merged into `ADRS`. A list of `record_source()` objects is expected and this will contain the sources of the dates and any company specific filtering. +Based on individual company standards, this parameter may be added to an event +or date dataset such as `ADEVENT` or `ADDATES`, which are generally intermediate +datasets to `ADTTE`. For demonstration purpose, a new anti-cancer date parameter +will be merged into `ADRS`. A list of `event()` objects is expected and this +will contain the sources of the dates and any company specific filtering. ```{r, eval=TRUE, echo=TRUE} -library(admiralonco) - -adrs <- derive_param_extreme_record( +adrs <- derive_extreme_event( dataset = adrs_onco, - sources = list( - records_source( + events = list( + event( dataset_name = "cm", - filter = CMSCAT == "CHEMOTHERAPY" & CMCAT == "ON TREATMENT" & !is.na(CMSTDTC), - new_vars = exprs( + condition = CMSCAT == "CHEMOTHERAPY" & CMCAT == "ON TREATMENT" & !is.na(CMSTDTC), + set_values_to = exprs( ADT = convert_dtc_to_dt(CMSTDTC), AVALC = CMTRT ) ), - records_source( + event( dataset_name = "pr", - filter = PRCAT == "CANCER RELATED" & PRSCAT == "ON TREATMENT" & !is.na(PRSTDTC), - new_vars = exprs( + condition = PRCAT == "CANCER RELATED" & PRSCAT == "ON TREATMENT" & !is.na(PRSTDTC), + set_values_to = exprs( ADT = convert_dtc_to_dt(PRSTDTC), AVALC = PRTRT ) From 855af4192c9093ce91741f45b5f9f41120ab630e Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 6 Dec 2023 11:59:58 +0000 Subject: [PATCH 18/40] #256 admiral_updates: fix links --- .github/ISSUE_TEMPLATE/05_onboard.yml | 40 --------------------------- .github/pull_request_template.md | 6 ++-- 2 files changed, 3 insertions(+), 43 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/05_onboard.yml diff --git a/.github/ISSUE_TEMPLATE/05_onboard.yml b/.github/ISSUE_TEMPLATE/05_onboard.yml deleted file mode 100644 index 9f6897a0..00000000 --- a/.github/ISSUE_TEMPLATE/05_onboard.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Onboarding Tasks -description: Bringing a Core or non-Core member onto the admiral team [for admiral team only] -title: "Onboarding: " -labels: ["onboarding"] -assignees: - - octocat -body: - - type: markdown - attributes: - value: | - Welcome to the Team! We love contributors! - - type: checkboxes - id: core - attributes: - label: Onboarding tasks for Core (Roche-GSK) Team Members - description: - options: - - label: Given a tour of Github from a Core member - - label: Understand how to Create Issues and do a Pull Request - - label: Understand the Programming Strategy - - label: Read and understand [Developer Guides Articles](https://pharmaverse.github.io/admiraldev/devel/articles/index.html) - - label: Invited to all relevant meetings - Stand Ups, Retrospective, Sprint Planning, Question/Comments, Backlog, Community Meeting - - label: Given access to Box and relevant documents - - label: Given write access to Github Repository - - label: Slack channel invites to admiral and admiralonco_dev - - label: Introduction to Teams ways of working - - type: checkboxes - id: non-core - attributes: - label: Onboarding tasks for non-Core Team Members - description: - options: - - label: Given a tour of Github from a Core member - - label: Understand how to Create Issues and do a Pull Request - - label: Understand the Programming Strategy - - label: Read and understand [Developer Guides Articles](https://pharmaverse.github.io/admiraldev/devel/articles/index.html) - - label: Invited to all relevant meetings - Question/Comments, Community Meeting - - label: Given write access to Github Repository - - label: Slack channel invites to admiral - - label: Introduction to Teams ways of working diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7564ba9d..d11e6fcb 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,13 +1,13 @@ Please add "Closes #" to the title of the pull request. Then the issue is closed automatically once it is merged to `main`. -Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiraldev/main/articles/development_process.html) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent. +Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiraldev/articles/development_process.html) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent. Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the `devel` branch until you have checked off each task. - [ ] Code is formatted according to the [tidyverse style guide](https://style.tidyverse.org/). Run `styler::style_file()` to style R and Rmd files -- [ ] Updated relevant unit tests or have written new unit tests - See [Unit Test Guide](https://pharmaverse.github.io/admiraldev/main/articles/unit_test_guidance.html#writing-unit-tests-in-admiral) -- [ ] If you removed/replaced any function and/or function parameters, did you fully follow the [deprecation guidance](https://pharmaverse.github.io/admiraldev/main/articles/programming_strategy.html#deprecation)? +- [ ] Updated relevant unit tests or have written new unit tests - See [Unit Test Guide](https://pharmaverse.github.io/admiraldev/articles/unit_test_guidance.html#writing-unit-tests-in-admiral) +- [ ] If you removed/replaced any function and/or function parameters, did you fully follow the [deprecation guidance](https://pharmaverse.github.io/admiraldev/articles/programming_strategy.html#deprecation)? - [ ] Update to all relevant roxygen headers and examples - [ ] Run `devtools::document()` so all `.Rd` files in the `man` folder and the `NAMESPACE` file in the project root are updated appropriately - [ ] Address any updates needed for vignettes and/or templates From 5dafdd2861b4a1fc3d1c610d231b1798d98d38d6 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 6 Dec 2023 12:01:21 +0000 Subject: [PATCH 19/40] #256 admiral_updates: style files --- vignettes/nactdt.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/nactdt.Rmd b/vignettes/nactdt.Rmd index 7df6f161..6c5b0f46 100644 --- a/vignettes/nactdt.Rmd +++ b/vignettes/nactdt.Rmd @@ -45,7 +45,7 @@ library(dplyr) data("adsl") adsl_onco <- adsl -data("adrs_onco") +data("adrs_onco") cm <- tribble( ~STUDYID, ~USUBJID, ~CMCAT, ~CMSCAT, ~CMTRT, ~CMSTDTC, From e19af2e498f50a608687c3aba61c41ebebfb9e8a Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 6 Dec 2023 12:02:57 +0000 Subject: [PATCH 20/40] #256 admiral_updates: fix spelling --- inst/WORDLIST | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/inst/WORDLIST b/inst/WORDLIST index 20951a07..b69b563e 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -4,6 +4,7 @@ ADTR ADTTE ADaM ADaMs +BDS BICR BOR Biologics @@ -20,22 +21,18 @@ Pre RECIST SDTM SDTMs -adrs censorings chk datetime -der ds durations evaluable -fil fmt funder iRECIST myeloma pharmaverse pre -prm quosures radiological rda From 157f86afccafe5fa762f483a0f376be7d88ca56b Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 6 Dec 2023 12:07:30 +0000 Subject: [PATCH 21/40] #256 admiral_updates: fix tests --- tests/testthat/test-utils.R | 53 ------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 tests/testthat/test-utils.R diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R deleted file mode 100644 index 541b84c9..00000000 --- a/tests/testthat/test-utils.R +++ /dev/null @@ -1,53 +0,0 @@ -data <- tibble::tribble( - ~AVALC, - "YES", - "NO" -) - -# call_aval_fun ---- - -## Test 1: AVAL is created ---- -test_that("call_aval_fun Test 1: AVAL is created", { - yn_map <- function(x) { - case_when( - x == "YES" ~ 1, - x == "NO" ~ 0 - ) - } - - expect_warning( - actual <- call_aval_fun( - data, - yn_map - ), - class = "lifecycle_warning_deprecated" - ) - - expect_dfs_equal( - actual, - tibble::tribble( - ~AVALC, ~AVAL, - "YES", 1, - "NO", 0 - ), - keys = c("AVAL") - ) -}) - -## Test 2: Test error for invalid aval_fun ---- -test_that("call_aval_fun Test 2: Test error for invalid aval_fun", { - bad_fun <- function(x) { - abort("Function bad_fun failed!") - } - - expect_error( - suppress_warning( - call_aval_fun( - data, - aval_fun = bad_fun - ), - regexpr = "deprecated" - ), - regexp = "Assigning new AVAL records with aval_fun" - ) -}) From a3f79c96ecb9ff6d6eb773936dff3b3c0cbca4b5 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 6 Dec 2023 14:24:40 +0000 Subject: [PATCH 22/40] #256 admiral_updates: fix R-CMD check --- R/derive_param_confirmed_bor.R | 14 +++++++------- R/derive_param_confirmed_resp.R | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/derive_param_confirmed_bor.R b/R/derive_param_confirmed_bor.R index 545290c8..bf1af99a 100644 --- a/R/derive_param_confirmed_bor.R +++ b/R/derive_param_confirmed_bor.R @@ -422,7 +422,7 @@ derive_param_confirmed_bor <- function(dataset, ADT.join >= ADT + days(!!ref_confirm), filter_join = AVALC == "CR" & all(AVALC.join %in% c("CR", "NE")) & - count_vals(var = AVALC.join, val = "NE") <= !!max_nr_ne + {{ count_vals }}(var = AVALC.join, val = "NE") <= !!max_nr_ne ) %>% mutate(tmp_order = 1) @@ -442,15 +442,15 @@ derive_param_confirmed_bor <- function(dataset, ADT.join >= ADT + days(!!ref_confirm), filter_join = AVALC == "PR" & all(AVALC.join %in% c("CR", "PR", "SD", "NE")) & - count_vals(var = AVALC.join, val = "NE") <= !!max_nr_ne & - count_vals(var = AVALC.join, val = "SD") <= !!max_nr_sd & + {{ count_vals }}(var = AVALC.join, val = "NE") <= !!max_nr_ne & + {{ count_vals }}(var = AVALC.join, val = "SD") <= !!max_nr_sd & ( - min_cond( + {{ min_cond }}( var = ADT.join, cond = AVALC.join == "CR" - ) > max_cond(var = ADT.join, cond = AVALC.join == "PR") | - count_vals(var = AVALC.join, val = "CR") == 0 | - count_vals(var = AVALC.join, val = "PR") == 0 + ) > {{ max_cond }}(var = ADT.join, cond = AVALC.join == "PR") | + {{ count_vals }}(var = AVALC.join, val = "CR") == 0 | + {{ count_vals }}(var = AVALC.join, val = "PR") == 0 ) ) %>% mutate(tmp_order = 2) diff --git a/R/derive_param_confirmed_resp.R b/R/derive_param_confirmed_resp.R index 164b6ca8..c0347181 100644 --- a/R/derive_param_confirmed_resp.R +++ b/R/derive_param_confirmed_resp.R @@ -354,7 +354,7 @@ derive_param_confirmed_resp <- function(dataset, ADT.join >= ADT + days(!!ref_confirm), filter_join = AVALC == "CR" & all(AVALC.join %in% c("CR", "NE")) & - count_vals(var = AVALC.join, val = "NE") <= !!max_nr_ne + {{ count_vals }}(var = AVALC.join, val = "NE") <= !!max_nr_ne ) %>% mutate( AVALC = "Y" @@ -376,15 +376,15 @@ derive_param_confirmed_resp <- function(dataset, ADT.join >= ADT + days(!!ref_confirm), filter_join = AVALC == "PR" & all(AVALC.join %in% c("CR", "PR", "SD", "NE")) & - count_vals(var = AVALC.join, val = "NE") <= !!max_nr_ne & - count_vals(var = AVALC.join, val = "SD") <= !!max_nr_sd & + {{ count_vals }}(var = AVALC.join, val = "NE") <= !!max_nr_ne & + {{ count_vals }}(var = AVALC.join, val = "SD") <= !!max_nr_sd & ( - min_cond( + {{ min_cond}}( var = ADT.join, cond = AVALC.join == "CR" - ) > max_cond(var = ADT.join, cond = AVALC.join == "PR") | - count_vals(var = AVALC.join, val = "CR") == 0 | - count_vals(var = AVALC.join, val = "PR") == 0 + ) > {{ max_cond}}(var = ADT.join, cond = AVALC.join == "PR") | + {{ count_vals }}(var = AVALC.join, val = "CR") == 0 | + {{ count_vals }}(var = AVALC.join, val = "PR") == 0 ) ) %>% mutate( From 0b67b38dafa0de72590c231b3311d0146bfd5bc4 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 6 Dec 2023 14:32:00 +0000 Subject: [PATCH 23/40] #256 admiral_updates: style files --- R/derive_param_confirmed_resp.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/derive_param_confirmed_resp.R b/R/derive_param_confirmed_resp.R index c0347181..26c0b6ee 100644 --- a/R/derive_param_confirmed_resp.R +++ b/R/derive_param_confirmed_resp.R @@ -379,10 +379,10 @@ derive_param_confirmed_resp <- function(dataset, {{ count_vals }}(var = AVALC.join, val = "NE") <= !!max_nr_ne & {{ count_vals }}(var = AVALC.join, val = "SD") <= !!max_nr_sd & ( - {{ min_cond}}( + {{ min_cond }}( var = ADT.join, cond = AVALC.join == "CR" - ) > {{ max_cond}}(var = ADT.join, cond = AVALC.join == "PR") | + ) > {{ max_cond }}(var = ADT.join, cond = AVALC.join == "PR") | {{ count_vals }}(var = AVALC.join, val = "CR") == 0 | {{ count_vals }}(var = AVALC.join, val = "PR") == 0 ) From 83d4e66bf40d36877564f9d6f7dfdc4b88c0f54d Mon Sep 17 00:00:00 2001 From: Vinh Nguyen Date: Wed, 6 Dec 2023 13:07:56 -0500 Subject: [PATCH 24/40] #233 - iRECIST vignette - 3rd round comment update. --- _pkgdown.yml | 4 ++-- vignettes/irecist.Rmd | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index 01123833..af54376b 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -72,14 +72,14 @@ navbar: href: articles/adrs_basic.html - text: Creating ADRS (Including Non-standard Endpoints) href: articles/adrs.html + - text: Creating ADRS with iRECIST endpoints + href: articles/irecist.html - text: Creating ADTTE href: articles/adtte.html - text: Creating ADTR href: articles/adtr.html - text: Creating and Using New Anti-Cancer Start Date href: articles/nactdt.html - - text: Creating ADRS with iRECIST endpoints - href: articles/irecist.html slack: icon: fa-slack href: https://app.slack.com/client/T028PB489D3/C02M8KN8269 diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index d081eca0..e0ac5bc7 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -426,8 +426,11 @@ records. For the parameter derivations, all values except those overwritten by `set_values_to` argument are kept from the earliest occurring input record fulfilling the required criteria. -When an iCPD occurs, the date of progression would be the same as -RECIST 1.1 date (i.e., first `iUPD` date in that block/bar). +When an `iCPD` occurs, the date of progression would be the first occurrence of `iUPD` in that block. +For example, when we have values of `iUPD`, `iUPD`, and `iCPD`, the iRECIST `PD` date would +be the first occurrence of `iUPD`. In cases where we have `SD`, `SD`, `iUPD`, `PR`, `PR`, `iUPD`, and `iCPD`, +the iRECIST `PD` date would be the second occurrence of `iUPD`. + The function `admiral::derive_extreme_records()`, in conjunction with the event `icpd_y`, could be used to find the date of the first `iUPD`. @@ -902,13 +905,10 @@ dataset_vignette( The following parameters may also be added: -BCP - Best Overall Response of CR/PR by Investigator (confirmation not required)
-CBCP - Best Confirmed Overall Response of CR/PR by Investigator
-A1BOR - Best Overall Response by Investigator (confirmation not required) - RECIST 1.1 adjusted for NED at Baseline
-ACCB - Alternative Confirmed Clinical Benefit by Investigator
-OVRB - Overall Response by BICR
-DEATH - Death
-LSTA - Last Disease Assessment by Investigator
-MDIS - Measurable Disease at Baseline by Investigator +IBCP - iRECIST Best Overall Response of CR/PR by Investigator (confirmation not required)
+ICBCP - iRECIST Best Confirmed Overall Response of CR/PR by Investigator
+IOVRB - iRECIST Overall Response by BICR
+ILSTA - iRECIST Last Disease Assessment by Investigator
+IMDIS - iRECIST Measurable Disease at Baseline by Investigator For examples on the additional endpoints, please see [Creating ADRS (Including Non-standard Endpoints)](adrs.html). From 6773720d4fb321c09a19daa4735d8d16fe4ea54e Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Thu, 7 Dec 2023 10:39:33 +0000 Subject: [PATCH 25/40] #256 admiral_updates: fix reference to templates, clarify superseding --- NEWS.md | 4 +++- inst/templates/ad_adrs.R | 4 +++- inst/templates/ad_adrs_basic.R | 4 +++- inst/templates/ad_adtr.R | 4 +++- inst/templates/ad_adtte.R | 4 +++- vignettes/adrs.Rmd | 2 +- vignettes/adrs_basic.Rmd | 2 +- vignettes/adtr.Rmd | 2 +- vignettes/adtte.Rmd | 2 +- 9 files changed, 19 insertions(+), 9 deletions(-) diff --git a/NEWS.md b/NEWS.md index de140f7a..2a0c4698 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,7 +14,9 @@ for details)(#256). ## Breaking Changes - The `derive_*()` functions were superseded in favor of -`derive_extreme_event()`. (#256) +`derive_extreme_event()`. Any superseded functions can continue to be used as +demonstrated via the "Basic ADRS" vignette, as they will remain supported and +won't be deprecated in the near future. (#256) - The `filter_pd()` function was superseded in favor of `filter_relative()`. (#256) diff --git a/inst/templates/ad_adrs.R b/inst/templates/ad_adrs.R index 495d7328..94f02c94 100644 --- a/inst/templates/ad_adrs.R +++ b/inst/templates/ad_adrs.R @@ -6,7 +6,9 @@ library(admiral) library(admiralonco) library(pharmaversesdtm) # Contains example datasets from the CDISC pilot project -library(pharmaverseadam) # Contains example datasets from the CDISC pilot project +# pharmaverseadam contains example datasets generated from the CDISC pilot +# project SDTM ran through admiral templates +library(pharmaverseadam) library(dplyr) library(lubridate) library(stringr) diff --git a/inst/templates/ad_adrs_basic.R b/inst/templates/ad_adrs_basic.R index 05e8150a..15565a68 100644 --- a/inst/templates/ad_adrs_basic.R +++ b/inst/templates/ad_adrs_basic.R @@ -14,7 +14,9 @@ library(admiral) library(admiralonco) library(pharmaversesdtm) # Contains example datasets from the CDISC pilot project -library(pharmaverseadam) # Contains example datasets from the CDISC pilot project +# pharmaverseadam contains example datasets generated from the CDISC pilot +# project SDTM ran through admiral templates +library(pharmaverseadam) library(dplyr) library(lubridate) library(stringr) diff --git a/inst/templates/ad_adtr.R b/inst/templates/ad_adtr.R index 83376184..abf7b7c8 100644 --- a/inst/templates/ad_adtr.R +++ b/inst/templates/ad_adtr.R @@ -6,7 +6,9 @@ library(admiral) library(admiralonco) library(pharmaversesdtm) # Contains example datasets from the CDISC pilot project -library(pharmaverseadam) # Contains example datasets from the CDISC pilot project +# pharmaverseadam contains example datasets generated from the CDISC pilot +# project SDTM ran through admiral templates +library(pharmaverseadam) library(dplyr) library(lubridate) library(stringr) diff --git a/inst/templates/ad_adtte.R b/inst/templates/ad_adtte.R index 0b8dcef8..e5b0debf 100644 --- a/inst/templates/ad_adtte.R +++ b/inst/templates/ad_adtte.R @@ -5,7 +5,9 @@ # Input: adsl, adrs, tte_source objects library(admiral) library(admiralonco) -library(pharmaverseadam) # Contains example datasets from the CDISC pilot project +# pharmaverseadam contains example datasets generated from the CDISC pilot +# project SDTM ran through admiral templates +library(pharmaverseadam) library(dplyr) library(lubridate) diff --git a/vignettes/adrs.Rmd b/vignettes/adrs.Rmd index fffc3103..8d2a013c 100644 --- a/vignettes/adrs.Rmd +++ b/vignettes/adrs.Rmd @@ -1085,4 +1085,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADRS | `use_ad_template("ADRS")` +ADRS | `admiral::use_ad_template(package = "admiralonco", "ADRS")` diff --git a/vignettes/adrs_basic.Rmd b/vignettes/adrs_basic.Rmd index 60939eec..744c88fd 100644 --- a/vignettes/adrs_basic.Rmd +++ b/vignettes/adrs_basic.Rmd @@ -847,4 +847,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADRS_BASIC | `use_ad_template("ADRS_BASIC")` +ADRS_BASIC | `admiral::use_ad_template(package = "admiralonco", "ADRS_BASIC")` diff --git a/vignettes/adtr.Rmd b/vignettes/adtr.Rmd index ee14c0ce..2e32e15d 100644 --- a/vignettes/adtr.Rmd +++ b/vignettes/adtr.Rmd @@ -683,4 +683,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -`ADTR` | `use_ad_template("ADTR)` +`ADTR` | `admiral::use_ad_template(package = "admiralonco", "ADTR")` diff --git a/vignettes/adtte.Rmd b/vignettes/adtte.Rmd index acb390f3..80f7f004 100644 --- a/vignettes/adtte.Rmd +++ b/vignettes/adtte.Rmd @@ -347,4 +347,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADTTE | `use_ad_template("ADTTE")` +ADTTE | `admiral::use_ad_template(package = "admiralonco", "ADTTE")` From 2911f9466dae544b6546fdb99fa7584aecedb32a Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Thu, 7 Dec 2023 11:10:07 +0000 Subject: [PATCH 26/40] #256 admiral_updates: update use_ad_template() calls --- vignettes/adrs.Rmd | 2 +- vignettes/adrs_basic.Rmd | 2 +- vignettes/adtr.Rmd | 2 +- vignettes/adtte.Rmd | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vignettes/adrs.Rmd b/vignettes/adrs.Rmd index 8d2a013c..052da5ca 100644 --- a/vignettes/adrs.Rmd +++ b/vignettes/adrs.Rmd @@ -1085,4 +1085,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADRS | `admiral::use_ad_template(package = "admiralonco", "ADRS")` +ADRS | `admiral::use_ad_template("ADRS", package = "admiralonco")` diff --git a/vignettes/adrs_basic.Rmd b/vignettes/adrs_basic.Rmd index 744c88fd..0a0e3b25 100644 --- a/vignettes/adrs_basic.Rmd +++ b/vignettes/adrs_basic.Rmd @@ -847,4 +847,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADRS_BASIC | `admiral::use_ad_template(package = "admiralonco", "ADRS_BASIC")` +ADRS_BASIC | `admiral::use_ad_template("ADRS_BASIC", package = "admiralonco")` diff --git a/vignettes/adtr.Rmd b/vignettes/adtr.Rmd index 2e32e15d..4408a5dc 100644 --- a/vignettes/adtr.Rmd +++ b/vignettes/adtr.Rmd @@ -683,4 +683,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -`ADTR` | `admiral::use_ad_template(package = "admiralonco", "ADTR")` +`ADTR` | `admiral::use_ad_template("ADTR", package = "admiralonco")` diff --git a/vignettes/adtte.Rmd b/vignettes/adtte.Rmd index 80f7f004..cd481bdf 100644 --- a/vignettes/adtte.Rmd +++ b/vignettes/adtte.Rmd @@ -347,4 +347,4 @@ dataset_vignette( ADaM | Sample Code ---- | -------------- -ADTTE | `admiral::use_ad_template(package = "admiralonco", "ADTTE")` +ADTTE | `admiral::use_ad_template("ADTTE", package = "admiralonco")` From a4c655eaf800f0c3dd0b4e319113628d46f0f229 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Thu, 7 Dec 2023 14:57:54 +0000 Subject: [PATCH 27/40] #256 admiral_updates: update Get Started page --- _pkgdown.yml | 10 ++++---- vignettes/admiralonco.Rmd | 50 +++++++-------------------------------- 2 files changed, 15 insertions(+), 45 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index 9251a627..c3852c00 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -21,7 +21,7 @@ development: reference: - title: Pre-Defined Objects - desc: 'Objects defined by {admiralonco} that can be used as input for derivations' + desc: 'Objects defined by `{admiralonco}` that can be used as input for derivations' - contents: - has_keyword("source_specifications") @@ -41,9 +41,11 @@ reference: - title: Superseded desc: | - Superseded functions have been replaced with better functions. However, we - will not be removing these functions from `{admiralonco}`. We do strongly - encourage you to make the switch over. + Superseded functions have been replaced with more flexible functions that + allow for construction of more diverse endpoints for a wider array of + oncology indications, beyond solid tumor/RECIST. However, we will not be + removing these functions from `{admiralonco}` in the near future and they + will continue to be supported. contents: - has_keyword("superseded") diff --git a/vignettes/admiralonco.Rmd b/vignettes/admiralonco.Rmd index 33347b16..4c73029c 100644 --- a/vignettes/admiralonco.Rmd +++ b/vignettes/admiralonco.Rmd @@ -12,50 +12,18 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" ``` # Introduction -As this is a package extension, if you are new to `{admiral}` then the best place to first start -reading would be this `r dyn_link("Get Started", admiral_homepage, "articles/admiral.html")` -guide. This extension package follows the same main idea and conventions, and re-uses many -functions from `{admiral}`, so it is important to thoroughly understand these to be able to -use `{admiralonco}`. +As this is a package extension, if you are new to `{admiral}` then the best +place to first start reading would be the [Get +Started](https://pharmaverse.github.io/admiral/articles/admiral.html) page. This +extension package follows the same main idea and conventions, and re-uses many +functions from `{admiral}`, so it is important to thoroughly understand these to +be able to use `{admiralonco}`. -# Derivations - -The most important functions in `{admiralonco}` are the -[derivations](../reference/index.html#section-derivations). Again these follow the same -conventions as `{admiral}` but are focused to oncology-specific needs. - -# Starting a Script +# Creating Oncology ADaM Datasets For the oncology ADaM data structures, an overview of the flow and example function calls for the most common steps are provided by the following vignettes: @@ -66,7 +34,7 @@ for the most common steps are provided by the following vignettes: - [Creating ADTR](adtr.html) `{admiralonco}` also provides template R scripts as a starting point. They can be -created by calling `use_ad_template()` from {admiral}, e.g., +created by calling `use_ad_template()` from `{admiral}`, e.g., ```{r} library(admiral) @@ -81,7 +49,7 @@ use_ad_template( ``` A list of all available templates can be obtained by `list_all_templates()` -from {admiral}: +from `{admiral}`: ```{r} list_all_templates(package = "admiralonco") From 4eddbec6890630e416408e0ef2bc8a0a813fae2d Mon Sep 17 00:00:00 2001 From: Vinh Nguyen Date: Fri, 8 Dec 2023 09:59:21 -0500 Subject: [PATCH 28/40] 233 - updated sort for AVAL --- vignettes/irecist.Rmd | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index e0ac5bc7..605c4738 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -223,7 +223,7 @@ dataset_vignette( ### Derive `AVALC` and `AVAL` Here we populate `AVALC` and create the numeric version as `AVAL` -(ordered from worst to best response). The `AVAL` values are not considered in +(ordered from worst to best response, followed by `NE` and MISSING). The `AVAL` values are not considered in the parameter derivations below, and so changing `AVAL` here would not change the result of those derivations. However, please note that the ordering of `AVAL` will be used to determine `ANL01FL` in the subsequent step, ensure that the appropriate @@ -235,14 +235,14 @@ could do this as follows: ```{r} aval_resp_new <- function(arg) { case_when( - arg == "iCR" ~ 8, - arg == "iPR" ~ 7, - arg == "iSD" ~ 6, - arg == "NON-iCR/NON-iUPD" ~ 5, - arg == "iUPD" ~ 4, - arg == "iCPD" ~ 3, - arg == "NE" ~ 2, - arg == "MISSING" ~ 1, + arg == "NE" ~ 8, + arg == "MISSING" ~ 7, + arg == "iCR" ~ 6, + arg == "iPR" ~ 5, + arg == "iSD" ~ 4, + arg == "NON-iCR/NON-iUPD" ~ 3, + arg == "iUPD" ~ 2, + arg == "iCPD" ~ 1, TRUE ~ NA_real_ ) } From e8b5b7f861f9d0c324c8c8a7cfa05a2487238b53 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Tue, 12 Dec 2023 15:20:00 +0000 Subject: [PATCH 29/40] #256 admiral_updates: fix flagging of worst --- inst/templates/ad_adrs.R | 14 +++++++++++++- inst/templates/ad_adrs_basic.R | 14 +++++++++++++- vignettes/adrs.Rmd | 16 ++++++++++++++-- vignettes/adrs_basic.Rmd | 14 +++++++++++++- 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/inst/templates/ad_adrs.R b/inst/templates/ad_adrs.R index 94f02c94..872067cd 100644 --- a/inst/templates/ad_adrs.R +++ b/inst/templates/ad_adrs.R @@ -77,12 +77,24 @@ adrs <- adrs %>% # parameter derivations - here only valid assessments and those occurring on or # after randomization date, if there is more than one assessment per date the # worst one is flagged +worst_resp <- function(arg) { + case_when( + arg == "CR" ~ 1, + arg == "PR" ~ 2, + arg == "SD" ~ 3, + arg == "NON-CR/NON-PD" ~ 4, + arg == "NE" ~ 5, + arg == "PD" ~ 6, + TRUE ~ 0 + ) +} + adrs <- adrs %>% restrict_derivation( derivation = derive_var_extreme_flag, args = params( by_vars = exprs(STUDYID, USUBJID, ADT), - order = exprs(AVAL, RSSEQ), + order = exprs(worst_resp(AVALC), RSSEQ), new_var = ANL01FL, mode = "last" ), diff --git a/inst/templates/ad_adrs_basic.R b/inst/templates/ad_adrs_basic.R index 15565a68..fd59839f 100644 --- a/inst/templates/ad_adrs_basic.R +++ b/inst/templates/ad_adrs_basic.R @@ -85,12 +85,24 @@ adrs <- adrs %>% # parameter derivations - here only valid assessments and those occurring on or # after randomization date, if there is more than one assessment per date the # worst one is flagged +worst_resp <- function(arg) { + case_when( + arg == "CR" ~ 1, + arg == "PR" ~ 2, + arg == "SD" ~ 3, + arg == "NON-CR/NON-PD" ~ 4, + arg == "NE" ~ 5, + arg == "PD" ~ 6, + TRUE ~ 0 + ) +} + adrs <- adrs %>% restrict_derivation( derivation = derive_var_extreme_flag, args = params( by_vars = exprs(STUDYID, USUBJID, ADT), - order = exprs(AVAL, RSSEQ), + order = exprs(worst_resp(AVALC), RSSEQ), new_var = ANL01FL, mode = "last" ), diff --git a/vignettes/adrs.Rmd b/vignettes/adrs.Rmd index 052da5ca..5fb0f1c9 100644 --- a/vignettes/adrs.Rmd +++ b/vignettes/adrs.Rmd @@ -230,12 +230,24 @@ those occurring on or after randomization date. If there is more than one assessment at a date, the worst one is flagged. ```{r} +worst_resp <- function(arg) { + case_when( + arg == "CR" ~ 1, + arg == "PR" ~ 2, + arg == "SD" ~ 3, + arg == "NON-CR/NON-PD" ~ 4, + arg == "NE" ~ 5, + arg == "PD" ~ 6, + TRUE ~ 0 + ) +} + adrs <- adrs %>% restrict_derivation( derivation = derive_var_extreme_flag, args = params( by_vars = exprs(STUDYID, USUBJID, ADT), - order = exprs(AVAL, RSSEQ), + order = exprs(worst_resp(AVALC), RSSEQ), new_var = ANL01FL, mode = "last" ), @@ -492,7 +504,7 @@ rsp_y adrs <- adrs %>% derive_extreme_event( by_vars = exprs(STUDYID, USUBJID), - order = exprs(ADT, event_nr), + order = exprs(event_nr, ADT), tmp_event_nr_var = event_nr, mode = "first", events = list(rsp_y, no_data_n), diff --git a/vignettes/adrs_basic.Rmd b/vignettes/adrs_basic.Rmd index 0a0e3b25..65c8fd69 100644 --- a/vignettes/adrs_basic.Rmd +++ b/vignettes/adrs_basic.Rmd @@ -229,12 +229,24 @@ those occurring on or after randomization date. If there is more than one assessment at a date, the worst one is flagged. ```{r} +worst_resp <- function(arg) { + case_when( + arg == "CR" ~ 1, + arg == "PR" ~ 2, + arg == "SD" ~ 3, + arg == "NON-CR/NON-PD" ~ 4, + arg == "NE" ~ 5, + arg == "PD" ~ 6, + TRUE ~ 0 + ) +} + adrs <- adrs %>% restrict_derivation( derivation = derive_var_extreme_flag, args = params( by_vars = exprs(STUDYID, USUBJID, ADT), - order = exprs(AVAL, RSSEQ), + order = exprs(worst_resp(AVALC), RSSEQ), new_var = ANL01FL, mode = "last" ), From 2c92305c55e6e3a2712529dfce7bdefc7f42481d Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Tue, 12 Dec 2023 15:28:38 +0000 Subject: [PATCH 30/40] #256 admiral_updates: fix links --- .github/pull_request_template.md | 12 ++++++++++-- vignettes/adtr.Rmd | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d11e6fcb..1a75599a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,9 +1,17 @@ Please add "Closes #" to the title of the pull request. Then the issue is closed automatically once it is merged to `main`. -Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiraldev/articles/development_process.html) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent. +Thank you for your Pull Request! We have developed this task checklist from the +[Development Process +Guide](https://pharmaverse.github.io/admiral/CONTRIBUTING.html#detailed-development-process) +to help with the final steps of the process. Completing the below tasks helps to +ensure our reviewers can maximize their time on your code as well as making sure +the admiral codebase remains robust and consistent. -Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the `devel` branch until you have checked off each task. +Please check off each taskbox as an acknowledgment that you completed the task +or check off that it is not relevant to your Pull Request. This checklist is +part of the Github Action workflows and the Pull Request will not be merged into +the `main` branch until you have checked off each task. - [ ] Code is formatted according to the [tidyverse style guide](https://style.tidyverse.org/). Run `styler::style_file()` to style R and Rmd files - [ ] Updated relevant unit tests or have written new unit tests - See [Unit Test Guide](https://pharmaverse.github.io/admiraldev/articles/unit_test_guidance.html#writing-unit-tests-in-admiral) diff --git a/vignettes/adtr.Rmd b/vignettes/adtr.Rmd index 4408a5dc..5bb8c01c 100644 --- a/vignettes/adtr.Rmd +++ b/vignettes/adtr.Rmd @@ -79,7 +79,7 @@ Some of the data frames needed may be `ADSL`, `ADRS` ,`RS`, `TU`, `TR`, `SUPPTU` For example purposes, the SDTM and ADaM datasets (based on CDISC Pilot test data)---which are included in `{pharmaversesdtm}` and `{pharmaverseadam}`---are used. Also, see [Handling of Missing -Values](https://pharmaverse.github.io/admiral/cran-release/articles/admiral.html#handling-of-missing-values) +Values](https://pharmaverse.github.io/admiral/articles/admiral.html#handling-of-missing-values) explains why we need to use the `convert_blanks_to_na()` function. On the `TR` domain we filter on where tumor assessment short name `TRTESTCD` is From 21e5bf81cb84822d1829520dc71a2d52b5245bde Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Tue, 12 Dec 2023 15:36:43 +0000 Subject: [PATCH 31/40] #256 admiral_updates: update worst order --- inst/templates/ad_adrs.R | 10 +++++----- inst/templates/ad_adrs_basic.R | 10 +++++----- vignettes/adrs.Rmd | 10 +++++----- vignettes/adrs_basic.Rmd | 10 +++++----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/inst/templates/ad_adrs.R b/inst/templates/ad_adrs.R index 872067cd..16d5526d 100644 --- a/inst/templates/ad_adrs.R +++ b/inst/templates/ad_adrs.R @@ -79,11 +79,11 @@ adrs <- adrs %>% # worst one is flagged worst_resp <- function(arg) { case_when( - arg == "CR" ~ 1, - arg == "PR" ~ 2, - arg == "SD" ~ 3, - arg == "NON-CR/NON-PD" ~ 4, - arg == "NE" ~ 5, + arg == "NE" ~ 1, + arg == "CR" ~ 2, + arg == "PR" ~ 3, + arg == "SD" ~ 4, + arg == "NON-CR/NON-PD" ~ 5, arg == "PD" ~ 6, TRUE ~ 0 ) diff --git a/inst/templates/ad_adrs_basic.R b/inst/templates/ad_adrs_basic.R index fd59839f..c02ed784 100644 --- a/inst/templates/ad_adrs_basic.R +++ b/inst/templates/ad_adrs_basic.R @@ -87,11 +87,11 @@ adrs <- adrs %>% # worst one is flagged worst_resp <- function(arg) { case_when( - arg == "CR" ~ 1, - arg == "PR" ~ 2, - arg == "SD" ~ 3, - arg == "NON-CR/NON-PD" ~ 4, - arg == "NE" ~ 5, + arg == "NE" ~ 1, + arg == "CR" ~ 2, + arg == "PR" ~ 3, + arg == "SD" ~ 4, + arg == "NON-CR/NON-PD" ~ 5, arg == "PD" ~ 6, TRUE ~ 0 ) diff --git a/vignettes/adrs.Rmd b/vignettes/adrs.Rmd index 5fb0f1c9..8f6593a3 100644 --- a/vignettes/adrs.Rmd +++ b/vignettes/adrs.Rmd @@ -232,11 +232,11 @@ one assessment at a date, the worst one is flagged. ```{r} worst_resp <- function(arg) { case_when( - arg == "CR" ~ 1, - arg == "PR" ~ 2, - arg == "SD" ~ 3, - arg == "NON-CR/NON-PD" ~ 4, - arg == "NE" ~ 5, + arg == "NE" ~ 1, + arg == "CR" ~ 2, + arg == "PR" ~ 3, + arg == "SD" ~ 4, + arg == "NON-CR/NON-PD" ~ 5, arg == "PD" ~ 6, TRUE ~ 0 ) diff --git a/vignettes/adrs_basic.Rmd b/vignettes/adrs_basic.Rmd index 65c8fd69..3df21b59 100644 --- a/vignettes/adrs_basic.Rmd +++ b/vignettes/adrs_basic.Rmd @@ -231,11 +231,11 @@ one assessment at a date, the worst one is flagged. ```{r} worst_resp <- function(arg) { case_when( - arg == "CR" ~ 1, - arg == "PR" ~ 2, - arg == "SD" ~ 3, - arg == "NON-CR/NON-PD" ~ 4, - arg == "NE" ~ 5, + arg == "NE" ~ 1, + arg == "CR" ~ 2, + arg == "PR" ~ 3, + arg == "SD" ~ 4, + arg == "NON-CR/NON-PD" ~ 5, arg == "PD" ~ 6, TRUE ~ 0 ) From 070e05868ebf937577654e08cbd2fb5f0d31a7d5 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Tue, 12 Dec 2023 15:53:23 +0000 Subject: [PATCH 32/40] #233 iRECIST_vignette_main: add changelog item --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 94bb5da0..1041e9e1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # admiralonco (development version) +## Documentation + +- New vignette "Creating ADRS with iRECIST endpoints". (#233) + ## Various - Website now has button/links to Slack channel and GitHub Issues. (#262) From cd2b86e9afff17c9e7d2d90572398db54b64c68f Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Tue, 12 Dec 2023 15:58:46 +0000 Subject: [PATCH 33/40] #233 iRECIST_vignette_main: clean up Changelog --- NEWS.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 0853fb03..4e4ec105 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,12 +4,6 @@ - New vignette "Creating ADRS with iRECIST endpoints". (#233) -## Various - -- Website now has button/links to Slack channel and GitHub Issues. (#262) - -## Documentation - - All vignettes and templates were updated to be in line with the changes in `{admiral}` (see [Breaking Changes](https://pharmaverse.github.io/admiral/news/index.html#breaking-changes-1-0-0) @@ -27,6 +21,10 @@ won't be deprecated in the near future. (#256) - The function `call_aval_fun()`, which was deprecated in admiralonco 0.4.0, has been removed. (#256) +## Various + +- Website now has button/links to Slack channel and GitHub Issues. (#262) + # admiralonco 0.5.0 ## New Features From e84da5f687591308d7cd5bac63f6766c4091b127 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 13 Dec 2023 11:19:51 +0000 Subject: [PATCH 34/40] update workflows --- .github/workflows/common.yml | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 00675f56..e280e090 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -11,19 +11,17 @@ on: # 'push' events are triggered when commits # are pushed to one of these branches push: + tags: + - "v*" branches: - main - - devel - - pre-release - - test + - patch # 'pull_request' events are triggered when PRs are # created against one of these target branches. pull_request: branches: - main - - devel - - pre-release - - test + - patch # 'release' events are triggered when... # you guessed it - when releases are made. release: @@ -37,7 +35,7 @@ concurrency: env: R_VERSION: "4.1" - + jobs: get_r_version: name: Get R version @@ -86,19 +84,13 @@ jobs: docs: name: Documentation uses: pharmaverse/admiralci/.github/workflows/pkgdown.yml@main - if: github.event_name == 'push' + if: github.event_name == 'push' || startsWith(github.ref, 'refs/tags/v') needs: get_r_version with: - r-version: "${{ needs.get_r_version.outputs.r-version }}" - # Whether to skip multiversion docs - # Note that if you have multiple versions of docs, - # your URL links are likely to break due to path changes + r-version: "4.3" skip-multiversion-docs: true - latest-tag-alt-name: main - multiversion-docs-landing-page: main - branches-or-tags-to-list: >- - ^devel$|^main$|^v([0-9]+\\.)?([0-9]+\\.)?([0-9]+)$ - + secrets: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} linter: name: Lint uses: pharmaverse/admiralci/.github/workflows/lintr.yml@main From 27194637b592d1bec87c79264a707016d2e7c6da Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 13 Dec 2023 12:11:20 +0000 Subject: [PATCH 35/40] #233 iRECIST_vignette_main: fix links --- vignettes/irecist.Rmd | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index 605c4738..75a3a92e 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -14,36 +14,6 @@ knitr::opts_chunk$set( comment = "#>" ) -library(admiral) - -link <- function(text, url) { - return( - paste0( - "[", text, "]", - "(", url, ")" - ) - ) -} -dyn_link <- function(text, - base_url, - relative_url = "", - # Change to TRUE when admiral adopts multiversion docs - is_multiversion = FALSE, - multiversion_default_ref = "main") { - url <- paste(base_url, relative_url, sep = "/") - if (is_multiversion) { - url <- paste( - base_url, - Sys.getenv("BRANCH_NAME", multiversion_default_ref), - relative_url, - sep = "/" - ) - } - return(link(text, url)) -} -# Other variables -admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release" - library(admiraldev) ``` From 7d747896ad0db53216d590a0e9c2ea10f28105ba Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 13 Dec 2023 12:28:34 +0000 Subject: [PATCH 36/40] #253 fox_bor_ne: add CR and PR to bor_ne event --- R/response_sources.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/response_sources.R b/R/response_sources.R index c79ed56e..f2fc4c9b 100644 --- a/R/response_sources.R +++ b/R/response_sources.R @@ -136,11 +136,11 @@ bor_pd <- event( #' @export bor_ne <- event( description = paste( - "Define not evaluable (NE) for best overall response (BOR) as SD, NON-CR/NON-PD,", - "or NE (should be specified after bor_sd and bor_non_crpd)" + "Define not evaluable (NE) for best overall response (BOR) as CR, PR, SD,", + "NON-CR/NON-PD, or NE (should be specified after bor_sd and bor_non_crpd)" ), dataset_name = "ovr", - condition = AVALC %in% c("SD", "NON-CR/NON-PD", "NE"), + condition = AVALC %in% c("CR", "PR", "SD", "NON-CR/NON-PD", "NE"), set_values_to = exprs(AVALC = "NE") ) From 5ca324ad6915a8029ab84fcd01bc18bc5af02c45 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 13 Dec 2023 13:41:09 +0000 Subject: [PATCH 37/40] #253 fox_bor_ne: add NEWS item --- NEWS.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS.md b/NEWS.md index 4e4ec105..67b3fcf8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,12 @@ # admiralonco (development version) +## Updates of Existing Functions + +- The `bor_ne` event object was updated such that CR and PR are additionally +considered as event. This ensures that the confirmed best overall response for a +patient with a single CR or PR assessment is derived as `"NE"` instead of +`"MISSING"`. (#253) + ## Documentation - New vignette "Creating ADRS with iRECIST endpoints". (#233) From 18e89c28e6011d71c59023f1184516ac79fb1e78 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 13 Dec 2023 13:46:20 +0000 Subject: [PATCH 38/40] #253 fox_bor_ne: improve line breaks in PR template --- .github/pull_request_template.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 45bac851..e4d47349 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,14 +1,6 @@ -Thank you for your Pull Request! We have developed this task checklist from the -[Development Process -Guide](https://pharmaverse.github.io/admiral/CONTRIBUTING.html#detailed-development-process) -to help with the final steps of the process. Completing the below tasks helps to -ensure our reviewers can maximize their time on your code as well as making sure -the admiral codebase remains robust and consistent. +Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiral/CONTRIBUTING.html#detailed-development-process) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent. -Please check off each taskbox as an acknowledgment that you completed the task -or check off that it is not relevant to your Pull Request. This checklist is -part of the Github Action workflows and the Pull Request will not be merged into -the `main` branch until you have checked off each task. +Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the `main` branch until you have checked off each task. - [ ] Place Closes # into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update). Then the issue is closed automatically once it is merged to `main`. - [ ] Code is formatted according to the [tidyverse style guide](https://style.tidyverse.org/). Run `styler::style_file()` to style R and Rmd files From d583b38290e4b54022356e2dac00b49f9815c4cc Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 13 Dec 2023 14:52:06 +0000 Subject: [PATCH 39/40] #253 fix_bor_ne: add backticks --- NEWS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 67b3fcf8..4228de27 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,9 +2,9 @@ ## Updates of Existing Functions -- The `bor_ne` event object was updated such that CR and PR are additionally +- The `bor_ne` event object was updated such that `CR` and `PR` are additionally considered as event. This ensures that the confirmed best overall response for a -patient with a single CR or PR assessment is derived as `"NE"` instead of +patient with a single `CR` or `PR` assessment is derived as `"NE"` instead of `"MISSING"`. (#253) ## Documentation From dcea67f4227ff7aa54fa6f7a9f11adc42bef8e2f Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Wed, 13 Dec 2023 15:38:47 +0000 Subject: [PATCH 40/40] #253 fix_bor_ne: update ibor_ne --- vignettes/irecist.Rmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vignettes/irecist.Rmd b/vignettes/irecist.Rmd index 75a3a92e..f3d7812f 100644 --- a/vignettes/irecist.Rmd +++ b/vignettes/irecist.Rmd @@ -648,11 +648,11 @@ ibor_iupd <- event( ibor_ne <- event( description = paste( - "Define not evaluable (NE) for best overall response (iBOR) as iSD, NON-iCR/NON-iUPD,", - "or NE (should be specified after ibor_isd and ibor_non_icriupd)" + "Define not evaluable (NE) for best overall response (iBOR) as iCR, iPR, iSD,", + "NON-iCR/NON-iUPD, or NE (should be specified after ibor_isd and ibor_non_icriupd)" ), dataset_name = "ovr", - condition = AVALC %in% c("iSD", "NON-iCR/NON-iUPD", "NE"), + condition = AVALC %in% c("iCR", "iPR", "iSD", "NON-iCR/NON-iUPD", "NE"), set_values_to = exprs(AVALC = "NE") )