diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d3c390ba..ae99c12a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,11 +1,11 @@ -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. - [ ] Place Closes # into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update) - [ ] 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) -- [ ] 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) +- [ ] 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 diff --git a/DESCRIPTION b/DESCRIPTION index 1528899a..b4397768 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: admiralophtha Type: Package Title: ADaM in R Asset Library - Ophthalmology -Version: 0.3.0.9002 +Version: 0.3.0.9003 Authors@R: c( person("Edoardo", "Mancini", email = "edoardo.mancini@roche.com", role = c("aut", "cre")), person("Ritika", "Aggarwal", email = "ritika.aggarwal@novartis.com", role = c("aut")), diff --git a/NEWS.md b/NEWS.md index d34030a4..1749ae65 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,11 +4,16 @@ - Removed `analysis_value` argument in the calls to `derive_param_computed()` in ADBCVA template in line with the deprecation of this argument in the new version of `{admiral}`. Variable values for parameters of interest are now all populated through the `set_values_to` argument (#207). +- Modified calls to `derive_summary_records()` in ADVFQ template in line with the updates to this function in the new version of the `{admiral}` package. The `filter` argument is now renamed to `filter_add`, the argument `dataset_add` is now always specified and the variable values are now all populated through the `set_values_to` argument (#204). + ## Updates to Documentation - Added release date for `{admiralophtha}` 1.0 to the front page (#203). + - Removed `analysis_value` argument in the calls to `derive_param_computed()` in ADBCVA vignette in line with the deprecation of this argument in the new version of `{admiral}`. Variable values for parameters of interest are now all populated through the `set_values_to` argument (#207). +- Modified calls to `derive_summary_records()` in ADVFQ vignette in line with the updates to this function in the new version of the `{admiral}` package. The `filter` argument is now renamed to `filter_add`, the argument `dataset_add` is now always specified and the variable values are now all populated through the `set_values_to` argument (#204). + ## Various - Website now has button/links to Slack channel and GitHub Issues (#206). diff --git a/inst/WORDLIST b/inst/WORDLIST index 0e1dd2c6..1afc3bb3 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -113,3 +113,5 @@ doi et ADIOP OE +adoe +advfq diff --git a/inst/templates/ad_advfq.R b/inst/templates/ad_advfq.R index 2cf4f589..8c3e967c 100644 --- a/inst/templates/ad_advfq.R +++ b/inst/templates/ad_advfq.R @@ -75,11 +75,13 @@ advfq_aval <- advfq_dtdy %>% # else set to 0 if [advfq.AVAL] = 5 advfq_qr01 <- advfq_aval %>% derive_summary_records( + dataset_add = advfq_aval, by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, PARAMCD, VISITNUM, VISIT, ADT, ADY), - filter = QSTESTCD == "VFQ1" & !is.na(AVAL), - analysis_var = AVAL, - summary_fun = identity, - set_values_to = exprs(PARAMCD = "QR01") + filter_add = QSTESTCD == "VFQ1" & !is.na(AVAL), + set_values_to = exprs( + AVAL = identity(AVAL), + PARAMCD = "QR01" + ) ) %>% mutate(AVAL = ifelse(PARAMCD == "QR01", case_when( @@ -101,11 +103,13 @@ advfq_qr01 <- advfq_aval %>% # else set to 0 if [advfq.AVAL] = 6 advfq_qr02 <- advfq_qr01 %>% derive_summary_records( + dataset_add = advfq_qr01, by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, PARAMCD, VISITNUM, VISIT, ADT, ADY), - filter = QSTESTCD == "VFQ2" & !is.na(AVAL), - analysis_var = AVAL, - summary_fun = identity, - set_values_to = exprs(PARAMCD = "QR02") + filter_add = QSTESTCD == "VFQ2" & !is.na(AVAL), + set_values_to = exprs( + AVAL = identity(AVAL), + PARAMCD = "QR02" + ) ) %>% mutate(AVAL = ifelse(PARAMCD == "QR02", case_when( @@ -127,11 +131,13 @@ advfq_qr02 <- advfq_qr01 %>% # else set to 0 if [advfq.AVAL] = 1 advfq_qr03 <- advfq_qr02 %>% derive_summary_records( + dataset_add = advfq_qr02, by_vars = exprs(STUDYID, USUBJID, PARAMCD, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY), - filter = QSTESTCD == "VFQ3" & !is.na(AVAL), - analysis_var = AVAL, - summary_fun = identity, - set_values_to = exprs(PARAMCD = "QR03") + filter_add = QSTESTCD == "VFQ3" & !is.na(AVAL), + set_values_to = exprs( + AVAL = identity(AVAL), + PARAMCD = "QR03" + ) ) %>% mutate(AVAL = ifelse(PARAMCD == "QR03", case_when( @@ -153,11 +159,13 @@ advfq_qr03 <- advfq_qr02 %>% # else set to 0 if [advfq.AVAL] = 1 advfq_qr04 <- advfq_qr03 %>% derive_summary_records( + dataset_add = advfq_qr03, by_vars = exprs(STUDYID, USUBJID, PARAMCD, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY), - filter = QSTESTCD == "VFQ4" & !is.na(AVAL), - analysis_var = AVAL, - summary_fun = identity, - set_values_to = exprs(PARAMCD = "QR04") + filter_add = QSTESTCD == "VFQ4" & !is.na(AVAL), + set_values_to = exprs( + AVAL = identity(AVAL), + PARAMCD = "QR04" + ) ) %>% mutate(AVAL = ifelse(PARAMCD == "QR04", case_when( @@ -175,11 +183,13 @@ advfq_qr04 <- advfq_qr03 %>% # Average of QR01 and QR02 records advfq_qsg01 <- advfq_qr04 %>% derive_summary_records( + dataset_add = advfq_qr04, by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY), - filter = PARAMCD %in% c("QR01", "QR02") & !is.na(AVAL), - analysis_var = AVAL, - summary_fun = mean, - set_values_to = exprs(PARAMCD = "QSG01") + filter_add = PARAMCD %in% c("QR01", "QR02") & !is.na(AVAL), + set_values_to = exprs( + AVAL = mean(AVAL), + PARAMCD = "QSG01" + ) ) ## Derive a new record as a summary record ---- @@ -187,11 +197,13 @@ advfq_qsg01 <- advfq_qr04 %>% # Average of QR03 and QR04 records advfq_qsg02 <- advfq_qsg01 %>% derive_summary_records( + dataset_add = advfq_qsg01, by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY), - filter = PARAMCD %in% c("QR03", "QR04") & !is.na(AVAL), - analysis_var = AVAL, - summary_fun = mean, - set_values_to = exprs(PARAMCD = "QSG02") + filter_add = PARAMCD %in% c("QR03", "QR04") & !is.na(AVAL), + set_values_to = exprs( + AVAL = mean(AVAL), + PARAMCD = "QSG02" + ) ) @@ -200,11 +212,13 @@ advfq_qsg02 <- advfq_qsg01 %>% # Average of QSG01 and QSG02 records advfq_qbcs <- advfq_qsg02 %>% derive_summary_records( + dataset_add = advfq_qsg02, by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY), - filter = PARAMCD %in% c("QSG01", "QSG02") & !is.na(AVAL), - analysis_var = AVAL, - summary_fun = sum, - set_values_to = exprs(PARAMCD = "QBCSCORE") + filter_add = PARAMCD %in% c("QSG01", "QSG02") & !is.na(AVAL), + set_values_to = exprs( + AVAL = sum(AVAL), + PARAMCD = "QBCSCORE" + ) ) ## Get visit info ---- @@ -220,11 +234,14 @@ advfq_visit <- advfq_qbcs %>% !is.na(VISIT) ~ str_to_title(VISIT), TRUE ~ NA_character_ ), - AVISITN = as.numeric(case_when( + AVISITN = case_when( VISIT == "BASELINE" ~ "0", - str_detect(VISIT, "WEEK") ~ str_trim(str_replace(VISIT, "WEEK", "")), - TRUE ~ NA_character_ - )) + str_detect(VISIT, "WEEK") ~ VISIT %>% + str_replace("WEEK", "") %>% + str_replace("\\(T\\)", "") %>% + str_trim(), + TRUE ~ NA + ), ) advfq_ontrt <- advfq_visit %>% diff --git a/vignettes/advfq.Rmd b/vignettes/advfq.Rmd index 20c9cb6b..d0b67aa5 100644 --- a/vignettes/advfq.Rmd +++ b/vignettes/advfq.Rmd @@ -126,11 +126,13 @@ Run this section of code for every question that you need recoding. This gives a # else set to 0 if [advfq.AVAL] = 5 advfq <- advfq %>% derive_summary_records( + dataset_add = advfq, by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, PARAMCD, VISITNUM, VISIT), - filter = QSTESTCD == "VFQ1" & !is.na(AVAL), - analysis_var = AVAL, - summary_fun = identity, - set_values_to = exprs(PARAMCD = "QR01") + filter_add = QSTESTCD == "VFQ1" & !is.na(AVAL), + set_values_to = exprs( + AVAL = identity(AVAL), + PARAMCD = "QR01" + ) ) %>% mutate(AVAL = ifelse(PARAMCD == "QR01", case_when( @@ -152,11 +154,13 @@ Next, the programmer should create summary records as average of recoded questio # Average of QR01 and QR02 records advfq <- advfq %>% derive_summary_records( + dataset_add = advfq, by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY), - filter = PARAMCD %in% c("QR01", "QR02") & !is.na(AVAL), - analysis_var = AVAL, - summary_fun = mean, - set_values_to = exprs(PARAMCD = "QSG01") + filter_add = PARAMCD %in% c("QR01", "QR02") & !is.na(AVAL), + set_values_to = exprs( + AVAL = mean(AVAL), + PARAMCD = "QSG01" + ) ) ``` diff --git a/vignettes/articles/website-versions.Rmd b/vignettes/articles/website-versions.Rmd index 378214e3..0a4edf5d 100644 --- a/vignettes/articles/website-versions.Rmd +++ b/vignettes/articles/website-versions.Rmd @@ -3,9 +3,9 @@ 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 +# TO USE THIS ARTICLE, THE DESCRIPTION FILE MUST INCLUDE #nolint +# Config/Needs/website: gert #nolint +# Make sure to copy the gh-pages branch to your local git #nolint knitr::opts_chunk$set( collapse = TRUE,