Skip to content

Commit

Permalink
0.8.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
catalamarti committed Dec 10, 2024
1 parent 1306a4e commit 996c7bc
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 26 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: DrugUtilisation
Title: Summarise Patient-Level Drug Utilisation in Data Mapped to the OMOP
Common Data Model
Version: 0.7.1
Version: 0.8.0
Authors@R: c(
person(
"Martí", "Català", email = "[email protected]",
Expand Down Expand Up @@ -67,7 +67,8 @@ Suggests:
ggtext,
scales,
DBI,
bit64
bit64,
visOmopResults (>= 0.5.0)
Config/testthat/edition: 3
Imports:
CDMConnector (>= 1.4.0),
Expand All @@ -81,7 +82,6 @@ Imports:
PatientProfiles (>= 1.0.0),
purrr,
omopgenerics (>= 0.4.0),
visOmopResults (>= 0.5.0),
lifecycle,
stringr
Depends:
Expand Down
30 changes: 30 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# DrugUtilisation 0.8.0

* Account for omopgenerics 0.4.0 by @catalamarti
* Add argument ... to generateATC/IngredientCohortSet by @catalamarti
* benchmarkDrugUtilisation to test all functions by @MimiYuchenGuo
* Add messages about dropped records in cohort creation by @catalamarti
* Refactor of table functions following visOmopResults 0.5.0 release by @catalamart
* Add confidence intervals to PPC by @catalamarti
* Cast settings to characters by @catalamarti
* checkVersion utility function for tables and plots by @catalamarti
* Export erafyCohort by @catalamarti
* Deprecation warnings to errors for deprecated arguments in geenrateDrugUtilisation by @catalamarti
* Add numberExposures and daysPrescribed to generate functions by @catalamarti
* Add subsetCohort and subsetCohortId arguments to cohort creation functions by @catalamarti
* New function: addDrugRestart by @catalamarti
* Add initialExposureDuration by @catalamarti
* Add message if too many indications by @catalamarti
* not treated -> untreated by @catalamarti
* warn overwrite columns by @catalamarti
* Use omopgenerics assert function by @catalamarti
* add documentation helpers for consistent argument documentation by @catalamarti
* allow integer64 in sampleSize by @catalamarti
* add cohortId to summarise* functions by @catalamarti
* Fix cast warning in mock by @catalamarti
* addDaysPrescribed by @catalamarti
* exposedTime -> daysExposed by @catalamarti
* test addDaysPrescribed by @catalamarti
* plotDrugUtilisation by @catalamarti
* refactor plots to use visOmopResults plot tools by @catalamarti

# DrugUtilisation 0.7.0

* Deprecate dose specific functions: `addDailyDose`, `addRoute`,
Expand Down
8 changes: 4 additions & 4 deletions R/addIntersect.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#' @param mutuallyExclusive Whether to consider mutually exclusive categories
#' (one column per window) or not (one column per window and indication).
#' @param nameStyle Name style for the indications. By default:
#' 'indication_{window_name}' (mutuallyExclusive = TRUE),
#' 'indication_{window_name}_{cohort_name}' (mutuallyExclusive = FALSE).
#' 'indication_\{window_name\}' (mutuallyExclusive = TRUE),
#' 'indication_\{window_name\}_\{cohort_name\}' (mutuallyExclusive = FALSE).
#' @inheritParams compNameDoc
#'
#' @return The original table with a variable added that summarises the
Expand Down Expand Up @@ -106,8 +106,8 @@ addIndication <- function(cohort,
#' @param mutuallyExclusive Whether to consider mutually exclusive categories
#' (one column per window) or not (one column per window and treatment).
#' @param nameStyle Name style for the treatment columns. By default:
#' 'treatment_{window_name}' (mutuallyExclusive = TRUE),
#' 'treatment_{window_name}_{cohort_name}' (mutuallyExclusive = FALSE).
#' 'treatment_\{window_name\}' (mutuallyExclusive = TRUE),
#' 'treatment_\{window_name\}_\{cohort_name\}' (mutuallyExclusive = FALSE).
#' @inheritParams compNameDoc
#'
#' @return The original table with a variable added that summarises the
Expand Down
4 changes: 2 additions & 2 deletions R/documentationHelpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ NULL
#' first drug exposure record).
#' @param cumulativeQuantity Whether to include 'cumulative_quantity' (sum of
#' the quantity of the different exposures considered in the analysis).
#' @param initialDailyDose Whether to include 'initial_daily_dose_{unit}'
#' @param initialDailyDose Whether to include 'initial_daily_dose_\{unit\}'
#' (daily dose of the first considered prescription).
#' @param cumulativeDose Whether to include 'cumulative_dose_{unit}' (sum of
#' @param cumulativeDose Whether to include 'cumulative_dose_\{unit\}' (sum of
#' the cumulative dose of the analysed drug exposure records).
#' @param exposedTime deprecated.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/erafyCohort.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' @inheritParams gapEraDoc
#' @inheritParams cohortIdDoc
#' @param nameStyle String to create the new names of cohorts. Must contain
#' '{cohort_name}' if more than one cohort is present and '{gap_era}' if more
#' '\{cohort_name\}' if more than one cohort is present and '\{gap_era\}' if more
#' than one gapEra is provided.
#' @inheritParams newNameDoc
#'
Expand Down
3 changes: 3 additions & 0 deletions R/plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ plotDrugUtilisation <- function(result,
plotType = "barplot",
facet = strataColumns(result),
colour = "cohort_name") {
rlang::check_installed("visOmopResults")
rlang::check_installed("ggplot2")

# initial checks
result <- omopgenerics::validateResultArgument(result)
result <- result |>
Expand Down
2 changes: 1 addition & 1 deletion R/summariseDrugUtilisation.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ summariseDrugUtilisation <- function(cohort,
by = "ingredient_id"
) |>
dplyr::select(-c(dplyr::starts_with("additional"))) |>
visOmopResults::uniteAdditional(cols = c("concept_set", "ingredient")) |>
omopgenerics::uniteAdditional(cols = c("concept_set", "ingredient")) |>
dplyr::select(dplyr::all_of(omopgenerics::resultColumns())) |>
dplyr::arrange(.data$result_id, .data$group_name, .data$group_level, .data$strata_name, .data$strata_level) |>
omopgenerics::newSummarisedResult(settings = dplyr::tibble(
Expand Down
4 changes: 3 additions & 1 deletion R/tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ dusTable <- function(result,
estimateName,
type,
call = parent.frame()) {
rlang::check_installed("visOmopResults")

# check inputs
result <- omopgenerics::validateResultArgument(result, call = call)
omopgenerics::assertCharacter(header, null = TRUE, call = call)
Expand All @@ -332,7 +334,7 @@ dusTable <- function(result,

# subset to result_type
result <- result |>
visOmopResults::filterSettings(.data$result_type == .env$resultType)
omopgenerics::filterSettings(.data$result_type == .env$resultType)
if (nrow(result) == 0) {
cli::cli_warn("There are no results with `result_type = {resultType}`")
return(emptyTable(type))
Expand Down
4 changes: 2 additions & 2 deletions man/addDrugUtilisation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/addIndication.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/addTreatment.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/drugUtilisationDoc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/erafyCohort.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/summariseDrugUtilisation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-summariseDrugRestart.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ test_that("summarise drug restart", {
switchCohortId = 1:2,
followUpDays = c(10)
)
expect_true(all(visOmopResults::strataColumns(resultsStra) == c("age_group", "sex")))
expect_true(all(omopgenerics::strataColumns(resultsStra) == c("age_group", "sex")))

# restrict
restrict <- cdm$dus_cohort |>
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-summariseDrugUtilisation.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test_that("summariseDrugUtilisation works", {
expect_true(all(sort(unique(x0$variable_name)) == sort(variables)))
expect_true(all(unique(x0$variable_level) %in% c(NA, "milligram")))
expect_true(settings(x0)$result_type == "summarise_drug_utilisation")
expect_true(all(visOmopResults::additionalColumns(x0) == c("concept_set", "ingredient")))
expect_true(all(omopgenerics::additionalColumns(x0) == c("concept_set", "ingredient")))
expect_true(
x0 |> dplyr:::filter(grepl("dose", variable_name)) |> dplyr::pull("additional_level") |> unique() == "ingredient_1125315_descendants &&& acetaminophen"
)
Expand All @@ -80,7 +80,7 @@ test_that("summariseDrugUtilisation works", {
)
))
expect_true(settings(x1)$result_type == "summarise_drug_utilisation")
expect_true(all(x1 |> visOmopResults::strataColumns() == c("sex")))
expect_true(all(x1 |> omopgenerics::strataColumns() == c("sex")))

# concept
codelist <- CodelistGenerator::getDrugIngredientCodes(cdm, name = "acetaminophen")
Expand Down

0 comments on commit 996c7bc

Please sign in to comment.