diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index cc9bc5b..4d2e72f 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 3.8.0 -Date: 2025-03-19 15:22:25 UTC -SHA: c0961a155c6fba22f3b5e4825b599f2410ed529b +Version: 3.11.0 +Date: 2025-09-01 15:11:02 UTC +SHA: 784c4a8dcda6fc0301c8b0823efdfccb1291745e diff --git a/DESCRIPTION b/DESCRIPTION index a7f06bd..0decc0a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: FeatureExtraction Type: Package Title: Generating Features for a Cohort -Version: 3.10.0 -Date: 2025-05-08 +Version: 3.11.0 +Date: 2025-09-01 Authors@R: c( person("Martijn", "Schuemie", , "schuemie@ohdsi.org", role = c("aut")), person("Marc", "Suchard", role = c("aut")), diff --git a/NEWS.md b/NEWS.md index a4b22f8..f3d1347 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +FeatureExtraction 3.11.0 +======================= + +- Improve tidyCovariates performance when using Andromeda version >= 1.0.0 (#308) +- Fix error in merging covariateContinuous to multiple features in getDbCovariateData (#306) +- Add arguments to getDbCovariateData to support a custom covariate cohort schema/table (#292) + FeatureExtraction 3.10.0 ======================= diff --git a/R/GetCovariates.R b/R/GetCovariates.R index ac70cf4..cf2793c 100644 --- a/R/GetCovariates.R +++ b/R/GetCovariates.R @@ -69,6 +69,8 @@ #' @param tempEmulationSchema Some database platforms like Oracle and Impala do not truly support #' temp tables. To emulate temp tables, provide a schema with write #' privileges where temp tables can be created. +#' @param covariateCohortDatabaseSchema The database schema where the cohorts used to define the covariates can be found. +#' @param covariateCohortTable The table where the cohorts used to define the covariates can be found. #' #' @return #' Returns an object of type \code{covariateData}, containing information on the covariates. @@ -113,7 +115,9 @@ getDbCovariateData <- function(connectionDetails = NULL, covariateSettings, aggregated = FALSE, minCharacterizationMean = 0, - tempEmulationSchema = getOption("sqlRenderTempEmulationSchema")) { + tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), + covariateCohortDatabaseSchema = NULL, + covariateCohortTable = NULL) { if (is.null(connectionDetails) && is.null(connection)) { stop("Need to provide either connectionDetails or connection") } @@ -181,6 +185,13 @@ getDbCovariateData <- function(connectionDetails = NULL, hasData <- function(data) { return(!is.null(data) && (data %>% count() %>% pull()) > 0) } + if (!is.null(covariateCohortDatabaseSchema) && !is.null(covariateCohortTable)) { + covariateSettings <- replaceCovariateSettingsCohortSchemaTable( + covariateSettings, + covariateCohortDatabaseSchema, + covariateCohortTable + ) + } for (i in 1:length(covariateSettings)) { fun <- attr(covariateSettings[[i]], "fun") args <- list( @@ -209,10 +220,11 @@ getDbCovariateData <- function(connectionDetails = NULL, if (hasData(covariateData$covariatesContinuous)) { if (hasData(tempCovariateData$covariatesContinuous)) { Andromeda::appendToTable(covariateData$covariatesContinuous, tempCovariateData$covariatesContinuous) - } else if (hasData(tempCovariateData$covariatesContinuous)) { - covariateData$covariatesContinuous <- tempCovariateData$covariatesContinuous } + } else if (hasData(tempCovariateData$covariatesContinuous)) { + covariateData$covariatesContinuous <- tempCovariateData$covariatesContinuous } + Andromeda::appendToTable(covariateData$covariateRef, tempCovariateData$covariateRef) Andromeda::appendToTable(covariateData$analysisRef, tempCovariateData$analysisRef) for (name in names(attr(tempCovariateData, "metaData"))) { diff --git a/R/GetCovariatesFromOtherCohorts.R b/R/GetCovariatesFromOtherCohorts.R index ca40bbb..947efc9 100644 --- a/R/GetCovariatesFromOtherCohorts.R +++ b/R/GetCovariatesFromOtherCohorts.R @@ -325,3 +325,42 @@ warnIfPredefined <- function(analysisId, temporal = FALSE) { warning(sprintf("Analysis ID %d also used for prespecified analysis '%s'.", analysisId, preSpecAnalysis$analysisName)) } } + +#' Utility function to set the cohort table & schema on createCohortBasedCovariateSettings +#' with information from the execution settings +#' +#' @param covariateSettings An object of type \code{covariateSettings} +#' @param covariateCohortDatabaseSchema The database schema where the cohorts used to define the covariates can be found. +#' @param covariateCohortTable The table where the cohorts used to define the covariates can be found. +#' +#' @return +#' An object of type \code{covariateSettings} +#' +replaceCovariateSettingsCohortSchemaTable <- function(covariateSettings, + covariateCohortDatabaseSchema, + covariateCohortTable) { + errorMessages <- checkmate::makeAssertCollection() + checkmate::assertList(covariateSettings, min.len = 1, add = errorMessages) + checkmate::assertCharacter(covariateCohortDatabaseSchema, add = errorMessages) + checkmate::assertCharacter(covariateCohortTable, add = errorMessages) + checkmate::reportAssertions(collection = errorMessages) + + replaceProperties <- function(s) { + if (inherits(s, "covariateSettings") && "fun" %in% names(attributes(s))) { + if (attr(s, "fun") == "getDbCohortBasedCovariatesData") { + # Set the covariateCohortDatabaseSchema & covariateCohortTable values + s$covariateCohortDatabaseSchema <- covariateCohortDatabaseSchema + s$covariateCohortTable <- covariateCohortTable + } + } + return(s) + } + if (is.null(names(covariateSettings))) { + # List of lists + modifiedCovariateSettings <- lapply(covariateSettings, replaceProperties) + } else { + # Plain list + modifiedCovariateSettings <- replaceProperties(covariateSettings) + } + return(modifiedCovariateSettings) +} diff --git a/R/Normalization.R b/R/Normalization.R index d9704f5..a86ab7b 100644 --- a/R/Normalization.R +++ b/R/Normalization.R @@ -179,19 +179,26 @@ tidyCovariateData <- function(covariateData, deleteCovariateIds <- c(deleteCovariateIds, toDelete$covariateId) ParallelLogger::logInfo("Removing ", nrow(toDelete), " infrequent covariates") } - if (length(deleteCovariateIds) > 0) { - newCovariates <- newCovariates %>% - filter(!.data$covariateId %in% deleteCovariateIds) - } + # When performing both filtering by covariate IDs and normalization, it is *much* faster + # to apply the filtering to the maxValuePerCovariateId table, and let the inner join + # apply the filtering to the covariate table (instead of filtering the covariate table + # directly). if (normalize) { ParallelLogger::logInfo("Normalizing covariates") + if (length(deleteCovariateIds) > 0) { + covariateData$maxValuePerCovariateId <- covariateData$maxValuePerCovariateId %>% + filter(!.data$covariateId %in% deleteCovariateIds) + } newCovariates <- newCovariates %>% inner_join(covariateData$maxValuePerCovariateId, by = "covariateId") %>% mutate(covariateValue = .data$covariateValue / .data$maxValue) %>% select(-.data$maxValue) metaData$normFactors <- covariateData$maxValuePerCovariateId %>% collect() + } else if (length(deleteCovariateIds) > 0) { + newCovariates <- newCovariates %>% + filter(!.data$covariateId %in% deleteCovariateIds) } newCovariateData$covariates <- newCovariates if (!is.null(covariateData$timeRef)) { diff --git a/docs/404.html b/docs/404.html index d26137e..5373286 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/articles/CreatingCovariatesBasedOnOtherCohorts.html b/docs/articles/CreatingCovariatesBasedOnOtherCohorts.html index 2908d93..0c1fbc0 100644 --- a/docs/articles/CreatingCovariatesBasedOnOtherCohorts.html +++ b/docs/articles/CreatingCovariatesBasedOnOtherCohorts.html @@ -32,7 +32,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -99,7 +99,7 @@

Creating covariates based on other cohorts

Martijn J. Schuemie

-

2025-05-08

+

2025-09-01

Source: vignettes/CreatingCovariatesBasedOnOtherCohorts.Rmd diff --git a/docs/articles/CreatingCovariatesUsingCohortAttributes.html b/docs/articles/CreatingCovariatesUsingCohortAttributes.html index 56680eb..ba11348 100644 --- a/docs/articles/CreatingCovariatesUsingCohortAttributes.html +++ b/docs/articles/CreatingCovariatesUsingCohortAttributes.html @@ -32,7 +32,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -99,7 +99,7 @@

Creating covariates using cohort attributes

Martijn J. Schuemie

-

2025-05-08

+

2025-09-01

Source: vignettes/CreatingCovariatesUsingCohortAttributes.Rmd diff --git a/docs/articles/CreatingCustomCovariateBuilders.html b/docs/articles/CreatingCustomCovariateBuilders.html index 2002318..7132b50 100644 --- a/docs/articles/CreatingCustomCovariateBuilders.html +++ b/docs/articles/CreatingCustomCovariateBuilders.html @@ -32,7 +32,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -99,7 +99,7 @@

Creating custom covariate builders

Martijn J. Schuemie

-

2025-05-08

+

2025-09-01

Source: vignettes/CreatingCustomCovariateBuilders.Rmd diff --git a/docs/articles/CreatingCustomCovariateBuildersKorean.html b/docs/articles/CreatingCustomCovariateBuildersKorean.html index 659de54..65788fb 100644 --- a/docs/articles/CreatingCustomCovariateBuildersKorean.html +++ b/docs/articles/CreatingCustomCovariateBuildersKorean.html @@ -32,7 +32,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -99,7 +99,7 @@

Creating custom covariate builders (Korean)

Jeon Ga Bin & Martijn J. Schuemie

-

2025-05-08

+

2025-09-01

Source: vignettes/CreatingCustomCovariateBuildersKorean.Rmd diff --git a/docs/articles/UsingFeatureExtraction.html b/docs/articles/UsingFeatureExtraction.html index 7acb0b5..f28ef78 100644 --- a/docs/articles/UsingFeatureExtraction.html +++ b/docs/articles/UsingFeatureExtraction.html @@ -32,7 +32,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -99,7 +99,7 @@

Using FeatureExtraction

Martijn J. Schuemie

-

2025-05-08

+

2025-09-01

Source: vignettes/UsingFeatureExtraction.Rmd diff --git a/docs/articles/UsingFeatureExtractionKorean.html b/docs/articles/UsingFeatureExtractionKorean.html index fa0ded3..f4d59d7 100644 --- a/docs/articles/UsingFeatureExtractionKorean.html +++ b/docs/articles/UsingFeatureExtractionKorean.html @@ -32,7 +32,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -99,7 +99,7 @@

Using FeatureExtraction (Korean)

Jeon Ga Bin & Martijn J. Schuemie

-

2025-05-08

+

2025-09-01

Source: vignettes/UsingFeatureExtractionKorean.Rmd diff --git a/docs/articles/index.html b/docs/articles/index.html index c0abf04..a140c5c 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/authors.html b/docs/authors.html index d911940..b41cb9e 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -115,13 +115,13 @@

Citation

Schuemie M, Suchard M, Ryan P, Reps J, Sena A, Inberg G (2025). FeatureExtraction: Generating Features for a Cohort. -R package version 3.10.0, https://github.com/OHDSI/FeatureExtraction. +R package version 3.11.0, https://github.com/OHDSI/FeatureExtraction.

@Manual{,
   title = {FeatureExtraction: Generating Features for a Cohort},
   author = {Martijn Schuemie and Marc Suchard and Patrick Ryan and Jenna Reps and Anthony Sena and Ger Inberg},
   year = {2025},
-  note = {R package version 3.10.0},
+  note = {R package version 3.11.0},
   url = {https://github.com/OHDSI/FeatureExtraction},
 }
diff --git a/docs/index.html b/docs/index.html index 8bcac0d..3a0e982 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,7 +33,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/news/index.html b/docs/news/index.html index 50c8b3d..9b302eb 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -76,7 +76,7 @@

Changelog

- +
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 4c631cf..9e30e0e 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,4 +1,4 @@ -pandoc: '3.2' +pandoc: '3.4' pkgdown: 2.1.0 pkgdown_sha: ~ articles: @@ -8,4 +8,4 @@ articles: CreatingCustomCovariateBuildersKorean: CreatingCustomCovariateBuildersKorean.html UsingFeatureExtraction: UsingFeatureExtraction.html UsingFeatureExtractionKorean: UsingFeatureExtractionKorean.html -last_built: 2025-05-08T13:26Z +last_built: 2025-09-01T09:33Z diff --git a/docs/reference/CovariateData-class.html b/docs/reference/CovariateData-class.html index 9e18713..e74ae54 100644 --- a/docs/reference/CovariateData-class.html +++ b/docs/reference/CovariateData-class.html @@ -25,7 +25,7 @@ FeatureExtraction - 3.10.0 + 3.11.0
diff --git a/docs/reference/FeatureExtraction-package.html b/docs/reference/FeatureExtraction-package.html index be11f84..8a443d1 100644 --- a/docs/reference/FeatureExtraction-package.html +++ b/docs/reference/FeatureExtraction-package.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/aggregateCovariates.html b/docs/reference/aggregateCovariates.html index 1ee2817..29966a1 100644 --- a/docs/reference/aggregateCovariates.html +++ b/docs/reference/aggregateCovariates.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -107,7 +107,7 @@

Examples

temporal = FALSE ) aggregatedCovariateData <- aggregateCovariates(covariateData) -#> Aggregating covariates took 0.406 secs +#> Aggregating covariates took 0.53 secs # } diff --git a/docs/reference/computeStandardizedDifference.html b/docs/reference/computeStandardizedDifference.html index 2ca0ea0..3d750b9 100644 --- a/docs/reference/computeStandardizedDifference.html +++ b/docs/reference/computeStandardizedDifference.html @@ -18,7 +18,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -123,7 +123,8 @@

Value

Examples

# \donttest{
 binaryCovDataFile <- system.file("testdata/binaryCovariateData.zip",
-  package = "FeatureExtraction")
+  package = "FeatureExtraction"
+)
 covariateData1 <- loadCovariateData(binaryCovDataFile)
 covariateData2 <- loadCovariateData(binaryCovDataFile)
 covDataDiff <- computeStandardizedDifference(
diff --git a/docs/reference/convertPrespecSettingsToDetailedSettings.html b/docs/reference/convertPrespecSettingsToDetailedSettings.html
index e6100ed..8986e82 100644
--- a/docs/reference/convertPrespecSettingsToDetailedSettings.html
+++ b/docs/reference/convertPrespecSettingsToDetailedSettings.html
@@ -17,7 +17,7 @@
       
       
         FeatureExtraction
-        3.10.0
+        3.11.0
       
     
diff --git a/docs/reference/createAnalysisDetails.html b/docs/reference/createAnalysisDetails.html index dfb1d4b..ad2e3cb 100644 --- a/docs/reference/createAnalysisDetails.html +++ b/docs/reference/createAnalysisDetails.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createCohortAttrCovariateSettings.html b/docs/reference/createCohortAttrCovariateSettings.html index 90c5cf1..ba20f79 100644 --- a/docs/reference/createCohortAttrCovariateSettings.html +++ b/docs/reference/createCohortAttrCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createCohortBasedCovariateSettings.html b/docs/reference/createCohortBasedCovariateSettings.html index b41aa40..721c003 100644 --- a/docs/reference/createCohortBasedCovariateSettings.html +++ b/docs/reference/createCohortBasedCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createCohortBasedTemporalCovariateSettings.html b/docs/reference/createCohortBasedTemporalCovariateSettings.html index c84e485..7e4e4bc 100644 --- a/docs/reference/createCohortBasedTemporalCovariateSettings.html +++ b/docs/reference/createCohortBasedTemporalCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createCovariateSettings.html b/docs/reference/createCovariateSettings.html index a8717e7..24b2f95 100644 --- a/docs/reference/createCovariateSettings.html +++ b/docs/reference/createCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createDefaultCovariateSettings.html b/docs/reference/createDefaultCovariateSettings.html index 03e313a..601bb90 100644 --- a/docs/reference/createDefaultCovariateSettings.html +++ b/docs/reference/createDefaultCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createDefaultTemporalCovariateSettings.html b/docs/reference/createDefaultTemporalCovariateSettings.html index b175b45..0bf737a 100644 --- a/docs/reference/createDefaultTemporalCovariateSettings.html +++ b/docs/reference/createDefaultTemporalCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createDetailedCovariateSettings.html b/docs/reference/createDetailedCovariateSettings.html index 003e9dc..b1d8c8e 100644 --- a/docs/reference/createDetailedCovariateSettings.html +++ b/docs/reference/createDetailedCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createDetailedTemporalCovariateSettings.html b/docs/reference/createDetailedTemporalCovariateSettings.html index 6614e37..b2ab9eb 100644 --- a/docs/reference/createDetailedTemporalCovariateSettings.html +++ b/docs/reference/createDetailedTemporalCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createEmptyCovariateData.html b/docs/reference/createEmptyCovariateData.html index d0fecc2..1a557ec 100644 --- a/docs/reference/createEmptyCovariateData.html +++ b/docs/reference/createEmptyCovariateData.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createTable1.html b/docs/reference/createTable1.html index 723e76c..7b72572 100644 --- a/docs/reference/createTable1.html +++ b/docs/reference/createTable1.html @@ -18,7 +18,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -199,9 +199,9 @@

Examples

#> Connecting using SQLite driver #> Constructing features on server #> | | | 0% | | | 1% | |= | 1% | |= | 2% | |== | 2% | |== | 3% | |=== | 4% | |=== | 5% | |==== | 5% | |==== | 6% | |===== | 7% | |===== | 8% | |====== | 8% | |====== | 9% | |======= | 10% | |======= | 11% | |======== | 11% | |======== | 12% | |========= | 12% | |========= | 13% | |========== | 14% | |========== | 15% | |=========== | 15% | |=========== | 16% | |============ | 16% | |============ | 17% | |============ | 18% | |============= | 18% | |============= | 19% | |============== | 19% | |============== | 20% | |============== | 21% | |=============== | 21% | |=============== | 22% | |================ | 22% | |================ | 23% | |================= | 24% | |================= | 25% | |================== | 25% | |================== | 26% | |=================== | 27% | |=================== | 28% | |==================== | 28% | |==================== | 29% | |===================== | 29% | |===================== | 30% | |===================== | 31% | |====================== | 31% | |====================== | 32% | |======================= | 32% | |======================= | 33% | |======================= | 34% | |======================== | 34% | |======================== | 35% | |========================= | 35% | |========================= | 36% | |========================== | 37% | |========================== | 38% | |=========================== | 38% | |=========================== | 39% | |============================ | 39% | |============================ | 40% | |============================= | 41% | |============================= | 42% | |============================== | 42% | |============================== | 43% | |=============================== | 44% | |=============================== | 45% | |================================ | 45% | |================================ | 46% | |================================= | 47% | |================================= | 48% | |================================== | 48% | |================================== | 49% | |=================================== | 49% | |=================================== | 50% | |=================================== | 51% | |==================================== | 51% | |==================================== | 52% | |===================================== | 52% | |===================================== | 53% | |====================================== | 54% | |====================================== | 55% | |======================================= | 55% | |======================================= | 56% | |======================================== | 57% | |======================================== | 58% | |========================================= | 58% | |========================================= | 59% | |========================================== | 60% | |========================================== | 61% | |=========================================== | 61% | |=========================================== | 62% | |============================================ | 62% | |============================================ | 63% | |============================================= | 64% | |============================================= | 65% | |============================================== | 65% | |============================================== | 66% | |=============================================== | 66% | |=============================================== | 67% | |=============================================== | 68% | |================================================ | 68% | |================================================ | 69% | |================================================= | 69% | |================================================= | 70% | |================================================= | 71% | |================================================== | 71% | |================================================== | 72% | |=================================================== | 72% | |=================================================== | 73% | |==================================================== | 74% | |==================================================== | 75% | |===================================================== | 75% | |===================================================== | 76% | |====================================================== | 77% | |====================================================== | 78% | |======================================================= | 78% | |======================================================= | 79% | |======================================================== | 79% | |======================================================== | 80% | |======================================================== | 81% | |========================================================= | 81% | |========================================================= | 82% | |========================================================== | 82% | |========================================================== | 83% | |========================================================== | 84% | |=========================================================== | 84% | |=========================================================== | 85% | |============================================================ | 85% | |============================================================ | 86% | |============================================================= | 87% | |============================================================= | 88% | |============================================================== | 88% | |============================================================== | 89% | |=============================================================== | 89% | |=============================================================== | 90% | |================================================================ | 91% | |================================================================ | 92% | |================================================================= | 92% | |================================================================= | 93% | |================================================================== | 94% | |================================================================== | 95% | |=================================================================== | 95% | |=================================================================== | 96% | |==================================================================== | 97% | |==================================================================== | 98% | |===================================================================== | 98% | |===================================================================== | 99% | |======================================================================| 99% | |======================================================================| 100% -#> Executing SQL took 1.05 secs +#> Executing SQL took 1.11 secs #> Fetching data from server -#> Fetching data took 0.0951 secs +#> Fetching data took 0.236 secs covData2 <- getDbCovariateData( connectionDetails = eunomiaConnectionDetails, tempEmulationSchema = NULL, @@ -219,9 +219,9 @@

Examples

#> Connecting using SQLite driver #> Constructing features on server #> | | | 0% | | | 1% | |= | 1% | |= | 2% | |== | 2% | |== | 3% | |=== | 4% | |=== | 5% | |==== | 5% | |==== | 6% | |===== | 7% | |===== | 8% | |====== | 8% | |====== | 9% | |======= | 10% | |======= | 11% | |======== | 11% | |======== | 12% | |========= | 12% | |========= | 13% | |========== | 14% | |========== | 15% | |=========== | 15% | |=========== | 16% | |============ | 16% | |============ | 17% | |============ | 18% | |============= | 18% | |============= | 19% | |============== | 19% | |============== | 20% | |============== | 21% | |=============== | 21% | |=============== | 22% | |================ | 22% | |================ | 23% | |================= | 24% | |================= | 25% | |================== | 25% | |================== | 26% | |=================== | 27% | |=================== | 28% | |==================== | 28% | |==================== | 29% | |===================== | 29% | |===================== | 30% | |===================== | 31% | |====================== | 31% | |====================== | 32% | |======================= | 32% | |======================= | 33% | |======================= | 34% | |======================== | 34% | |======================== | 35% | |========================= | 35% | |========================= | 36% | |========================== | 37% | |========================== | 38% | |=========================== | 38% | |=========================== | 39% | |============================ | 39% | |============================ | 40% | |============================= | 41% | |============================= | 42% | |============================== | 42% | |============================== | 43% | |=============================== | 44% | |=============================== | 45% | |================================ | 45% | |================================ | 46% | |================================= | 47% | |================================= | 48% | |================================== | 48% | |================================== | 49% | |=================================== | 49% | |=================================== | 50% | |=================================== | 51% | |==================================== | 51% | |==================================== | 52% | |===================================== | 52% | |===================================== | 53% | |====================================== | 54% | |====================================== | 55% | |======================================= | 55% | |======================================= | 56% | |======================================== | 57% | |======================================== | 58% | |========================================= | 58% | |========================================= | 59% | |========================================== | 60% | |========================================== | 61% | |=========================================== | 61% | |=========================================== | 62% | |============================================ | 62% | |============================================ | 63% | |============================================= | 64% | |============================================= | 65% | |============================================== | 65% | |============================================== | 66% | |=============================================== | 66% | |=============================================== | 67% | |=============================================== | 68% | |================================================ | 68% | |================================================ | 69% | |================================================= | 69% | |================================================= | 70% | |================================================= | 71% | |================================================== | 71% | |================================================== | 72% | |=================================================== | 72% | |=================================================== | 73% | |==================================================== | 74% | |==================================================== | 75% | |===================================================== | 75% | |===================================================== | 76% | |====================================================== | 77% | |====================================================== | 78% | |======================================================= | 78% | |======================================================= | 79% | |======================================================== | 79% | |======================================================== | 80% | |======================================================== | 81% | |========================================================= | 81% | |========================================================= | 82% | |========================================================== | 82% | |========================================================== | 83% | |========================================================== | 84% | |=========================================================== | 84% | |=========================================================== | 85% | |============================================================ | 85% | |============================================================ | 86% | |============================================================= | 87% | |============================================================= | 88% | |============================================================== | 88% | |============================================================== | 89% | |=============================================================== | 89% | |=============================================================== | 90% | |================================================================ | 91% | |================================================================ | 92% | |================================================================= | 92% | |================================================================= | 93% | |================================================================== | 94% | |================================================================== | 95% | |=================================================================== | 95% | |=================================================================== | 96% | |==================================================================== | 97% | |==================================================================== | 98% | |===================================================================== | 98% | |===================================================================== | 99% | |======================================================================| 99% | |======================================================================| 100% -#> Executing SQL took 0.831 secs +#> Executing SQL took 0.905 secs #> Fetching data from server -#> Fetching data took 0.0914 secs +#> Fetching data took 0.3 secs table1 <- createTable1( covariateData1 = covData1, covariateData2 = covData2, diff --git a/docs/reference/createTable1CovariateSettings.html b/docs/reference/createTable1CovariateSettings.html index 3d6d1ef..d0e9ee6 100644 --- a/docs/reference/createTable1CovariateSettings.html +++ b/docs/reference/createTable1CovariateSettings.html @@ -19,7 +19,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createTemporalCovariateSettings.html b/docs/reference/createTemporalCovariateSettings.html index b91713e..f6d4fab 100644 --- a/docs/reference/createTemporalCovariateSettings.html +++ b/docs/reference/createTemporalCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/createTemporalSequenceCovariateSettings.html b/docs/reference/createTemporalSequenceCovariateSettings.html index 31953d2..d47b091 100644 --- a/docs/reference/createTemporalSequenceCovariateSettings.html +++ b/docs/reference/createTemporalSequenceCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/dot-createLooCovariateSettings.html b/docs/reference/dot-createLooCovariateSettings.html index 152df9f..0b718d6 100644 --- a/docs/reference/dot-createLooCovariateSettings.html +++ b/docs/reference/dot-createLooCovariateSettings.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/dot-getDbLooCovariateData.html b/docs/reference/dot-getDbLooCovariateData.html index 8a46194..0a6bfce 100644 --- a/docs/reference/dot-getDbLooCovariateData.html +++ b/docs/reference/dot-getDbLooCovariateData.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/filterByCohortDefinitionId.html b/docs/reference/filterByCohortDefinitionId.html index 202f778..e5ea4c8 100644 --- a/docs/reference/filterByCohortDefinitionId.html +++ b/docs/reference/filterByCohortDefinitionId.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/filterByRowId.html b/docs/reference/filterByRowId.html index 60919c9..9c8092e 100644 --- a/docs/reference/filterByRowId.html +++ b/docs/reference/filterByRowId.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/getDbCohortAttrCovariatesData.html b/docs/reference/getDbCohortAttrCovariatesData.html index 415d9e6..a09966d 100644 --- a/docs/reference/getDbCohortAttrCovariatesData.html +++ b/docs/reference/getDbCohortAttrCovariatesData.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -237,8 +237,8 @@

Examples

aggregated = FALSE ) #> Constructing covariates from cohort attributes table -#> Inserting data took 0.00612 secs -#> Loading took 0.0243 secs +#> Inserting data took 0.00668 secs +#> Loading took 0.0282 secs # }
diff --git a/docs/reference/getDbCohortBasedCovariatesData.html b/docs/reference/getDbCohortBasedCovariatesData.html index f197f1c..228eb5d 100644 --- a/docs/reference/getDbCohortBasedCovariatesData.html +++ b/docs/reference/getDbCohortBasedCovariatesData.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/getDbCovariateData.html b/docs/reference/getDbCovariateData.html index 559bab4..26e1546 100644 --- a/docs/reference/getDbCovariateData.html +++ b/docs/reference/getDbCovariateData.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -96,7 +96,9 @@

Get covariate information from the database

covariateSettings, aggregated = FALSE, minCharacterizationMean = 0, - tempEmulationSchema = getOption("sqlRenderTempEmulationSchema") + tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), + covariateCohortDatabaseSchema = NULL, + covariateCohortTable = NULL ) @@ -192,6 +194,14 @@

Arguments

temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created.

+ +
covariateCohortDatabaseSchema
+

The database schema where the cohorts used to define the covariates can be found.

+ + +
covariateCohortTable
+

The table where the cohorts used to define the covariates can be found.

+

Value

@@ -248,9 +258,9 @@

Examples

#> Connecting using SQLite driver #> Constructing features on server #> | | | 0% | |= | 1% | |= | 2% | |== | 2% | |== | 3% | |=== | 4% | |=== | 5% | |==== | 5% | |==== | 6% | |===== | 7% | |===== | 8% | |====== | 8% | |====== | 9% | |======= | 9% | |======= | 10% | |======= | 11% | |======== | 11% | |======== | 12% | |========= | 12% | |========= | 13% | |========= | 14% | |========== | 14% | |========== | 15% | |=========== | 15% | |=========== | 16% | |============ | 17% | |============ | 18% | |============= | 18% | |============= | 19% | |============== | 20% | |============== | 21% | |=============== | 21% | |=============== | 22% | |================ | 22% | |================ | 23% | |================= | 24% | |================= | 25% | |================== | 25% | |================== | 26% | |=================== | 27% | |=================== | 28% | |==================== | 28% | |==================== | 29% | |===================== | 29% | |===================== | 30% | |====================== | 31% | |====================== | 32% | |======================= | 32% | |======================= | 33% | |======================== | 34% | |======================== | 35% | |========================= | 35% | |========================= | 36% | |========================== | 36% | |========================== | 37% | |========================== | 38% | |=========================== | 38% | |=========================== | 39% | |============================ | 39% | |============================ | 40% | |============================ | 41% | |============================= | 41% | |============================= | 42% | |============================== | 42% | |============================== | 43% | |=============================== | 44% | |=============================== | 45% | |================================ | 45% | |================================ | 46% | |================================= | 47% | |================================= | 48% | |================================== | 48% | |================================== | 49% | |=================================== | 50% | |==================================== | 51% | |==================================== | 52% | |===================================== | 52% | |===================================== | 53% | |====================================== | 54% | |====================================== | 55% | |======================================= | 55% | |======================================= | 56% | |======================================== | 57% | |======================================== | 58% | |========================================= | 58% | |========================================= | 59% | |========================================== | 59% | |========================================== | 60% | |========================================== | 61% | |=========================================== | 61% | |=========================================== | 62% | |============================================ | 62% | |============================================ | 63% | |============================================ | 64% | |============================================= | 64% | |============================================= | 65% | |============================================== | 65% | |============================================== | 66% | |=============================================== | 67% | |=============================================== | 68% | |================================================ | 68% | |================================================ | 69% | |================================================= | 70% | |================================================= | 71% | |================================================== | 71% | |================================================== | 72% | |=================================================== | 72% | |=================================================== | 73% | |==================================================== | 74% | |==================================================== | 75% | |===================================================== | 75% | |===================================================== | 76% | |====================================================== | 77% | |====================================================== | 78% | |======================================================= | 78% | |======================================================= | 79% | |======================================================== | 79% | |======================================================== | 80% | |========================================================= | 81% | |========================================================= | 82% | |========================================================== | 82% | |========================================================== | 83% | |=========================================================== | 84% | |=========================================================== | 85% | |============================================================ | 85% | |============================================================ | 86% | |============================================================= | 86% | |============================================================= | 87% | |============================================================= | 88% | |============================================================== | 88% | |============================================================== | 89% | |=============================================================== | 89% | |=============================================================== | 90% | |=============================================================== | 91% | |================================================================ | 91% | |================================================================ | 92% | |================================================================= | 92% | |================================================================= | 93% | |================================================================== | 94% | |================================================================== | 95% | |=================================================================== | 95% | |=================================================================== | 96% | |==================================================================== | 97% | |==================================================================== | 98% | |===================================================================== | 98% | |===================================================================== | 99% | |======================================================================| 100% -#> Executing SQL took 1.42 secs +#> Executing SQL took 1.44 secs #> Fetching data from server -#> Fetching data took 0.102 secs +#> Fetching data took 0.196 secs # }
diff --git a/docs/reference/getDbDefaultCovariateData.html b/docs/reference/getDbDefaultCovariateData.html index 2bd66a9..6458f49 100644 --- a/docs/reference/getDbDefaultCovariateData.html +++ b/docs/reference/getDbDefaultCovariateData.html @@ -19,7 +19,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -262,9 +262,9 @@

Examples

) #> Constructing features on server #> | | | 0% | |= | 1% | |= | 2% | |== | 2% | |== | 3% | |=== | 4% | |=== | 5% | |==== | 5% | |==== | 6% | |===== | 7% | |===== | 8% | |====== | 8% | |====== | 9% | |======= | 9% | |======= | 10% | |======= | 11% | |======== | 11% | |======== | 12% | |========= | 12% | |========= | 13% | |========= | 14% | |========== | 14% | |========== | 15% | |=========== | 15% | |=========== | 16% | |============ | 17% | |============ | 18% | |============= | 18% | |============= | 19% | |============== | 20% | |============== | 21% | |=============== | 21% | |=============== | 22% | |================ | 22% | |================ | 23% | |================= | 24% | |================= | 25% | |================== | 25% | |================== | 26% | |=================== | 27% | |=================== | 28% | |==================== | 28% | |==================== | 29% | |===================== | 29% | |===================== | 30% | |====================== | 31% | |====================== | 32% | |======================= | 32% | |======================= | 33% | |======================== | 34% | |======================== | 35% | |========================= | 35% | |========================= | 36% | |========================== | 36% | |========================== | 37% | |========================== | 38% | |=========================== | 38% | |=========================== | 39% | |============================ | 39% | |============================ | 40% | |============================ | 41% | |============================= | 41% | |============================= | 42% | |============================== | 42% | |============================== | 43% | |=============================== | 44% | |=============================== | 45% | |================================ | 45% | |================================ | 46% | |================================= | 47% | |================================= | 48% | |================================== | 48% | |================================== | 49% | |=================================== | 50% | |==================================== | 51% | |==================================== | 52% | |===================================== | 52% | |===================================== | 53% | |====================================== | 54% | |====================================== | 55% | |======================================= | 55% | |======================================= | 56% | |======================================== | 57% | |======================================== | 58% | |========================================= | 58% | |========================================= | 59% | |========================================== | 59% | |========================================== | 60% | |========================================== | 61% | |=========================================== | 61% | |=========================================== | 62% | |============================================ | 62% | |============================================ | 63% | |============================================ | 64% | |============================================= | 64% | |============================================= | 65% | |============================================== | 65% | |============================================== | 66% | |=============================================== | 67% | |=============================================== | 68% | |================================================ | 68% | |================================================ | 69% | |================================================= | 70% | |================================================= | 71% | |================================================== | 71% | |================================================== | 72% | |=================================================== | 72% | |=================================================== | 73% | |==================================================== | 74% | |==================================================== | 75% | |===================================================== | 75% | |===================================================== | 76% | |====================================================== | 77% | |====================================================== | 78% | |======================================================= | 78% | |======================================================= | 79% | |======================================================== | 79% | |======================================================== | 80% | |========================================================= | 81% | |========================================================= | 82% | |========================================================== | 82% | |========================================================== | 83% | |=========================================================== | 84% | |=========================================================== | 85% | |============================================================ | 85% | |============================================================ | 86% | |============================================================= | 86% | |============================================================= | 87% | |============================================================= | 88% | |============================================================== | 88% | |============================================================== | 89% | |=============================================================== | 89% | |=============================================================== | 90% | |=============================================================== | 91% | |================================================================ | 91% | |================================================================ | 92% | |================================================================= | 92% | |================================================================= | 93% | |================================================================== | 94% | |================================================================== | 95% | |=================================================================== | 95% | |=================================================================== | 96% | |==================================================================== | 97% | |==================================================================== | 98% | |===================================================================== | 98% | |===================================================================== | 99% | |======================================================================| 100% -#> Executing SQL took 1.45 secs +#> Executing SQL took 1.43 secs #> Writing data to table -#> Writing data took0.0149 secs +#> Writing data took0.0154 secs # } diff --git a/docs/reference/getDefaultTable1Specifications.html b/docs/reference/getDefaultTable1Specifications.html index 02457b7..f9fa1fc 100644 --- a/docs/reference/getDefaultTable1Specifications.html +++ b/docs/reference/getDefaultTable1Specifications.html @@ -18,7 +18,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/index.html b/docs/reference/index.html index 0c029b9..37211d4 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -202,6 +202,10 @@

All functions loadCovariateData()

Load the covariate data from a folder

+ +

replaceCovariateSettingsCohortSchemaTable()

+ +

Utility function to set the cohort table & schema on createCohortBasedCovariateSettings with information from the execution settings

saveCovariateData()

diff --git a/docs/reference/isAggregatedCovariateData.html b/docs/reference/isAggregatedCovariateData.html index 1f6e2f8..a9af799 100644 --- a/docs/reference/isAggregatedCovariateData.html +++ b/docs/reference/isAggregatedCovariateData.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 diff --git a/docs/reference/isCovariateData.html b/docs/reference/isCovariateData.html index 3b74e56..3ca183e 100644 --- a/docs/reference/isCovariateData.html +++ b/docs/reference/isCovariateData.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -101,7 +101,8 @@

Value

Examples

# \donttest{
 binaryCovDataFile <- system.file("testdata/binaryCovariateData.zip",
-  package = "FeatureExtraction")
+  package = "FeatureExtraction"
+)
 covData <- loadCovariateData(binaryCovDataFile)
 isCovData <- isCovariateData(covData)
 # }
diff --git a/docs/reference/isTemporalCovariateData.html b/docs/reference/isTemporalCovariateData.html
index 59c5a61..311c8c9 100644
--- a/docs/reference/isTemporalCovariateData.html
+++ b/docs/reference/isTemporalCovariateData.html
@@ -17,7 +17,7 @@
       
       
         FeatureExtraction
-        3.10.0
+        3.11.0
       
     
diff --git a/docs/reference/loadCovariateData.html b/docs/reference/loadCovariateData.html index d8bfb1b..cbb0be2 100644 --- a/docs/reference/loadCovariateData.html +++ b/docs/reference/loadCovariateData.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -109,7 +109,8 @@

Details

Examples

# \donttest{
 binaryCovDataFile <- system.file("testdata/binaryCovariateData.zip",
-  package = "FeatureExtraction")
+  package = "FeatureExtraction"
+)
 covData <- loadCovariateData(binaryCovDataFile)
 # }
 
diff --git a/docs/reference/replaceCovariateSettingsCohortSchemaTable.html b/docs/reference/replaceCovariateSettingsCohortSchemaTable.html
new file mode 100644
index 0000000..f978a3f
--- /dev/null
+++ b/docs/reference/replaceCovariateSettingsCohortSchemaTable.html
@@ -0,0 +1,137 @@
+
+Utility function to set the cohort table & schema on createCohortBasedCovariateSettings with information from the execution settings — replaceCovariateSettingsCohortSchemaTable • FeatureExtraction
+
+
+    
+
+ + + +
+
+ + +
+

Utility function to set the cohort table & schema on createCohortBasedCovariateSettings +with information from the execution settings

+
+ +
+
replaceCovariateSettingsCohortSchemaTable(
+  covariateSettings,
+  covariateCohortDatabaseSchema,
+  covariateCohortTable
+)
+
+ +
+

Arguments

+ + +
covariateSettings
+

An object of type covariateSettings

+ + +
covariateCohortDatabaseSchema
+

The database schema where the cohorts used to define the covariates can be found.

+ + +
covariateCohortTable
+

The table where the cohorts used to define the covariates can be found.

+ +
+
+

Value

+

An object of type covariateSettings

+
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.1.0.

+
+ +
+ + + + + + + + diff --git a/docs/reference/saveCovariateData.html b/docs/reference/saveCovariateData.html index 0559469..f206145 100644 --- a/docs/reference/saveCovariateData.html +++ b/docs/reference/saveCovariateData.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0
diff --git a/docs/reference/tidyCovariateData.html b/docs/reference/tidyCovariateData.html index 8e02448..71f1234 100644 --- a/docs/reference/tidyCovariateData.html +++ b/docs/reference/tidyCovariateData.html @@ -17,7 +17,7 @@ FeatureExtraction - 3.10.0 + 3.11.0 @@ -137,7 +137,7 @@

Examples

normalize = TRUE, removeRedundancy = TRUE ) -#> Tidying covariates took 0.162 secs +#> Tidying covariates took 0.28 secs # }
diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 2bb760e..2986c72 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -49,6 +49,7 @@ /reference/isCovariateData.html /reference/isTemporalCovariateData.html /reference/loadCovariateData.html +/reference/replaceCovariateSettingsCohortSchemaTable.html /reference/saveCovariateData.html /reference/tidyCovariateData.html diff --git a/extras/FeatureExtraction.pdf b/extras/FeatureExtraction.pdf index bb6a4e6..7e020ff 100644 Binary files a/extras/FeatureExtraction.pdf and b/extras/FeatureExtraction.pdf differ diff --git a/inst/doc/CreatingCovariatesBasedOnOtherCohorts.pdf b/inst/doc/CreatingCovariatesBasedOnOtherCohorts.pdf index 37c761f..29fadf6 100644 Binary files a/inst/doc/CreatingCovariatesBasedOnOtherCohorts.pdf and b/inst/doc/CreatingCovariatesBasedOnOtherCohorts.pdf differ diff --git a/inst/doc/CreatingCovariatesUsingCohortAttributes.pdf b/inst/doc/CreatingCovariatesUsingCohortAttributes.pdf index 3ccad2f..88a38aa 100644 Binary files a/inst/doc/CreatingCovariatesUsingCohortAttributes.pdf and b/inst/doc/CreatingCovariatesUsingCohortAttributes.pdf differ diff --git a/inst/doc/CreatingCustomCovariateBuilders.pdf b/inst/doc/CreatingCustomCovariateBuilders.pdf index a1ba2f4..bc83b4f 100644 Binary files a/inst/doc/CreatingCustomCovariateBuilders.pdf and b/inst/doc/CreatingCustomCovariateBuilders.pdf differ diff --git a/inst/doc/CreatingCustomCovariateBuildersKorean.pdf b/inst/doc/CreatingCustomCovariateBuildersKorean.pdf index fe57ad4..06d1239 100644 Binary files a/inst/doc/CreatingCustomCovariateBuildersKorean.pdf and b/inst/doc/CreatingCustomCovariateBuildersKorean.pdf differ diff --git a/inst/doc/UsingFeatureExtraction.pdf b/inst/doc/UsingFeatureExtraction.pdf index 530da45..c3a90ad 100644 Binary files a/inst/doc/UsingFeatureExtraction.pdf and b/inst/doc/UsingFeatureExtraction.pdf differ diff --git a/inst/doc/UsingFeatureExtractionKorean.pdf b/inst/doc/UsingFeatureExtractionKorean.pdf index e7eb726..7034981 100644 Binary files a/inst/doc/UsingFeatureExtractionKorean.pdf and b/inst/doc/UsingFeatureExtractionKorean.pdf differ diff --git a/inst/java/featureExtraction-3.10.0.jar b/inst/java/featureExtraction-3.11.0.jar similarity index 100% rename from inst/java/featureExtraction-3.10.0.jar rename to inst/java/featureExtraction-3.11.0.jar diff --git a/man/getDbCovariateData.Rd b/man/getDbCovariateData.Rd index 74c3679..92aa19b 100644 --- a/man/getDbCovariateData.Rd +++ b/man/getDbCovariateData.Rd @@ -19,7 +19,9 @@ getDbCovariateData( covariateSettings, aggregated = FALSE, minCharacterizationMean = 0, - tempEmulationSchema = getOption("sqlRenderTempEmulationSchema") + tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), + covariateCohortDatabaseSchema = NULL, + covariateCohortTable = NULL ) } \arguments{ @@ -81,6 +83,10 @@ on covariates that have very low values. The default is 0.} \item{tempEmulationSchema}{Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created.} + +\item{covariateCohortDatabaseSchema}{The database schema where the cohorts used to define the covariates can be found.} + +\item{covariateCohortTable}{The table where the cohorts used to define the covariates can be found.} } \value{ Returns an object of type \code{covariateData}, containing information on the covariates. diff --git a/man/replaceCovariateSettingsCohortSchemaTable.Rd b/man/replaceCovariateSettingsCohortSchemaTable.Rd new file mode 100644 index 0000000..e3a8c6b --- /dev/null +++ b/man/replaceCovariateSettingsCohortSchemaTable.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/GetCovariatesFromOtherCohorts.R +\name{replaceCovariateSettingsCohortSchemaTable} +\alias{replaceCovariateSettingsCohortSchemaTable} +\title{Utility function to set the cohort table & schema on createCohortBasedCovariateSettings +with information from the execution settings} +\usage{ +replaceCovariateSettingsCohortSchemaTable( + covariateSettings, + covariateCohortDatabaseSchema, + covariateCohortTable +) +} +\arguments{ +\item{covariateSettings}{An object of type \code{covariateSettings}} + +\item{covariateCohortDatabaseSchema}{The database schema where the cohorts used to define the covariates can be found.} + +\item{covariateCohortTable}{The table where the cohorts used to define the covariates can be found.} +} +\value{ +An object of type \code{covariateSettings} +} +\description{ +Utility function to set the cohort table & schema on createCohortBasedCovariateSettings +with information from the execution settings +} diff --git a/tests/testthat/test-CovariateData.R b/tests/testthat/test-CovariateData.R index a7ddbac..2b1d2e4 100644 --- a/tests/testthat/test-CovariateData.R +++ b/tests/testthat/test-CovariateData.R @@ -188,3 +188,26 @@ test_that("getDbCovariateData settings list - check metaData", { expect_equal(length(metaData$sql), 1) expect_equal(length(metaData$sql[[1]]), 2) }) + +test_that("getDbCovariateData settings list - check covariatesContinuous", { + skip_on_cran() + skip_if_not(dbms == "sqlite" && exists("eunomiaConnection")) + covariateSettingsList <- list( + FeatureExtraction::createCovariateSettings( + useDemographicsGender = T, + useDemographicsAgeGroup = T + ), + FeatureExtraction::createDefaultCovariateSettings() + ) + covariateData <- getDbCovariateData( + connection = eunomiaConnection, + cdmDatabaseSchema = eunomiaCdmDatabaseSchema, + cohortDatabaseSchema = eunomiaOhdsiDatabaseSchema, + cohortTable = "cohort", + cohortIds = c(1), + covariateSettings = covariateSettingsList, + aggregated = TRUE, + minCharacterizationMean = 0 + ) + expect_false(is.null(covariateData$covariatesContinuous)) +}) diff --git a/tests/testthat/test-GetCohortBasedCovariates.R b/tests/testthat/test-GetCohortBasedCovariates.R index 34e8bcc..7963bd2 100644 --- a/tests/testthat/test-GetCohortBasedCovariates.R +++ b/tests/testthat/test-GetCohortBasedCovariates.R @@ -70,7 +70,8 @@ dropCohortBasedCovariateTestData <- function(connection, } # Database specific tests --------------- -runCohortBasedBinaryNonAggTest <- function(connection, cdmDatabaseSchema, ohdsiDatabaseSchema, cohortTable) { +runCohortBasedBinaryNonAggTest <- function(connection, cdmDatabaseSchema, ohdsiDatabaseSchema, cohortTable, + covariateCohortDatabaseSchema = NULL, covariateCohortTable = NULL) { createCohortBasedCovariateTestData( connection = connection, databaseSchema = ohdsiDatabaseSchema, @@ -99,7 +100,9 @@ runCohortBasedBinaryNonAggTest <- function(connection, cdmDatabaseSchema, ohdsiD cdmVersion = "5", rowIdField = "subject_id", covariateSettings = settings, - aggregated = FALSE + aggregated = FALSE, + covariateCohortDatabaseSchema = covariateCohortDatabaseSchema, + covariateCohortTable = covariateCohortTable ) covariates <- dplyr::collect(covs$covariates) @@ -485,6 +488,29 @@ test_that("Cohort-based covariates: binary, non-aggregated on Eunomia", { ) }) +test_that("Cohort-based covariates: binary, non-aggregated, custom covariate cohort schema/table on Eunomia", { + skip_if_not(dbms == "sqlite" && exists("eunomiaConnection")) + runCohortBasedBinaryNonAggTest( + connection = eunomiaConnection, + cdmDatabaseSchema = eunomiaCdmDatabaseSchema, + ohdsiDatabaseSchema = eunomiaOhdsiDatabaseSchema, + cohortTable = "cohort_cov", + covariateCohortDatabaseSchema = eunomiaOhdsiDatabaseSchema, + covariateCohortTable = "cohort_cov" + ) + testthat::expect_error( + runCohortBasedBinaryNonAggTest( + connection = eunomiaConnection, + cdmDatabaseSchema = eunomiaCdmDatabaseSchema, + ohdsiDatabaseSchema = eunomiaOhdsiDatabaseSchema, + cohortTable = "cohort_cov", + covariateCohortDatabaseSchema = "unknown", + covariateCohortTable = "unknown" + ), + "no such table: unknown.unknown" + ) +}) + test_that("Cohort-based covariates: binary, aggregated on Eunomia", { skip_on_cran() skip_if_not(dbms == "sqlite" && exists("eunomiaConnection"))