diff --git a/R/GetCovariates.R b/R/GetCovariates.R index 63e9302f..3e60791c 100644 --- a/R/GetCovariates.R +++ b/R/GetCovariates.R @@ -46,9 +46,6 @@ #' specify both the database and the schema, so for example #' 'cdm_instance.dbo'. #' @param cohortTableIsTemp Is the cohort table a temp table? -#' @param cohortId DEPRECATED:For which cohort ID(s) should covariates be constructed? If set to -1, -#' covariates will be constructed for all cohorts in the specified cohort -#' table. #' @param cohortIds For which cohort ID(s) should covariates be constructed? If set to c(-1), #' covariates will be constructed for all cohorts in the specified cohort #' table. @@ -100,7 +97,6 @@ getDbCovariateData <- function(connectionDetails = NULL, cohortTable = "cohort", cohortDatabaseSchema = cdmDatabaseSchema, cohortTableIsTemp = FALSE, - cohortId = -1, cohortIds = c(-1), rowIdField = "subject_id", covariateSettings, @@ -115,10 +111,6 @@ getDbCovariateData <- function(connectionDetails = NULL, if (cdmVersion == "4") { stop("CDM version 4 is not supported any more") } - if (!missing(cohortId)) { - warning("cohortId argument has been deprecated, please use cohortIds") - cohortIds <- cohortId - } errorMessages <- checkmate::makeAssertCollection() minCharacterizationMean <- utils::type.convert(minCharacterizationMean, as.is = TRUE) checkmate::assertNumeric(x = minCharacterizationMean, lower = 0, add = errorMessages) diff --git a/R/GetCovariatesFromCohortAttributes.R b/R/GetCovariatesFromCohortAttributes.R index 5016a7ed..f5c79f50 100644 --- a/R/GetCovariatesFromCohortAttributes.R +++ b/R/GetCovariatesFromCohortAttributes.R @@ -73,7 +73,6 @@ getDbCohortAttrCovariatesData <- function(connection, oracleTempSchema = NULL, cdmDatabaseSchema, cohortTable = "#cohort_person", - cohortId = -1, cohortIds = c(-1), cdmVersion = "5", rowIdField = "subject_id", @@ -85,10 +84,6 @@ getDbCohortAttrCovariatesData <- function(connection, if (cdmVersion == "4") { stop("Common Data Model version 4 is not supported") } - if (!missing(cohortId)) { - warning("cohortId argument has been deprecated, please use cohortIds") - cohortIds <- cohortId - } start <- Sys.time() writeLines("Constructing covariates from cohort attributes table") diff --git a/R/GetCovariatesFromOtherCohorts.R b/R/GetCovariatesFromOtherCohorts.R index 0a20e3bd..58315218 100644 --- a/R/GetCovariatesFromOtherCohorts.R +++ b/R/GetCovariatesFromOtherCohorts.R @@ -32,7 +32,6 @@ getDbCohortBasedCovariatesData <- function(connection, oracleTempSchema = NULL, cdmDatabaseSchema, cohortTable = "#cohort_person", - cohortId = -1, cohortIds = c(-1), cdmVersion = "5", rowIdField = "subject_id", @@ -44,18 +43,14 @@ getDbCohortBasedCovariatesData <- function(connection, checkmate::assertCharacter(oracleTempSchema, len = 1, null.ok = TRUE, add = errorMessages) checkmate::assertCharacter(cdmDatabaseSchema, len = 1, null.ok = TRUE, add = errorMessages) checkmate::assertCharacter(cohortTable, len = 1, add = errorMessages) - checkmate::assertIntegerish(cohortId, add = errorMessages) - # checkmate::assertCharacter(cdmVersion, len = 1, add = errorMessages) + checkmate::assertIntegerish(cohortIds, add = errorMessages) + checkmate::assertCharacter(cdmVersion, len = 1, add = errorMessages) checkmate::assertCharacter(rowIdField, len = 1, add = errorMessages) checkmate::assertClass(covariateSettings, "covariateSettings", add = errorMessages) checkmate::assertLogical(aggregated, len = 1, add = errorMessages) minCharacterizationMean <- utils::type.convert(minCharacterizationMean, as.is = TRUE) checkmate::assertNumeric(x = minCharacterizationMean, lower = 0, add = errorMessages) checkmate::reportAssertions(collection = errorMessages) - if (!missing(cohortId)) { - warning("cohortId argument has been deprecated, please use cohortIds") - cohortIds <- cohortId - } start <- Sys.time() message("Constructing covariates from other cohorts") diff --git a/R/GetDefaultCovariates.R b/R/GetDefaultCovariates.R index ae54b86b..bc0ac556 100644 --- a/R/GetDefaultCovariates.R +++ b/R/GetDefaultCovariates.R @@ -59,7 +59,6 @@ getDbDefaultCovariateData <- function(connection, oracleTempSchema = NULL, cdmDatabaseSchema, cohortTable = "#cohort_person", - cohortId = -1, cohortIds = c(-1), cdmVersion = "5", rowIdField = "subject_id", @@ -79,10 +78,6 @@ getDbDefaultCovariateData <- function(connection, if (!missing(targetCovariateTable) && !is.null(targetCovariateTable) && aggregated) { stop("Writing aggregated results to database is currently not supported") } - if (!missing(cohortId)) { - warning("cohortId argument has been deprecated, please use cohortIds") - cohortIds <- cohortId - } errorMessages <- checkmate::makeAssertCollection() minCharacterizationMean <- utils::type.convert(minCharacterizationMean, as.is = TRUE) checkmate::assertNumeric(x = minCharacterizationMean, lower = 0, add = errorMessages) diff --git a/R/HelperFunctions.R b/R/HelperFunctions.R index 2d30147b..3ec20676 100644 --- a/R/HelperFunctions.R +++ b/R/HelperFunctions.R @@ -65,7 +65,6 @@ filterByRowId <- function(covariateData, rowIds) { #' Filter covariates by cohort definition IDs #' #' @param covariateData An object of type \code{CovariateData} -#' @param cohortId DEPRECATED The cohort definition IDs to keep. #' @param cohortIds The cohort definition IDs to keep. #' #' @return @@ -86,8 +85,7 @@ filterByRowId <- function(covariateData, rowIds) { #' } #' #' @export -filterByCohortDefinitionId <- function(covariateData, - cohortId = 1, +filterByCohortDefinitionId <- function(covariateData, cohortIds = c(1)) { if (!isCovariateData(covariateData)) { stop("Data not of class CovariateData") @@ -98,11 +96,7 @@ filterByCohortDefinitionId <- function(covariateData, if (!isAggregatedCovariateData(covariateData)) { stop("Can only filter aggregated data by cohortIds") } - if (!missing(cohortId)) { - warning("cohortId argument has been deprecated, please use cohortIds") - cohortIds <- cohortId - } - + if (is.null(covariateData$covariates)) { covariates <- NULL } else { diff --git a/R/UnitTestHelperFunctions.R b/R/UnitTestHelperFunctions.R index 62e1e59c..dde0091b 100644 --- a/R/UnitTestHelperFunctions.R +++ b/R/UnitTestHelperFunctions.R @@ -80,7 +80,7 @@ #' oracleTempSchema = NULL, #' cdmDatabaseSchema = "main", #' cohortTable = "cohort", -#' cohortId = 1, +#' cohortIds = 1, #' cdmVersion = "5", #' rowIdField = "subject_id", #' covariateSettings = covSettings, diff --git a/extras/GetHdpsCovariates.R b/extras/GetHdpsCovariates.R index 135f4d02..87e7190a 100644 --- a/extras/GetHdpsCovariates.R +++ b/extras/GetHdpsCovariates.R @@ -36,16 +36,11 @@ getDbHdpsCovariateData <- function(connection, oracleTempSchema = NULL, cdmDatabaseSchema, cohortTable = "cohort_person", - cohortId = -1, cohortIds = c(-1), cdmVersion = "5", rowIdField = "subject_id", covariateSettings, aggregated = FALSE) { - if (!missing(cohortId)) { - warning("cohortId argument has been deprecated, please use cohortIds") - cohortIds <- cohortId - } if (cohortIds != -1) stop("Haven't implemented restricting to cohort ID yet.") if (aggregated) diff --git a/man-roxygen/GetCovarParams.R b/man-roxygen/GetCovarParams.R index 5feb35b8..536afd6d 100644 --- a/man-roxygen/GetCovarParams.R +++ b/man-roxygen/GetCovarParams.R @@ -16,9 +16,6 @@ #' covariates. If it is a temp table, the name should have a hash prefix, #' e.g. '#temp_table'. If it is a non-temp table, it should include the #' database schema, e.g. 'cdm_database.cohort'. -#' @param cohortId DEPRECATED:For which cohort ID should covariates be constructed? If set to -1, -#' covariates will be constructed for all cohorts in the specified cohort -#' table. #' @param cohortIds For which cohort ID(s) should covariates be constructed? If set to c(-1), #' covariates will be constructed for all cohorts in the specified cohort #' table. diff --git a/man/dot-getDbLooCovariateData.Rd b/man/dot-getDbLooCovariateData.Rd index f4544e10..8ae59374 100644 --- a/man/dot-getDbLooCovariateData.Rd +++ b/man/dot-getDbLooCovariateData.Rd @@ -74,7 +74,7 @@ looCovariateData <- .getDbLooCovariateData(connection, oracleTempSchema = NULL, cdmDatabaseSchema = "main", cohortTable = "cohort", - cohortId = 1, + cohortIds = 1, cdmVersion = "5", rowIdField = "subject_id", covariateSettings = covSettings, diff --git a/man/filterByCohortDefinitionId.Rd b/man/filterByCohortDefinitionId.Rd index a2a5dd6c..7b74ba6b 100644 --- a/man/filterByCohortDefinitionId.Rd +++ b/man/filterByCohortDefinitionId.Rd @@ -4,13 +4,11 @@ \alias{filterByCohortDefinitionId} \title{Filter covariates by cohort definition IDs} \usage{ -filterByCohortDefinitionId(covariateData, cohortId = 1, cohortIds = c(1)) +filterByCohortDefinitionId(covariateData, cohortIds = c(1)) } \arguments{ \item{covariateData}{An object of type \code{CovariateData}} -\item{cohortId}{DEPRECATED The cohort definition IDs to keep.} - \item{cohortIds}{The cohort definition IDs to keep.} } \value{ diff --git a/man/getDbCohortAttrCovariatesData.Rd b/man/getDbCohortAttrCovariatesData.Rd index aa2a0efb..aabbd6ed 100644 --- a/man/getDbCohortAttrCovariatesData.Rd +++ b/man/getDbCohortAttrCovariatesData.Rd @@ -9,7 +9,6 @@ getDbCohortAttrCovariatesData( oracleTempSchema = NULL, cdmDatabaseSchema, cohortTable = "#cohort_person", - cohortId = -1, cohortIds = c(-1), cdmVersion = "5", rowIdField = "subject_id", @@ -33,10 +32,6 @@ covariates. If it is a temp table, the name should have a hash prefix, e.g. '#temp_table'. If it is a non-temp table, it should include the database schema, e.g. 'cdm_database.cohort'.} -\item{cohortId}{DEPRECATED:For which cohort ID should covariates be constructed? If set to -1, -covariates will be constructed for all cohorts in the specified cohort -table.} - \item{cohortIds}{For which cohort ID(s) should covariates be constructed? If set to c(-1), covariates will be constructed for all cohorts in the specified cohort table.} diff --git a/man/getDbCohortBasedCovariatesData.Rd b/man/getDbCohortBasedCovariatesData.Rd index 09a2a703..997ef6af 100644 --- a/man/getDbCohortBasedCovariatesData.Rd +++ b/man/getDbCohortBasedCovariatesData.Rd @@ -9,7 +9,6 @@ getDbCohortBasedCovariatesData( oracleTempSchema = NULL, cdmDatabaseSchema, cohortTable = "#cohort_person", - cohortId = -1, cohortIds = c(-1), cdmVersion = "5", rowIdField = "subject_id", @@ -34,10 +33,6 @@ covariates. If it is a temp table, the name should have a hash prefix, e.g. '#temp_table'. If it is a non-temp table, it should include the database schema, e.g. 'cdm_database.cohort'.} -\item{cohortId}{DEPRECATED:For which cohort ID should covariates be constructed? If set to -1, -covariates will be constructed for all cohorts in the specified cohort -table.} - \item{cohortIds}{For which cohort ID(s) should covariates be constructed? If set to c(-1), covariates will be constructed for all cohorts in the specified cohort table.} diff --git a/man/getDbCovariateData.Rd b/man/getDbCovariateData.Rd index b28b3279..6e43d172 100644 --- a/man/getDbCovariateData.Rd +++ b/man/getDbCovariateData.Rd @@ -13,7 +13,6 @@ getDbCovariateData( cohortTable = "cohort", cohortDatabaseSchema = cdmDatabaseSchema, cohortTableIsTemp = FALSE, - cohortId = -1, cohortIds = c(-1), rowIdField = "subject_id", covariateSettings, @@ -51,10 +50,6 @@ specify both the database and the schema, so for example \item{cohortTableIsTemp}{Is the cohort table a temp table?} -\item{cohortId}{DEPRECATED:For which cohort ID(s) should covariates be constructed? If set to -1, -covariates will be constructed for all cohorts in the specified cohort -table.} - \item{cohortIds}{For which cohort ID(s) should covariates be constructed? If set to c(-1), covariates will be constructed for all cohorts in the specified cohort table.} diff --git a/man/getDbDefaultCovariateData.Rd b/man/getDbDefaultCovariateData.Rd index ef19e9b2..f365a5ca 100644 --- a/man/getDbDefaultCovariateData.Rd +++ b/man/getDbDefaultCovariateData.Rd @@ -9,7 +9,6 @@ getDbDefaultCovariateData( oracleTempSchema = NULL, cdmDatabaseSchema, cohortTable = "#cohort_person", - cohortId = -1, cohortIds = c(-1), cdmVersion = "5", rowIdField = "subject_id", @@ -38,10 +37,6 @@ covariates. If it is a temp table, the name should have a hash prefix, e.g. '#temp_table'. If it is a non-temp table, it should include the database schema, e.g. 'cdm_database.cohort'.} -\item{cohortId}{DEPRECATED:For which cohort ID should covariates be constructed? If set to -1, -covariates will be constructed for all cohorts in the specified cohort -table.} - \item{cohortIds}{For which cohort ID(s) should covariates be constructed? If set to c(-1), covariates will be constructed for all cohorts in the specified cohort table.} diff --git a/tests/testthat/test-CovariateData.R b/tests/testthat/test-CovariateData.R index 3cd2be55..8f7d3761 100644 --- a/tests/testthat/test-CovariateData.R +++ b/tests/testthat/test-CovariateData.R @@ -144,17 +144,6 @@ test_that("Test show method", { on.exit(rm(cvData)) }) -test_that("getDbCovariateData cohortId warning", { - skip_if_not(dbms == "sqlite") - settings <- createDefaultCovariateSettings() - expect_warning(getDbCovariateData(connectionDetails = eunomiaConnectionDetails, - cdmDatabaseSchema = eunomiaCdmDatabaseSchema, - cohortDatabaseSchema = eunomiaOhdsiDatabaseSchema, - cohortId = c(1), - covariateSettings = settings, - aggregated = FALSE), "cohortId argument has been deprecated, please use cohortIds") -}) - test_that("getDbCovariateData settings list - check metaData", { skip_if_not(dbms == "sqlite") looCovSet <- FeatureExtraction:::.createLooCovariateSettings(useLengthOfObs = TRUE) diff --git a/tests/testthat/test-GetCovariatesFromCohortAttributes.R b/tests/testthat/test-GetCovariatesFromCohortAttributes.R index e3e6bde9..9fcaab54 100644 --- a/tests/testthat/test-GetCovariatesFromCohortAttributes.R +++ b/tests/testthat/test-GetCovariatesFromCohortAttributes.R @@ -72,23 +72,3 @@ test_that("createCohortAttrCovariateSettings check", { result <- createCohortAttrCovariateSettings(attrDatabaseSchema = "main") expect_equal(class(result), "covariateSettings") }) - -test_that("getDbCohortAttrCovariatesData cohortId warning", { - skip_if_not(dbms == "sqlite") - covariateSettings <- createCohortAttrCovariateSettings( - attrDatabaseSchema = eunomiaOhdsiDatabaseSchema, - cohortAttrTable = cohortAttributeTable, - attrDefinitionTable = attributeDefinitionTable, - includeAttrIds = c(1), - isBinary = FALSE, - missingMeansZero = TRUE - ) - # cohortId argument - expect_warning(getDbCohortAttrCovariatesData( - connection = eunomiaConnection, - cdmDatabaseSchema = eunomiaCdmDatabaseSchema, - cohortTable = cohortTable, - covariateSettings = covariateSettings, - cohortId = 1 - ), "cohortId argument has been deprecated, please use cohortIds") -}) diff --git a/tests/testthat/test-GetDefaultCovariates.R b/tests/testthat/test-GetDefaultCovariates.R index 8570920b..69ba7025 100644 --- a/tests/testthat/test-GetDefaultCovariates.R +++ b/tests/testthat/test-GetDefaultCovariates.R @@ -31,7 +31,7 @@ test_that("Test exit conditions", { expect_error(getDbDefaultCovariateData( connection = eunomiaConnection, cdmDatabaseSchema = "main", - cohortId = -1, + cohortIds = -1, covariateSettings = createDefaultCovariateSettings(), targetDatabaseSchema = "main", targetCovariateTable = "cov",