From c1a46ced1f01787d33510c8ccb497965e36458c8 Mon Sep 17 00:00:00 2001 From: Jamie Gilbert Date: Thu, 4 Jan 2024 13:54:56 -0800 Subject: [PATCH] Fixes to support big int cohorts ids --- R/Analyses.R | 11 +++++------ R/DataLoadingSaving.R | 6 +++--- R/RunAnalyses.R | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/R/Analyses.R b/R/Analyses.R index 539a1204..cd2f7a64 100644 --- a/R/Analyses.R +++ b/R/Analyses.R @@ -210,19 +210,18 @@ createOutcome <- function(outcomeId, riskWindowEnd = NULL, endAnchor = NULL) { errorMessages <- checkmate::makeAssertCollection() - checkmate::assertInt(outcomeId, add = errorMessages) + checkmate::assertNumeric(outcomeId, add = errorMessages) checkmate::assertLogical(outcomeOfInterest, add = errorMessages) checkmate::assertNumeric(trueEffectSize, len = 1, null.ok = TRUE, add = errorMessages) checkmate::assertInt(riskWindowStart, null.ok = TRUE, add = errorMessages) checkmate::assertInt(riskWindowEnd, null.ok = TRUE, add = errorMessages) checkmate::reportAssertions(collection = errorMessages) if (!is.null(startAnchor) && !grepl("start$|end$", startAnchor, ignore.case = TRUE)) { - stop("startAnchor should have value 'cohort start' or 'cohort end'") + stop("startAnchor should have value \'cohort start\' or \'cohort end\'") } if (!is.null(riskWindowEnd) && !grepl("start$|end$", endAnchor, ignore.case = TRUE)) { - stop("endAnchor should have value 'cohort start' or 'cohort end'") + stop("endAnchor should have value \'cohort start\' or \'cohort end\'") } - outcome <- list() for (name in names(formals(createOutcome))) { outcome[[name]] <- get(name) @@ -259,8 +258,8 @@ createTargetComparatorOutcomes <- function(targetId, excludedCovariateConceptIds = c(), includedCovariateConceptIds = c()) { errorMessages <- checkmate::makeAssertCollection() - checkmate::assertInt(targetId, add = errorMessages) - checkmate::assertInt(comparatorId, add = errorMessages) + checkmate::assertNumeric(targetId, add = errorMessages) + checkmate::assertNumeric(comparatorId, add = errorMessages) checkmate::assertList(outcomes, min.len = 1, add = errorMessages) for (i in seq_along(outcomes)) { checkmate::assertClass(outcomes[[i]], "outcome", add = errorMessages) diff --git a/R/DataLoadingSaving.R b/R/DataLoadingSaving.R index a8f690c3..3c031d80 100644 --- a/R/DataLoadingSaving.R +++ b/R/DataLoadingSaving.R @@ -127,9 +127,9 @@ getDbCohortMethodData <- function(connectionDetails, checkmate::assertClass(connectionDetails, "ConnectionDetails", add = errorMessages) checkmate::assertCharacter(cdmDatabaseSchema, len = 1, add = errorMessages) checkmate::assertCharacter(tempEmulationSchema, len = 1, null.ok = TRUE, add = errorMessages) - checkmate::assertInt(targetId, add = errorMessages) - checkmate::assertInt(comparatorId, add = errorMessages) - checkmate::assertIntegerish(outcomeIds, add = errorMessages) + checkmate::assertNumeric(targetId, add = errorMessages) + checkmate::assertNumeric(comparatorId, add = errorMessages) + checkmate::assertNumeric(outcomeIds, add = errorMessages) checkmate::assertCharacter(studyStartDate, len = 1, add = errorMessages) checkmate::assertCharacter(studyEndDate, len = 1, add = errorMessages) checkmate::assertCharacter(exposureDatabaseSchema, len = 1, add = errorMessages) diff --git a/R/RunAnalyses.R b/R/RunAnalyses.R index 3b9f90ff..1c133c74 100644 --- a/R/RunAnalyses.R +++ b/R/RunAnalyses.R @@ -749,7 +749,7 @@ getPs <- function(psFile) { } doCreateCmDataObject <- function(params) { - ParallelLogger::logDebug(sprintf("Calling getDbCohortMethodData() for targetId %d, comparatorId %d", + ParallelLogger::logDebug(sprintf("Calling getDbCohortMethodData() for targetId %s, comparatorId %s", params$args$targetId, params$args$comparatorId)) cohortMethodData <- do.call("getDbCohortMethodData", params$args) @@ -761,7 +761,7 @@ doCreateStudyPopObject <- function(params) { cohortMethodData <- getCohortMethodData(params$cohortMethodDataFile) args <- params$args args$cohortMethodData <- cohortMethodData - ParallelLogger::logDebug(sprintf("Calling createStudyPopulation() using %s for outcomeId %d", + ParallelLogger::logDebug(sprintf("Calling createStudyPopulation() using %s for outcomeId %s", params$cohortMethodDataFile, args$outcomeId)) studyPop <- do.call("createStudyPopulation", args)