Skip to content

Commit

Permalink
Fix subset conceptset analysis (#1132)
Browse files Browse the repository at this point in the history
* Fix subset conceptset analysis

* Handle empty index event breakdown results

* Fix tests failure when postgres is not configured

---------

Co-authored-by: Gennadiy Anisimov <gennadiy.anisimov@softwarecountry.com>
  • Loading branch information
ganisimov and Gennadiy Anisimov authored Sep 10, 2024
1 parent deb2d20 commit aceff29
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions R/ConceptSets.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ combineConceptSetsFromCohorts <- function(cohorts) {
}

sqlCs <-
extractConceptSetsSqlFromCohortSql(cohortSql = cohort$sql)
extractConceptSetsSqlFromCohortSql(cohortSql = cohortSql)
jsonCs <-
extractConceptSetsJsonFromCohortJson(cohortJson = cohort$json)
extractConceptSetsJsonFromCohortJson(cohortJson = cohortJson)

if (nrow(sqlCs) == 0 || nrow(jsonCs) == 0) {
ParallelLogger::logInfo(
Expand Down Expand Up @@ -833,6 +833,18 @@ runConceptSetDiagnostics <- function(connection,
}
}

if (nrow(data) == 0 && ncol(data) == 0) {
data <- dplyr::tibble(
conceptId = numeric(),
conceptCount = numeric(),
subjectCount = numeric(),
cohortId = numeric(),
databaseId = character(),
domainField = character(),
domainTable = character()
)
}

data <- makeDataExportable(
x = data,
tableName = "index_event_breakdown",
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-7-DatabaseMigrations.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if (dbms == "postgresql") {

test_that("Database Migrations execute without error", {
skip_if_not(dbms %in% c("sqlite", "postgresql"))
skip_if(skipCdmTests, "cdm settings not configured")

connection <- DatabaseConnector::connect(connectionDetails)
on.exit(DatabaseConnector::disconnect(connection))
Expand Down

0 comments on commit aceff29

Please sign in to comment.