Skip to content

Commit

Permalink
v0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
edward-burn committed Oct 14, 2024
1 parent cfbc27a commit 2f96bb8
Show file tree
Hide file tree
Showing 48 changed files with 2,906 additions and 3,299 deletions.
9 changes: 4 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: IncidencePrevalence
Title: Estimate Incidence and Prevalence using the OMOP Common Data Model
Version: 0.7.4
Version: 0.8.0
Authors@R: c(
person("Edward", "Burn", email = "[email protected]",
role = c("aut", "cre"),
Expand All @@ -25,7 +25,7 @@ Authors@R: c(
Description: Calculate incidence and prevalence using data mapped to the Observational Medical Outcomes Partnership (OMOP) common data model. Incidence and prevalence can be estimated for the total population in a database or for a stratification cohort.
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Depends:
R (>= 4.0)
Imports:
Expand All @@ -36,16 +36,15 @@ Imports:
dbplyr (>= 2.5.0),
dplyr (>= 1.1.0),
glue (>= 1.5.0),
omopgenerics (>= 0.1.2),
lifecycle,
omopgenerics (>= 0.3.1),
lubridate (>= 1.0.0),
magrittr (>= 2.0.0),
PatientProfiles (>= 1.1.0),
purrr (>= 0.3.5),
rlang (>= 1.0.0),
stringr (>= 1.5.0),
tidyr (>= 1.2.0),
visOmopResults
visOmopResults (>= 0.4.0)
Suggests:
knitr,
rmarkdown,
Expand Down
12 changes: 6 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# Generated by roxygen2: do not edit by hand

S3method(attrition,IncidenceResult)
S3method(attrition,PrevalenceResult)
S3method(participants,IncidencePrevalenceResult)
S3method(settings,IncidenceResult)
S3method(settings,PrevalenceResult)
export("%>%")
export(attrition)
export(benchmarkIncidencePrevalence)
Expand All @@ -17,20 +12,25 @@ export(estimatePointPrevalence)
export(exportSummarisedResult)
export(generateDenominatorCohortSet)
export(generateTargetDenominatorCohortSet)
export(importSummarisedResult)
export(mockIncidencePrevalenceRef)
export(optionsTableIncidence)
export(optionsTablePrevalence)
export(participants)
export(plotIncidence)
export(plotPrevalence)
export(settings)
export(suppress)
export(tableIncidence)
export(tableIncidenceAttrition)
export(tablePrevalence)
export(tablePrevalenceAttrition)
importFrom(magrittr,"%>%")
importFrom(omopgenerics,attrition)
importFrom(omopgenerics,bind)
importFrom(omopgenerics,cohortCodelist)
importFrom(omopgenerics,cohortCount)
importFrom(omopgenerics,exportSummarisedResult)
importFrom(omopgenerics,importSummarisedResult)
importFrom(omopgenerics,settings)
importFrom(omopgenerics,suppress)
importFrom(rlang,":=")
Expand Down
24 changes: 2 additions & 22 deletions R/benchmarkIncidencePrevalence.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#' @param cdm A CDM reference object
#' @param analysisType A string of the following: "all", "only incidence",
#' "only prevalence"
#' @param returnParticipants Whether to return participants
#'
#' @return a tibble with time taken for different analyses
#' @export
Expand All @@ -38,7 +37,6 @@
#' timings <- benchmarkIncidencePrevalence(cdm)
#' }
benchmarkIncidencePrevalence <- function(cdm,
returnParticipants = FALSE,
analysisType = "all") {
errorMessage <- checkmate::makeAssertCollection()
cdmCheck <- inherits(cdm, "cdm_reference")
Expand Down Expand Up @@ -116,7 +114,6 @@ benchmarkIncidencePrevalence <- function(cdm,
tictoc::tic()
pointPrev <- estimatePointPrevalence(
cdm = cdm,
returnParticipants = returnParticipants,
denominatorTable = "denominator_typical",
outcomeTable = "bench_outcome",
interval = "years"
Expand All @@ -133,7 +130,6 @@ benchmarkIncidencePrevalence <- function(cdm,
tictoc::tic()
period_prev <- estimatePeriodPrevalence(
cdm = cdm,
returnParticipants = returnParticipants,
denominatorTable = "denominator_typical",
outcomeTable = "bench_outcome",
interval = "years",
Expand All @@ -153,7 +149,6 @@ benchmarkIncidencePrevalence <- function(cdm,
tictoc::tic()
incTypicalYears <- estimateIncidence(
cdm = cdm,
returnParticipants = returnParticipants,
denominatorTable = "denominator_typical",
outcomeTable = "bench_outcome",
interval = "years"
Expand Down Expand Up @@ -192,24 +187,11 @@ benchmarkIncidencePrevalence <- function(cdm,
) %>%
dplyr::pull())

if (isFALSE(returnParticipants)) {
timings <- timings %>%
dplyr::mutate(with_participants = "No")
} else {
timings <- timings %>%
dplyr::mutate(with_participants = "Yes")
}

CDMConnector::dropTable(cdm = cdm,
name = dplyr::contains("denominator_typical"))
CDMConnector::dropTable(cdm = cdm,
name = dplyr::contains("bench_outcome"))
CDMConnector::dropTable(cdm = cdm,
name = dplyr::contains("point_prev_participants"))
CDMConnector::dropTable(cdm = cdm,
name = dplyr::contains("period_prev_participants"))
CDMConnector::dropTable(cdm = cdm,
name = dplyr::contains("inc_participants"))

# as a summarised result
timings <- timings %>%
Expand All @@ -230,13 +212,11 @@ benchmarkIncidencePrevalence <- function(cdm,
estimate_value = as.character(.data$time_taken_mins),
additional_name = paste0("dbms &&& person_n &&& ",
"min_observation_start &&& ",
"max_observation_end &&& ",
"with_participants"),
"max_observation_end"),
additional_level = paste0(.data$dbms, " &&& ",
.data$person_n, " &&& ",
.data$min_observation_start, " &&& ",
.data$max_observation_end, " &&& ",
.data$with_participants)
.data$max_observation_end)
) %>%
dplyr::select(dplyr::all_of(
colnames(omopgenerics::emptySummarisedResult()))) %>%
Expand Down
4 changes: 2 additions & 2 deletions R/dateUtilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ addDaysQuery <- function(cdm,
}

if(type == "year"){
if(omopgenerics::cdmSourceType(cdm) == "spark"){
if(omopgenerics::sourceType(cdm) == "spark"){
# https://github.com/darwin-eu-dev/IncidencePrevalence/issues/395
number_days_to_years <- as.integer(number*365)
q <- glue::glue("clock::add_days({variable}, {(number_days_to_years)}L)")
Expand Down Expand Up @@ -49,7 +49,7 @@ minusDaysQuery <- function(cdm,
q <- glue::glue("clock::add_days({variable} , {(number)}L)")
}
if(type == "year"){
if(omopgenerics::cdmSourceType(cdm) == "spark"){
if(omopgenerics::sourceType(cdm) == "spark"){
# https://github.com/darwin-eu-dev/IncidencePrevalence/issues/395
number_days_to_years <- as.integer(number*365)
q <- glue::glue("clock::add_days({variable}, {(number_days_to_years)}L)")
Expand Down
Loading

0 comments on commit 2f96bb8

Please sign in to comment.