Skip to content

Commit

Permalink
Merge pull request #231 from pharmaverse/devel
Browse files Browse the repository at this point in the history
admiralonco 0.4.0
  • Loading branch information
bundfussr authored Jun 12, 2023
2 parents 4b7d86c + ffa0c11 commit f11db28
Show file tree
Hide file tree
Showing 54 changed files with 7,111 additions and 1,688 deletions.
12 changes: 11 additions & 1 deletion .Rprofile
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
if (Sys.getenv("GITHUB_ACTIONS") == "" || (Sys.getenv("GITHUB_ACTIONS") == "true" && getRversion()$major == 3 && getRversion()$minor == 6)) {
# Set renv profile base on R version.
if ((Sys.getenv("GITHUB_ACTIONS") == "") && (Sys.getenv("DOCKER_CONTAINER_CONTEXT") == "")) {
renv_profile <- paste(R.version$major, substr(R.version$minor, 1, 1), sep = ".")
if (file.exists("./renv/profile")) {
message("Using renv profile from `renv/profile` file.")
} else if (renv_profile %in% c("4.1", "4.2", "4.3")) {
message("Set renv profile to `", renv_profile, "`")
Sys.setenv("RENV_PROFILE" = renv_profile)
} else {
message("This repository do not contains the renv profile for your R version.")
}
source("renv/activate.R")
} else {
options(repos = c(CRAN = "https://cran.rstudio.com"))
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ jobs:
uses: pharmaverse/admiralci/.github/workflows/style.yml@main
if: github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
spellcheck:
name: Spelling
uses: pharmaverse/admiralci/.github/workflows/spellcheck.yml@main
if: github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
readme:
name: Render README
uses: pharmaverse/admiralci/.github/workflows/readme-render.yml@main
if: github.event_name == 'push'
with:
r-version: "4.0"
r-version: "4.1"
validation:
name: Validation
uses: pharmaverse/admiralci/.github/workflows/r-pkg-validation.yml@main
if: github.event_name == 'release'
with:
r-version: "4.0"
r-version: "4.1"
check:
name: Check
uses: pharmaverse/admiralci/.github/workflows/r-cmd-check.yml@main
Expand All @@ -69,7 +69,7 @@ jobs:
uses: pharmaverse/admiralci/.github/workflows/pkgdown.yml@main
if: github.event_name == 'push'
with:
r-version: "4.0"
r-version: "4.1"
# 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
Expand All @@ -79,7 +79,7 @@ jobs:
uses: pharmaverse/admiralci/.github/workflows/lintr.yml@main
if: github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
links:
name: Links
uses: pharmaverse/admiralci/.github/workflows/links.yml@main
Expand All @@ -91,7 +91,7 @@ jobs:
if: >
github.event_name == 'push' || github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
# Whether to skip code coverage badge creation
# Setting to 'false' will require you to create
# an orphan branch called 'badges' in your repository
Expand All @@ -102,10 +102,10 @@ jobs:
if: >
github.event_name == 'push' || github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
man-pages:
name: Man Pages
uses: pharmaverse/admiralci/.github/workflows/man-pages.yml@main
if: github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
16 changes: 14 additions & 2 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
linters: with_defaults(line_length_linter(100), object_usage_linter=NULL)
exclusions: list("renv/activate.R")
linters: linters_with_defaults(
any_duplicated_linter(),
any_is_na_linter(),
line_length_linter(100),
object_usage_linter=NULL,
cyclocomp_linter(complexity_limit = 20),
undesirable_function_linter = undesirable_function_linter()
)
exclusions: list(
"R/data.R" = Inf,
"inst" = list(undesirable_function_linter = Inf),
"vignettes" = list(undesirable_function_linter = Inf),
"tests/testthat" = list(undesirable_function_linter = Inf)
)
12 changes: 7 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: admiralonco
Type: Package
Title: Oncology Extension Package for ADaM in 'R' Asset Library
Version: 0.3.0
Version: 0.4.0
Authors@R: c(
person("Stefan", "Bundfuss", email = "[email protected]", role = c("aut", "cre")),
person("Ross", "Farrugia", role = "aut"),
Expand All @@ -11,6 +11,7 @@ Authors@R: c(
person("Samia", "Kabi", role = "aut"),
person("Stephen", "Gormley", role = "aut"),
person("Hinal", "Patel", role = "aut"),
person("Vinh", "Nguyen", role = "aut"),
person("Karl", "Kennedy", role = "ctb"),
person("Matt", "Marino", role = "ctb"),
person("Gopi", "Vegesna", role = "ctb"),
Expand All @@ -35,14 +36,16 @@ Description: Programming oncology specific Clinical Data Interchange Standards C
The package is an extension package of the 'admiral' package.
Language: en-US
License: Apache License (>= 2)
BugReports: https://github.com/pharmaverse/admiralonco/issues
URL: https://pharmaverse.github.io/admiralonco/, https://github.com/pharmaverse/admiralonco
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Depends: R (>= 3.5)
Imports:
admiral (>= 0.10.0),
admiraldev (>= 0.3.0),
admiral (>= 0.11.0),
admiraldev (>= 0.4.0),
dplyr (>= 0.8.4),
lifecycle (>= 0.1.0),
lubridate (>= 1.7.4),
Expand All @@ -63,7 +66,6 @@ Suggests:
roxygen2,
spelling,
stringr,
styler,
tibble,
usethis,
covr,
Expand Down
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export(derive_param_bor)
export(derive_param_clinbenefit)
export(derive_param_confirmed_bor)
export(derive_param_confirmed_resp)
export(derive_param_lasta)
export(derive_param_response)
export(filter_pd)
export(get_crpr_dataset)
Expand All @@ -19,7 +18,7 @@ export(signal_crpr)
export(trts_censor)
importFrom(admiral,censor_source)
importFrom(admiral,count_vals)
importFrom(admiral,derive_param_extreme_event)
importFrom(admiral,derive_extreme_records)
importFrom(admiral,derive_var_obs_number)
importFrom(admiral,derive_vars_merged)
importFrom(admiral,event_source)
Expand Down Expand Up @@ -53,6 +52,7 @@ importFrom(admiraldev,expect_dfs_equal)
importFrom(admiraldev,expr_c)
importFrom(admiraldev,extract_vars)
importFrom(admiraldev,filter_if)
importFrom(admiraldev,process_set_values_to)
importFrom(admiraldev,squote)
importFrom(admiraldev,suppress_warning)
importFrom(admiraldev,vars2chr)
Expand Down
37 changes: 37 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
# admiralonco 0.4.0

## Documentation

- New vignette "Creating and Using New Anti-Cancer Start Date" (#17)
- "Create `ADRS`" and "Create `ADTTE`" vignette has been updated to include a link to "Creating and Using New Anti-Cancer Start Date" vignette

## New Features

- Added a "Report a bug" link to `{admiralonco}` website (#211)

- Added a section regarding dependencies to the `{admiralonco}` website (#223)

- Vignettes and templates were updated due to changes in admiral and
admiralonco: (#216)
- The `AVAL` variable is now populated via the `set_values_to` argument as
the `aval_fun` argument was deprecated.
- `admiral::derive_param_extreme_event()` calls were replaced by
`admiral::derive_extreme_records()` calls due to deprecation of
`admiral::derive_param_extreme_event()`.
- `admiral::derive_param_exist_flag()` calls were updated as the
`dataset_adsl` argument was renamed to `dataset_ref`.

## Breaking Changes

- Function `derive_param_lasta()`, which was deprecated in admiralonco 0.2.0,
has been removed. (#216)

- The `aval_fun` argument of `derive_param_bor()`, `derive_param_clinbenefit()`,
`derive_param_confirmed_bor()`, `derive_param_confirmed_resp()`,
`derive_param_response()` was deprecated in favor of the `set_values_to`
argument. (#216)

- The `call_aval_fun()` function was deprecated in favor or
`admiraldev::process_set_values_to()`. (#216)


# admiralonco 0.3.0

## Breaking Changes
Expand Down
4 changes: 2 additions & 2 deletions R/admiralonco-package.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' @keywords internal
#' @family internal
#' @importFrom admiral censor_source count_vals derive_param_extreme_event
#' @importFrom admiral censor_source count_vals derive_extreme_records
#' derive_var_obs_number derive_vars_merged event_source filter_joined
#' filter_extreme filter_relative get_admiral_option list_tte_source_objects
#' max_cond min_cond params restrict_derivation set_admiral_options yn_to_numeric
Expand All @@ -9,7 +9,7 @@
#' assert_integer_scalar assert_list_of assert_logical_scalar
#' assert_order_vars assert_param_does_not_exist assert_s3_class assert_symbol
#' assert_vars assert_varval_list enumerate expect_dfs_equal extract_vars
#' filter_if expr_c squote suppress_warning vars2chr
#' filter_if expr_c process_set_values_to squote suppress_warning vars2chr
#' @importFrom dplyr arrange bind_rows case_when filter group_by if_else
#' left_join mutate rename right_join select slice ungroup
#' @importFrom lifecycle deprecate_warn deprecated deprecate_stop
Expand Down
55 changes: 13 additions & 42 deletions R/derive_param_bor.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@
#'
#' *Permitted Values:* a logical scalar
#'
#' @param aval_fun Function to map character analysis value (`AVALC`) to numeric
#' analysis value (`AVAL`)
#' @param aval_fun *Deprecated*, please use `set_values_to` instead.
#'
#' Function to map character analysis value (`AVALC`) to numeric analysis
#' value (`AVAL`)
#'
#' The (first) argument of the function must expect a character vector and the
#' function must return a numeric vector.
Expand Down Expand Up @@ -265,7 +267,7 @@ derive_param_bor <- function(dataset,
reference_date,
ref_start_window,
missing_as_ne = FALSE,
aval_fun = aval_resp,
aval_fun,
set_values_to,
subject_keys = get_admiral_option("subject_keys")) {
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down Expand Up @@ -309,6 +311,11 @@ derive_param_bor <- function(dataset,
param = set_values_to$PARAMCD
)

if (!missing(aval_fun)) {
deprecate_warn("0.4.0", "derive_param_bor(aval_fun = )", "derive_param_bor(set_values_to = )")
set_values_to <- exprs(!!!set_values_to, AVAL = {{ aval_fun }}(AVALC))
}

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# filter_pd and filter_source: Filter source dataset using filter_source----
# argument and also filter data after progressive disease with filter_pd
Expand Down Expand Up @@ -411,51 +418,15 @@ derive_param_bor <- function(dataset,
order = exprs(tmp_order, ADT),
mode = "first"
) %>%
select(-tmp_order)

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# set_values_to: Execute set_values_to ----
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

tryCatch(
param_bor_values_set <- param_bor %>%
mutate(
!!!set_values_to
),
error = function(cnd) {
abort(
paste0(
"Assigning new columns with set_values_to has failed:\n",
"set_values_to = (\n",
paste(
" ",
names(set_values_to),
"=",
set_values_to,
collapse = "\n"
),
"\n)\nError message:\n ",
cnd
)
)
}
)

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# aval_fun(AVALC): Execute aval_fun ----
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

param_bor_aval_fun <- call_aval_fun(
param_bor_values_set,
aval_fun
)
select(-tmp_order) %>%
process_set_values_to(set_values_to)

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Bind back to passed dataframe in dataset argument and return ----
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

bind_rows(
dataset,
param_bor_aval_fun
param_bor
)
}
22 changes: 15 additions & 7 deletions R/derive_param_clinbenefit.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@
#' that must elapse before an evaluable non-PD assessment counts toward determining
#' clinical benefit.
#'
#' @param aval_fun Function to map character analysis value (`AVALC`) to numeric
#' analysis value (`AVAL`)
#' @param aval_fun *Deprecated*, please use `set_values_to` instead.
#'
#' Function to map character analysis value (`AVALC`) to numeric analysis value
#' (`AVAL`)
#'
#' The (first) argument of the function must expect a character vector and the
#' function must return a numeric vector.
Expand Down Expand Up @@ -195,7 +197,7 @@ derive_param_clinbenefit <- function(dataset,
source_datasets,
reference_date,
ref_start_window,
aval_fun = yn_to_numeric,
aval_fun,
clinben_vals = c("CR", "PR", "SD", "NON-CR/NON-PD"),
set_values_to,
subject_keys = get_admiral_option("subject_keys")) {
Expand All @@ -216,12 +218,21 @@ derive_param_clinbenefit <- function(dataset,
optional = FALSE
)

assert_function(aval_fun)
assert_s3_class(source_resp, "date_source")
assert_s3_class(source_pd, "date_source", optional = TRUE)
assert_list_of(source_datasets, "data.frame")
assert_character_vector(clinben_vals)

if (!missing(aval_fun)) {
deprecate_warn(
"0.4.0",
"derive_param_clinbenefit(aval_fun = )",
"derive_param_clinbenefit(set_values_to = )"
)
assert_function(aval_fun)
set_values_to <- exprs(!!!set_values_to, AVAL = {{ aval_fun }}(AVALC))
}

source_names <- names(source_datasets)

if (!is.null(source_pd)) {
Expand Down Expand Up @@ -313,9 +324,6 @@ derive_param_clinbenefit <- function(dataset,
mutate(
AVALC = if_else(!is.na(ADT), "Y", "N"),
!!!set_values_to
) %>%
call_aval_fun(
aval_fun
)

bind_rows(dataset, new_param)
Expand Down
Loading

0 comments on commit f11db28

Please sign in to comment.