Skip to content

Commit

Permalink
Merge pull request #179 from darwin-eu-dev/hotfix-3.3.3
Browse files Browse the repository at this point in the history
Hotfix 3.3.3
  • Loading branch information
MaximMoinat authored Nov 29, 2024
2 parents d1793e3 + e16e631 commit 7a4e873
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: CdmOnboarding
Title: Generate report on an OMOP CDM instance
Version: 3.3.2
Version: 3.3.3
Authors@R:
c(person(given = "Peter",
family = "Rijnbeek",
Expand Down Expand Up @@ -50,7 +50,8 @@ Imports:
scales,
stringr,
httr,
utils
utils,
tictoc
Suggests:
RPostgres,
flextable,
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# CdmOnboarding 3.3.3

* Fix execution of CohortBenchmark and CdmConnectorBenchmark

# CdmOnboarding 3.3.2

* Fix generating applied indexes section when no indexes have been applied
Expand Down
12 changes: 6 additions & 6 deletions R/CohortBenchmark.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@
# @author Maxim Moinat


#' Generate cohorts
#' Generate predefined set of cohorts
#' @param connectionDetails An R object of type \code{connectionDetails} created using the function \code{createConnectionDetails} in the \code{DatabaseConnector} package.
#' @param cdmDatabaseSchema Fully qualified name of database schema that contains OMOP CDM schema.
#' On SQL Server, this should specifiy both the database and the schema, so for example, on SQL Server, 'cdm_instance.dbo'.
#' @param scratchDatabaseSchema Fully qualified name of database schema where temporary tables can be written.
#' @param cohortPath Path to the folder containing cohort definitions in JSON format
#' @returns list of DED diagnostics_summary and duration
.runCohortBenchmark <- function(
connectionDetails,
cdmDatabaseSchema,
scratchDatabaseSchema,
cohortPath = "inst/json/cohorts"
scratchDatabaseSchema
) {
# Connect to the database with CDMConnector
connection <- .getCdmConnection(
Expand All @@ -57,7 +55,9 @@
.soft_validation = TRUE
)

cohort_set_definition <- CDMConnector::read_cohort_set(cohortPath)
cohort_set_definition <- CDMConnector::read_cohort_set(
path = system.file("json", "cohorts", package = "CdmOnboarding")
)
n_cohorts <- nrow(cohort_set_definition)

# Generate each cohort definition one by one to capture time taken and possible errors
Expand Down Expand Up @@ -100,7 +100,7 @@
}
}

n_subject_bins <- cut(n_subjects, breaks = c(0, 100, 1000, 10000, 100000, 1000000, Inf), labels = c("0-100", "100-1k", "1k-10k", "10k-100k", "100k-1M", "1M+"))
n_subject_bins <- cut(as.integer(n_subjects), breaks = c(0, 100, 1000, 10000, 100000, 1000000, Inf), labels = c("0-100", "100-1k", "1k-10k", "10k-100k", "100k-1M", "1M+"))

data.frame(
cohort_name = cohort_set_definition$cohort_name,
Expand Down
7 changes: 0 additions & 7 deletions R/GenerateResultsDocument.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,6 @@ generateResultsDocument <- function(results, outputFolder, authors) {
officer::body_add_par("Performance checks have not been executed, runPerformanceChecks = FALSE?", style = pkg.env$styles$highlight)
}

if (!is.null(results$cohortBenchmark)) {
doc <- generateCohortBenchmarkSection(doc, results$cohortBenchmark)
} else {
doc <- doc %>%
officer::body_add_par("Cohort Benchmark results are missing, runCohortBenchmark = FALSE?", style = pkg.env$styles$highlight)
}

doc <- doc %>%
officer::body_add_par("Appendix", style = pkg.env$styles$heading1)
if (!is.null(results$vocabularyResults)) {
Expand Down
7 changes: 7 additions & 0 deletions R/generatePerformanceSection.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ generatePerformanceSection <- function(doc, results) {
officer::body_add_par("CDMConnector benchmark of the OMOP CDM tables could not be retrieved", style = pkg.env$styles$highlight)
}

if (!is.null(results$cohortBenchmark)) {
doc <- generateCohortBenchmarkSection(doc, results$cohortBenchmark)
} else {
doc <- doc %>%
officer::body_add_par("Cohort Benchmark results are missing, runCohortBenchmark = FALSE?", style = pkg.env$styles$highlight)
}

doc <- doc %>%
officer::body_add_par("Applied indexes", style = pkg.env$styles$heading2)
if (!is.null(df$appliedIndexes$result)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- source_to_concept_map

select source_vocabulary_id, target_vocabulary_id, count_big(*)
select source_vocabulary_id, target_vocabulary_id, count_big(*) as count
from @cdmDatabaseSchema.source_to_concept_map
group by source_vocabulary_id, target_vocabulary_id
order by source_vocabulary_id, target_vocabulary_id
9 changes: 3 additions & 6 deletions man/dot-runCohortBenchmark.Rd

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

0 comments on commit 7a4e873

Please sign in to comment.