diff --git a/.Rbuildignore b/.Rbuildignore index a152430..def897d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,5 @@ +^renv$ +^renv\.lock$ pom.xml extras docs diff --git a/DESCRIPTION b/DESCRIPTION index 4c1e6a3..521f730 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: FeatureExtraction Type: Package Title: Generating Features for a Cohort -Version: 3.12.0 -Date: 2025-10-28 +Version: 3.13.0 +Date: 2026-03-05 Authors@R: c( person("Martijn", "Schuemie", , "schuemie@ohdsi.org", role = c("aut")), person("Marc", "Suchard", role = c("aut")), @@ -46,6 +46,6 @@ VignetteBuilder: knitr URL: https://github.com/OHDSI/FeatureExtraction BugReports: https://github.com/OHDSI/FeatureExtraction/issues NeedsCompilation: no -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.3 Encoding: UTF-8 Language: en-US diff --git a/NEWS.md b/NEWS.md index 6ddbdc4..9bdbe65 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,15 @@ +FeatureExtraction 3.13.0 +======================= + +New Features: + +- Added ability to store aggregate results from `getDbCovariateData` in the database and added +ability to control all target tables with new `target*Table` parameters (#152, #321) + +Bugfixes: + +- Fixed tests and made sure storage of covariates with `getDbDefaultCovariateData` works and is consistent + FeatureExtraction 3.12.0 ======================= diff --git a/R/Aggregation.R b/R/Aggregation.R index 53a48e6..afb70f4 100644 --- a/R/Aggregation.R +++ b/R/Aggregation.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/CompareCohorts.R b/R/CompareCohorts.R index fffa07f..c1f7beb 100644 --- a/R/CompareCohorts.R +++ b/R/CompareCohorts.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/CovariateData.R b/R/CovariateData.R index 3a0dfff..772ac09 100644 --- a/R/CovariateData.R +++ b/R/CovariateData.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/DefaultCovariateSettings.R b/R/DefaultCovariateSettings.R index 4a45f71..b5acf68 100644 --- a/R/DefaultCovariateSettings.R +++ b/R/DefaultCovariateSettings.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/DefaultTemporalCovariateSettings.R b/R/DefaultTemporalCovariateSettings.R index 5d1004b..c0bba9b 100644 --- a/R/DefaultTemporalCovariateSettings.R +++ b/R/DefaultTemporalCovariateSettings.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/DefaultTemporalSequenceCovariateSettings.R b/R/DefaultTemporalSequenceCovariateSettings.R index aac1c59..e40d297 100644 --- a/R/DefaultTemporalSequenceCovariateSettings.R +++ b/R/DefaultTemporalSequenceCovariateSettings.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/DetailedCovariateSettings.R b/R/DetailedCovariateSettings.R index 2ea8132..92d6dd8 100644 --- a/R/DetailedCovariateSettings.R +++ b/R/DetailedCovariateSettings.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/FeatureExtraction.R b/R/FeatureExtraction.R index 7132f6c..6346da6 100644 --- a/R/FeatureExtraction.R +++ b/R/FeatureExtraction.R @@ -1,6 +1,6 @@ # @file FeatureExtraction.R # -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/GetCovariates.R b/R/GetCovariates.R index cf2793c..94b55c0 100644 --- a/R/GetCovariates.R +++ b/R/GetCovariates.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # @@ -72,6 +72,29 @@ #' @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. #' +#' @param exportToTable Whether to export to a table rather than Andromeda object +#' @param dropTableIfExists If targetDatabaseSchema, drop any existing tables. Otherwise, results are merged +#' into existing table data. Overides createTable. +#' @param createTable Run sql to create table? Code does not check if table exists. +#' @param targetDatabaseSchema (Optional) The name of the database schema where the resulting covariates +#' should be stored as a table. If not provided, results will be fetched to R. +#' @param targetCovariateTable (Optional) The name of the table where the resulting covariates will +#' be stored. If not provided, results will be fetched to R. The table can be +#' a permanent table in the \code{targetDatabaseSchema} or a temp table. If +#' it is a temp table, do not specify \code{targetDatabaseSchema}. +#' @param targetCovariateContinuousTable (Optional) The name of the table where the resulting continuous covariates will +#' be stored. If not provided, results will be fetched to R. The table can be +#' a permanent table in the \code{targetDatabaseSchema} or a temp table. If +#' it is a temp table, do not specify \code{targetDatabaseSchema}. +#' @param targetCovariateRefTable (Optional) The name of the table where the covariate reference will be stored. If +#' it is a temp table, do not specify \code{targetDatabaseSchema}. +#' +#' @param targetAnalysisRefTable (Optional) The name of the table where the analysis reference will be stored. If +#' it is a temp table, do not specify \code{targetDatabaseSchema}. +#' @param targetTimeRefTable (Optional) The name of the table for the time reference. If +#' it is a temp table, do not specify \code{targetDatabaseSchema}. +#' +#' #' @return #' Returns an object of type \code{covariateData}, containing information on the covariates. #' @@ -113,6 +136,15 @@ getDbCovariateData <- function(connectionDetails = NULL, cohortIds = c(-1), rowIdField = "subject_id", covariateSettings, + exportToTable = FALSE, + createTable = exportToTable, + dropTableIfExists = exportToTable, + targetDatabaseSchema = NULL, + targetCovariateTable = NULL, + targetCovariateContinuousTable = NULL, + targetCovariateRefTable = NULL, + targetAnalysisRefTable = NULL, + targetTimeRefTable = NULL, aggregated = FALSE, minCharacterizationMean = 0, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), @@ -155,6 +187,115 @@ getDbCovariateData <- function(connectionDetails = NULL, } else { cohortDatabaseSchemaTable <- paste(cohortDatabaseSchema, cohortTable, sep = ".") } + + # check for temporal features in any of the settings + if (inherits(covariateSettings, "covariateSettings")) { + anyTemporal <- covariateSettings$temporal | covariateSettings$temporalSequence + } else { + anyTemporal <- sum(unlist(lapply( + X = covariateSettings, + FUN = function(x) { + sum(c(x$temporal, x$temporalSequence)) == 1 + } + ))) > 0 + } + + # Create export tables + # figure out tables + if (exportToTable) { + if (is.null(targetDatabaseSchema)) { + # turn off create table since the tables are temp + tempOutputTables <- TRUE + # covariate tables + if (substr(targetCovariateTable, 1, 1) == "#") { + targetCovariateTable <- targetCovariateTable + } else { + targetCovariateTable <- paste0("#", targetCovariateTable) + } + # cov cont table + if (substr(targetCovariateContinuousTable, 1, 1) == "#") { + targetCovariateContinuousTable <- targetCovariateContinuousTable + } else { + targetCovariateContinuousTable <- paste0("#", targetCovariateContinuousTable) + } + # cov ref table + if (substr(targetCovariateRefTable, 1, 1) == "#") { + targetCovariateRefTable <- targetCovariateRefTable + } else { + targetCovariateRefTable <- paste0("#", targetCovariateRefTable) + } + # analysis ref table + if (substr(targetAnalysisRefTable, 1, 1) == "#") { + targetAnalysisRefTable <- targetAnalysisRefTable + } else { + targetAnalysisRefTable <- paste0("#", targetAnalysisRefTable) + } + # time ref table + if (substr(targetTimeRefTable, 1, 1) == "#") { + targetTimeRefTable <- targetTimeRefTable + } else { + targetTimeRefTable <- paste0("#", targetTimeRefTable) + } + } else { + tempOutputTables <- FALSE + targetCovariateTable <- paste(targetDatabaseSchema, targetCovariateTable, sep = ".") + targetCovariateContinuousTable <- paste(targetDatabaseSchema, targetCovariateContinuousTable, sep = ".") + targetCovariateRefTable <- paste(targetDatabaseSchema, targetCovariateRefTable, sep = ".") + targetAnalysisRefTable <- paste(targetDatabaseSchema, targetAnalysisRefTable, sep = ".") + targetTimeRefTable <- paste(targetDatabaseSchema, targetTimeRefTable, sep = ".") + } + + # drop table if required + if (dropTableIfExists) { + message("Dropping export tables") + sql <- SqlRender::loadRenderTranslateSql( + sqlFilename = "DropExportTables.sql", + packageName = "FeatureExtraction", + dbms = attr(connection, "dbms"), + tempEmulationSchema = tempEmulationSchema, + temp_tables = tempOutputTables, + covariate_table = targetCovariateTable, + covariate_continuous_table = targetCovariateContinuousTable, + covariate_ref_table = targetCovariateRefTable, + analysis_ref_table = targetAnalysisRefTable, + time_ref_table = targetTimeRefTable + ) + + DatabaseConnector::executeSql( + connection = connection, + sql = sql + ) + } + + if (dropTableIfExists & !createTable) { + stop("Seem to be exporting to tables but create table is FALSE and dropTable is TRUE") + } + + # create the cohort tables if required + if (createTable) { + message("Creating export tables") + sql <- SqlRender::loadRenderTranslateSql( + sqlFilename = "CreateExportTables.sql", + packageName = "FeatureExtraction", + dbms = attr(connection, "dbms"), + tempEmulationSchema = tempEmulationSchema, + aggregated = aggregated, + temporal = anyTemporal, + row_id_field = "row_id", + covariate_table = targetCovariateTable, + covariate_continuous_table = targetCovariateContinuousTable, + covariate_ref_table = targetCovariateRefTable, + analysis_ref_table = targetAnalysisRefTable, + time_ref_table = targetTimeRefTable + ) + + DatabaseConnector::executeSql( + connection = connection, + sql = sql + ) + } + } + sql <- "SELECT cohort_definition_id, COUNT_BIG(*) AS population_size FROM @cohort_database_schema_table {@cohort_ids != -1} ? {WHERE cohort_definition_id IN (@cohort_ids)} GROUP BY cohort_definition_id;" sql <- SqlRender::render( sql = sql, @@ -192,6 +333,7 @@ getDbCovariateData <- function(connectionDetails = NULL, covariateCohortTable ) } + for (i in 1:length(covariateSettings)) { fun <- attr(covariateSettings[[i]], "fun") args <- list( @@ -203,6 +345,11 @@ getDbCovariateData <- function(connectionDetails = NULL, cdmVersion = cdmVersion, rowIdField = rowIdField, covariateSettings = covariateSettings[[i]], + targetCovariateTable = targetCovariateTable, + targetCovariateContinuousTable = targetCovariateContinuousTable, + targetCovariateRefTable = targetCovariateRefTable, + targetAnalysisRefTable = targetAnalysisRefTable, + targetTimeRefTable = targetTimeRefTable, aggregated = aggregated, minCharacterizationMean = minCharacterizationMean ) @@ -225,25 +372,35 @@ getDbCovariateData <- function(connectionDetails = NULL, covariateData$covariatesContinuous <- tempCovariateData$covariatesContinuous } - Andromeda::appendToTable(covariateData$covariateRef, tempCovariateData$covariateRef) - Andromeda::appendToTable(covariateData$analysisRef, tempCovariateData$analysisRef) - for (name in names(attr(tempCovariateData, "metaData"))) { - if (is.null(attr(covariateData, "metaData")[[name]])) { - attr(covariateData, "metaData")[[name]] <- attr(tempCovariateData, "metaData")[[name]] - } else { - attr(covariateData, "metaData")[[name]] <- list( - c( - unlist(attr(covariateData, "metaData")[[name]]), - attr(tempCovariateData, "metaData")[[name]] + if (hasData(tempCovariateData$covariateRef)) { + Andromeda::appendToTable(covariateData$covariateRef, tempCovariateData$covariateRef) + } + if (hasData(tempCovariateData$analysisRef)) { + Andromeda::appendToTable(covariateData$analysisRef, tempCovariateData$analysisRef) + } + + if (!exportToTable) { + for (name in names(attr(tempCovariateData, "metaData"))) { + if (is.null(attr(covariateData, "metaData")[[name]])) { + attr(covariateData, "metaData")[[name]] <- attr(tempCovariateData, "metaData")[[name]] + } else { + attr(covariateData, "metaData")[[name]] <- list( + c( + unlist(attr(covariateData, "metaData")[[name]]), + attr(tempCovariateData, "metaData")[[name]] + ) ) - ) + } } - } + } # if not exporting } } } - attr(covariateData, "metaData")$populationSize <- populationSize - attr(covariateData, "metaData")$cohortIds <- cohortIds + + if (!is.null(covariateData)) { + attr(covariateData, "metaData")$populationSize <- populationSize + attr(covariateData, "metaData")$cohortIds <- cohortIds + } } - return(covariateData) + return(invisible(covariateData)) } diff --git a/R/GetCovariatesFromCohortAttributes.R b/R/GetCovariatesFromCohortAttributes.R index 47b3b58..9e265f9 100644 --- a/R/GetCovariatesFromCohortAttributes.R +++ b/R/GetCovariatesFromCohortAttributes.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/GetCovariatesFromOtherCohorts.R b/R/GetCovariatesFromOtherCohorts.R index 947efc9..dca900e 100644 --- a/R/GetCovariatesFromOtherCohorts.R +++ b/R/GetCovariatesFromOtherCohorts.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # @@ -22,6 +22,18 @@ #' @param covariateSettings An object of type \code{covariateSettings} as created using the #' \code{\link{createCohortBasedCovariateSettings}} or #' \code{\link{createCohortBasedTemporalCovariateSettings}} functions. +#' @param targetDatabaseSchema (Optional) The name of the database schema where the resulting covariates +#' should be stored. If not provided, results will be fetched to R. +#' @param targetCovariateTable (Optional) The name of the table where the resulting covariates will +#' be stored. If not provided, results will be fetched to R. The table can be +#' a permanent table in the \code{targetDatabaseSchema} or a temp table. If +#' it is a temp table, do not specify \code{targetDatabaseSchema}. +#' +#' @param targetCovariateContinuousTable (Optional) The name of the table where the resulting continuous covariates should be stored. +#' @param targetCovariateRefTable (Optional) The name of the table where the covariate reference will be stored. +#' +#' @param targetAnalysisRefTable (Optional) The name of the table where the analysis reference will be stored. +#' @param targetTimeRefTable (Optional) The name of the table for the time reference #' @param minCharacterizationMean The minimum mean value for binary characterization output. Values below this will be cut off from output. This #' will help reduce the file size of the characterization output, but will remove information #' on covariates that have very low values. The default is 0. @@ -37,6 +49,12 @@ getDbCohortBasedCovariatesData <- function(connection, cdmVersion = "5", rowIdField = "subject_id", covariateSettings, + targetDatabaseSchema = NULL, + targetCovariateTable = NULL, + targetCovariateContinuousTable = NULL, + targetCovariateRefTable = NULL, + targetAnalysisRefTable = NULL, + targetTimeRefTable = NULL, aggregated = FALSE, minCharacterizationMean = 0, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema")) { @@ -153,6 +171,11 @@ getDbCohortBasedCovariatesData <- function(connection, cdmVersion = cdmVersion, rowIdField = rowIdField, covariateSettings = detailledSettings, + targetCovariateTable = targetCovariateTable, + targetCovariateContinuousTable = targetCovariateContinuousTable, + targetCovariateRefTable = targetCovariateRefTable, + targetAnalysisRefTable = targetAnalysisRefTable, + targetTimeRefTable = targetTimeRefTable, aggregated = aggregated, minCharacterizationMean = minCharacterizationMean ) diff --git a/R/GetDefaultCovariates.R b/R/GetDefaultCovariates.R index 86a09c8..849d227 100644 --- a/R/GetDefaultCovariates.R +++ b/R/GetDefaultCovariates.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # @@ -24,17 +24,19 @@ #' @param covariateSettings Either an object of type \code{covariateSettings} as created using one #' of the createCovariate functions, or a list of such objects. #' @param targetDatabaseSchema (Optional) The name of the database schema where the resulting covariates -#' should be stored. +#' should be stored. If not provided, results will be fetched to R. #' @param targetCovariateTable (Optional) The name of the table where the resulting covariates will #' be stored. If not provided, results will be fetched to R. The table can be #' a permanent table in the \code{targetDatabaseSchema} or a temp table. If #' it is a temp table, do not specify \code{targetDatabaseSchema}. +#' @param targetCovariateContinuousTable (Optional) The name of the table where the resulting continuous covariates should be stored. #' @param targetCovariateRefTable (Optional) The name of the table where the covariate reference will be stored. +#' #' @param targetAnalysisRefTable (Optional) The name of the table where the analysis reference will be stored. +#' @param targetTimeRefTable (Optional) The name of the table for the time reference #' @param minCharacterizationMean The minimum mean value for binary characterization output. Values below this will be cut off from output. This #' will help reduce the file size of the characterization output, but will remove information #' on covariates that have very low values. The default is 0. -#' #' @template GetCovarParams #' #' @examples @@ -52,9 +54,7 @@ #' connection = connection, #' cdmDatabaseSchema = "main", #' cohortTable = "cohort", -#' covariateSettings = createDefaultCovariateSettings(), -#' targetDatabaseSchema = "main", -#' targetCovariateTable = "ut_cov" +#' covariateSettings = createDefaultCovariateSettings() #' ) #' } #' @export @@ -67,10 +67,12 @@ getDbDefaultCovariateData <- function(connection, cdmVersion = "5", rowIdField = "subject_id", covariateSettings, - targetDatabaseSchema, - targetCovariateTable, - targetCovariateRefTable, - targetAnalysisRefTable, + targetDatabaseSchema = NULL, + targetCovariateTable = NULL, + targetCovariateContinuousTable = NULL, + targetCovariateRefTable = NULL, + targetAnalysisRefTable = NULL, + targetTimeRefTable = NULL, aggregated = FALSE, minCharacterizationMean = 0, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema")) { @@ -80,9 +82,7 @@ getDbDefaultCovariateData <- function(connection, if (cdmVersion == "4") { stop("Common Data Model version 4 is not supported") } - 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 @@ -99,6 +99,19 @@ getDbDefaultCovariateData <- function(connection, checkmate::assertNumeric(x = minCharacterizationMean, lower = 0, upper = 1, add = errorMessages) checkmate::reportAssertions(collection = errorMessages) + + targetTables <- list( + covariates = targetCovariateTable, + covariatesContinuous = targetCovariateContinuousTable, + covariateRef = targetCovariateRefTable, + analysisRef = targetAnalysisRefTable, + timeRef = targetTimeRefTable + ) + # Is the target schema missing or are all the specified tables temp + allTempTables <- all(substr(targetTables, 1, 1) == "#") + extractToAndromeda <- is.null(targetCovariateTable) + + settings <- .toJson(covariateSettings) rJava::J("org.ohdsi.featureExtraction.FeatureExtraction")$init(system.file("", package = "FeatureExtraction")) json <- rJava::J("org.ohdsi.featureExtraction.FeatureExtraction")$createSql( @@ -129,18 +142,20 @@ getDbDefaultCovariateData <- function(connection, profile <- (!is.null(getOption("dbProfile")) && getOption("dbProfile") == TRUE) DatabaseConnector::executeSql(connection, sql, profile = profile) - if (missing(targetCovariateTable) || is.null(targetCovariateTable)) { - ParallelLogger::logInfo("Fetching data from server") - start <- Sys.time() - # Binary or non-aggregated features - covariateData <- Andromeda::andromeda() - if (!is.null(todo$sqlQueryFeatures)) { + # Now we extract the results into Andromeda tables or as tables + ParallelLogger::logInfo("Fetching data from server") + start <- Sys.time() + covariateData <- Andromeda::andromeda() + + # Binary or non-aggregated features + if (!is.null(todo$sqlQueryFeatures)) { + # etracting covariate table + if (extractToAndromeda) { sql <- SqlRender::translate( sql = todo$sqlQueryFeatures, targetDialect = attr(connection, "dbms"), tempEmulationSchema = tempEmulationSchema ) - DatabaseConnector::querySqlToAndromeda( connection = connection, sql = sql, @@ -148,10 +163,52 @@ getDbDefaultCovariateData <- function(connection, andromedaTableName = "covariates", snakeCaseToCamelCase = TRUE ) + } else { + # for testing to see column order + # print(todo$sqlQueryFeatures) + + sql <- " + INSERT INTO @target_covariate_table( + + {@temporal | @temporal_sequence} ? {time_id,} + + {@aggregated}?{ + cohort_definition_id, + covariate_id, + sum_value, + average_value + }:{ + covariate_id, + row_id, + covariate_value + } + + ) @sub_query; " + + sql <- SqlRender::render( + sql = sql, + target_covariate_table = targetTables$covariates, + sub_query = gsub(";", "", todo$sqlQueryFeatures), + temporal = covariateSettings$temporal, + temporal_sequence = covariateSettings$temporalSequence, + aggregated = aggregated + ) + + sql <- SqlRender::translate( + sql = sql, + targetDialect = DatabaseConnector::dbms(connection), + tempEmulationSchema = tempEmulationSchema + ) + DatabaseConnector::executeSql( + connection = connection, + sql = sql + ) } + } - # Continuous aggregated features - if (!is.null(todo$sqlQueryContinuousFeatures)) { + # Continuous aggregated features + if (!is.null(todo$sqlQueryContinuousFeatures)) { + if (extractToAndromeda) { sql <- SqlRender::translate( sql = todo$sqlQueryContinuousFeatures, targetDialect = attr(connection, "dbms"), @@ -164,50 +221,62 @@ getDbDefaultCovariateData <- function(connection, andromedaTableName = "covariatesContinuous", snakeCaseToCamelCase = TRUE ) - } + } else { + sql <- " + INSERT INTO @target_covariate_continuous_table( + {@aggregated}?{ - # Covariate reference - sql <- SqlRender::translate( - sql = todo$sqlQueryFeatureRef, - targetDialect = attr(connection, "dbms"), - tempEmulationSchema = tempEmulationSchema - ) + cohort_definition_id, + covariate_id, + {@temporal | @temporal_sequence} ? {time_id,} + count_value, + min_value, + max_value, + average_value, + standard_deviation, + median_value, + p10_value, + p25_value, + p75_value, + p90_value - DatabaseConnector::querySqlToAndromeda( - connection = connection, - sql = sql, - andromeda = covariateData, - andromedaTableName = "covariateRef", - snakeCaseToCamelCase = TRUE - ) - collisions <- covariateData$covariateRef %>% - filter(collisions > 0) %>% - collect() - if (nrow(collisions) > 0) { - warning(sprintf( - "Collisions in covariate IDs detected for post-coordinated concepts with covariate IDs %s", - paste(collisions$covariateId, paste = ", ") - )) - } + }:{ - # Analysis reference - sql <- SqlRender::translate( - sql = todo$sqlQueryAnalysisRef, - targetDialect = attr(connection, "dbms"), - tempEmulationSchema = tempEmulationSchema - ) - DatabaseConnector::querySqlToAndromeda( - connection = connection, - sql = sql, - andromeda = covariateData, - andromedaTableName = "analysisRef", - snakeCaseToCamelCase = TRUE - ) + covariate_id, + {@temporal | @temporal_sequence} ? {time_id,} + row_id, + covariate_value + + } + + ) @sub_query;" + + sql <- SqlRender::render( + sql = sql, + target_covariate_continuous_table = targetTables$covariatesContinuous, + sub_query = gsub(";", "", todo$sqlQueryContinuousFeatures), + temporal = covariateSettings$temporal, + temporal_sequence = covariateSettings$temporalSequence, + aggregated = aggregated + ) - # Time reference - if (!is.null(todo$sqlQueryTimeRef)) { sql <- SqlRender::translate( - sql = todo$sqlQueryTimeRef, + sql = sql, + targetDialect = DatabaseConnector::dbms(connection), + tempEmulationSchema = tempEmulationSchema + ) + DatabaseConnector::executeSql( + connection = connection, + sql = sql + ) + } + } + + # Covariate reference + if (!is.null(todo$sqlQueryFeatureRef)) { + if (extractToAndromeda) { + sql <- SqlRender::translate( + sql = todo$sqlQueryFeatureRef, targetDialect = attr(connection, "dbms"), tempEmulationSchema = tempEmulationSchema ) @@ -215,62 +284,145 @@ getDbDefaultCovariateData <- function(connection, connection = connection, sql = sql, andromeda = covariateData, - andromedaTableName = "timeRef", + andromedaTableName = "covariateRef", snakeCaseToCamelCase = TRUE ) - } + collisions <- covariateData$covariateRef %>% + dplyr::filter(collisions > 0) %>% + dplyr::collect() - delta <- Sys.time() - start - ParallelLogger::logInfo("Fetching data took ", signif(delta, 3), " ", attr(delta, "units")) - } else { - # Don't fetch to R , but create on server instead - ParallelLogger::logInfo("Writing data to table") - start <- Sys.time() - convertQuery <- function(sql, databaseSchema, table) { - if (missing(databaseSchema) || is.null(databaseSchema)) { - tableName <- table - } else { - tableName <- paste(databaseSchema, table, sep = ".") + if (nrow(collisions) > 0) { + warning(sprintf( + "Collisions in covariate IDs detected for post-coordinated concepts with covariate IDs %s", + paste(collisions$covariateId, paste = ", ") + )) } - return(sub("FROM", paste("INTO", tableName, "FROM"), sql)) - } + } else { + sql <- " + INSERT INTO @target_covariate_ref_table( + covariate_id, + covariate_name, + analysis_id, + concept_id, + value_as_concept_id, + collisions + ) @sub_query ;" + + sql <- SqlRender::render( + sql = sql, + target_covariate_ref_table = targetTables$covariateRef, + sub_query = gsub(";", "", todo$sqlQueryFeatureRef) + ) - # Covariates - if (!is.null(todo$sqlQueryFeatures)) { - sql <- convertQuery(todo$sqlQueryFeatures, targetDatabaseSchema, targetCovariateTable) sql <- SqlRender::translate( sql = sql, - targetDialect = attr(connection, "dbms"), + targetDialect = DatabaseConnector::dbms(connection), tempEmulationSchema = tempEmulationSchema ) - DatabaseConnector::executeSql(connection, sql, progressBar = FALSE, reportOverallTime = FALSE) + DatabaseConnector::executeSql( + connection = connection, + sql = sql + ) } + } + - # Covariate reference - if (!missing(targetCovariateRefTable) && !is.null(targetCovariateRefTable)) { - sql <- convertQuery(todo$sqlQueryFeatureRef, targetDatabaseSchema, targetCovariateRefTable) + # Analysis reference + if (!is.null(todo$sqlQueryAnalysisRef)) { + if (extractToAndromeda) { sql <- SqlRender::translate( - sql = sql, + sql = todo$sqlQueryAnalysisRef, targetDialect = attr(connection, "dbms"), tempEmulationSchema = tempEmulationSchema ) - DatabaseConnector::executeSql(connection, sql, progressBar = FALSE, reportOverallTime = FALSE) - } + DatabaseConnector::querySqlToAndromeda( + connection = connection, + sql = sql, + andromeda = covariateData, + andromedaTableName = "analysisRef", + snakeCaseToCamelCase = TRUE + ) + } else { + sql <- " + INSERT INTO @target_analysis_ref_table( + analysis_id, + analysis_name, + domain_id, + {!@temporal} ? { + start_day, + end_day, + } + is_binary, + missing_means_zero + ) @sub_query ;" + + sql <- SqlRender::render( + sql = sql, + target_analysis_ref_table = targetTables$analysisRef, + sub_query = gsub(";", "", todo$sqlQueryAnalysisRef), + temporal = covariateSettings$temporal | covariateSettings$temporalSequence + ) - # Analysis reference - if (!missing(targetAnalysisRefTable) && !is.null(targetAnalysisRefTable)) { - sql <- convertQuery(todo$sqlQueryAnalysisRef, targetDatabaseSchema, targetAnalysisRefTable) sql <- SqlRender::translate( sql = sql, + targetDialect = DatabaseConnector::dbms(connection), + tempEmulationSchema = tempEmulationSchema + ) + DatabaseConnector::executeSql( + connection = connection, + sql = sql + ) + } + } + + + # Time reference + if (!is.null(todo$sqlQueryTimeRef)) { + if (extractToAndromeda) { + sql <- SqlRender::translate( + sql = todo$sqlQueryTimeRef, targetDialect = attr(connection, "dbms"), tempEmulationSchema = tempEmulationSchema ) - DatabaseConnector::executeSql(connection, sql, progressBar = FALSE, reportOverallTime = FALSE) + DatabaseConnector::querySqlToAndromeda( + connection = connection, + sql = sql, + andromeda = covariateData, + andromedaTableName = "timeRef", + snakeCaseToCamelCase = TRUE + ) + } else { + # TODO - what columns are in time ref table?! + sql <- " + INSERT INTO @target_time_ref_table( + time_part, + time_interval, + sequence_start_day, + sequence_end_day + ) @sub_query;" + + sql <- SqlRender::render( + sql = sql, + target_covariate_ref_table = targetTables$timeRef, + sub_query = gsub(";", "", todo$sqlQueryTimeRef) + ) + + sql <- SqlRender::translate( + sql = sql, + targetDialect = DatabaseConnector::dbms(connection), + tempEmulationSchema = tempEmulationSchema + ) + DatabaseConnector::executeSql( + connection = connection, + sql = sql + ) } - delta <- Sys.time() - start - ParallelLogger::logInfo("Writing data took", signif(delta, 3), " ", attr(delta, "units")) } + + delta <- Sys.time() - start + ParallelLogger::logInfo("Fetching data took ", signif(delta, 3), " ", attr(delta, "units")) + # Drop temp tables sql <- SqlRender::translate( sql = todo$sqlCleanup, @@ -291,7 +443,7 @@ getDbDefaultCovariateData <- function(connection, } } - if (missing(targetCovariateTable) || is.null(targetCovariateTable)) { + if (extractToAndromeda) { attr(covariateData, "metaData") <- list() if (is.null(covariateData$covariates) && is.null(covariateData$covariatesContinuous)) { warning("No data found, probably because no covariates were specified.") @@ -304,5 +456,7 @@ getDbDefaultCovariateData <- function(connection, class(covariateData) <- "CovariateData" attr(class(covariateData), "package") <- "FeatureExtraction" return(covariateData) + } else { + return(invisible(NULL)) } } diff --git a/R/HelperFunctions.R b/R/HelperFunctions.R index 1979107..b05da06 100644 --- a/R/HelperFunctions.R +++ b/R/HelperFunctions.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/Normalization.R b/R/Normalization.R index 45cace8..c0c6896 100644 --- a/R/Normalization.R +++ b/R/Normalization.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/Table1.R b/R/Table1.R index d1dab25..fb963a0 100644 --- a/R/Table1.R +++ b/R/Table1.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/R/UnitTestHelperFunctions.R b/R/UnitTestHelperFunctions.R index 205b598..bdf4499 100644 --- a/R/UnitTestHelperFunctions.R +++ b/R/UnitTestHelperFunctions.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # @@ -59,6 +59,7 @@ #' @param minCharacterizationMean The minimum mean value for binary characterization output. Values below this will be cut off from output. This #' will help reduce the file size of the characterization output, but will remove information #' on covariates that have very low values. The default is 0. +#' @param ... Additional arguments, not used. #' @return #' Returns an object of type \code{covariateData}, containing information on the covariates. #' @@ -71,7 +72,8 @@ rowIdField = "subject_id", covariateSettings, aggregated = FALSE, - minCharacterizationMean = 0) { + minCharacterizationMean = 0, + ...) { writeLines("Constructing length of observation covariates") if (covariateSettings$useLengthOfObs == FALSE) { return(NULL) diff --git a/docs/404.html b/docs/404.html index 69a032d..ee1f49a 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1,5 +1,5 @@ - + @@ -32,7 +32,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -118,7 +118,7 @@

Page not found (404)

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/articles/CreatingCovariatesBasedOnOtherCohorts.html b/docs/articles/CreatingCovariatesBasedOnOtherCohorts.html index 3845ba9..57ee8d1 100644 --- a/docs/articles/CreatingCovariatesBasedOnOtherCohorts.html +++ b/docs/articles/CreatingCovariatesBasedOnOtherCohorts.html @@ -1,5 +1,5 @@ - + @@ -32,7 +32,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -99,8 +99,8 @@

Creating covariates based on other cohorts

Martijn J. Schuemie

-

2025-10-28

- +

2026-03-05

+ Source: vignettes/CreatingCovariatesBasedOnOtherCohorts.Rmd @@ -390,7 +390,7 @@

Using the cohort as covariate

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/articles/CreatingCovariatesUsingCohortAttributes.html b/docs/articles/CreatingCovariatesUsingCohortAttributes.html index f544dcb..57aef7b 100644 --- a/docs/articles/CreatingCovariatesUsingCohortAttributes.html +++ b/docs/articles/CreatingCovariatesUsingCohortAttributes.html @@ -1,5 +1,5 @@ - + @@ -32,7 +32,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -99,8 +99,8 @@

Creating covariates using cohort attributes

Martijn J. Schuemie

-

2025-10-28

- +

2026-03-05

+ Source: vignettes/CreatingCovariatesUsingCohortAttributes.Rmd @@ -308,7 +308,7 @@

Using the attributes as covariates

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/articles/CreatingCustomCovariateBuilders.html b/docs/articles/CreatingCustomCovariateBuilders.html index 61e963f..820a796 100644 --- a/docs/articles/CreatingCustomCovariateBuilders.html +++ b/docs/articles/CreatingCustomCovariateBuilders.html @@ -1,5 +1,5 @@ - + @@ -32,7 +32,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -99,8 +99,8 @@

Creating custom covariate builders

Martijn J. Schuemie

-

2025-10-28

- +

2026-03-05

+ Source: vignettes/CreatingCustomCovariateBuilders.Rmd @@ -424,7 +424,7 @@

Using the custom covariate builder

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/articles/CreatingCustomCovariateBuildersKorean.html b/docs/articles/CreatingCustomCovariateBuildersKorean.html index b38a499..ab9ea82 100644 --- a/docs/articles/CreatingCustomCovariateBuildersKorean.html +++ b/docs/articles/CreatingCustomCovariateBuildersKorean.html @@ -1,5 +1,5 @@ - + @@ -32,7 +32,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -99,8 +99,8 @@

Creating custom covariate builders (Korean)

Jeon Ga Bin & Martijn J. Schuemie

-

2025-10-28

- +

2026-03-05

+ Source: vignettes/CreatingCustomCovariateBuildersKorean.Rmd @@ -374,7 +374,7 @@

사용자 지정 공변량 빌

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/articles/UsingFeatureExtraction.html b/docs/articles/UsingFeatureExtraction.html index 90a18d0..aa1cd7d 100644 --- a/docs/articles/UsingFeatureExtraction.html +++ b/docs/articles/UsingFeatureExtraction.html @@ -1,5 +1,5 @@ - + @@ -32,7 +32,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -99,8 +99,8 @@

Using FeatureExtraction

Martijn J. Schuemie

-

2025-10-28

- +

2026-03-05

+ Source: vignettes/UsingFeatureExtraction.Rmd @@ -807,7 +807,7 @@

Comparing two cohorts

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/articles/UsingFeatureExtractionKorean.html b/docs/articles/UsingFeatureExtractionKorean.html index 8829312..2d07583 100644 --- a/docs/articles/UsingFeatureExtractionKorean.html +++ b/docs/articles/UsingFeatureExtractionKorean.html @@ -1,5 +1,5 @@ - + @@ -32,7 +32,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -99,8 +99,8 @@

Using FeatureExtraction (Korean)

Jeon Ga Bin & Martijn J. Schuemie

-

2025-10-28

- +

2026-03-05

+ Source: vignettes/UsingFeatureExtractionKorean.Rmd @@ -729,7 +729,7 @@

테이블 만들기 1

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/articles/index.html b/docs/articles/index.html index af982be..9a22c66 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -1,5 +1,5 @@ -Articles • FeatureExtractionArticles • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -100,7 +100,7 @@

All vignettes

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/authors.html b/docs/authors.html index 1f082e4..5e21d17 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,5 +1,5 @@ -Authors and Citation • FeatureExtractionAuthors and Citation • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -113,15 +113,15 @@

Citation

-

Schuemie M, Suchard M, Ryan P, Reps J, Sena A, Inberg G (2025). +

Schuemie M, Suchard M, Ryan P, Reps J, Sena A, Inberg G (2026). FeatureExtraction: Generating Features for a Cohort. -R package version 3.12.0, https://github.com/OHDSI/FeatureExtraction. +R package version 3.13.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.12.0},
+  year = {2026},
+  note = {R package version 3.13.0},
   url = {https://github.com/OHDSI/FeatureExtraction},
 }
@@ -136,7 +136,7 @@

Citation

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/index.html b/docs/index.html index 3165562..a6bdac3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,5 +1,5 @@ - + @@ -33,7 +33,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -232,12 +232,12 @@

Citation

Developers

@@ -255,7 +255,7 @@

Developers

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/news/index.html b/docs/news/index.html index 0cf8594..355534f 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -1,5 +1,5 @@ -Changelog • FeatureExtractionChangelog • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -76,7 +76,14 @@

Changelog

- + +

New Features:

+

Bugfixes:

+
+
+
@@ -284,7 +291,7 @@
-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 2caf6c6..86d0a91 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,5 +1,5 @@ -pandoc: '3.4' -pkgdown: 2.1.0 +pandoc: 3.6.3 +pkgdown: 2.2.0 pkgdown_sha: ~ articles: CreatingCovariatesBasedOnOtherCohorts: CreatingCovariatesBasedOnOtherCohorts.html @@ -8,4 +8,4 @@ articles: CreatingCustomCovariateBuildersKorean: CreatingCustomCovariateBuildersKorean.html UsingFeatureExtraction: UsingFeatureExtraction.html UsingFeatureExtractionKorean: UsingFeatureExtractionKorean.html -last_built: 2025-10-28T06:29Z +last_built: 2026-03-05T19:00Z diff --git a/docs/reference/CovariateData-class.html b/docs/reference/CovariateData-class.html index 4993a01..c1e4b04 100644 --- a/docs/reference/CovariateData-class.html +++ b/docs/reference/CovariateData-class.html @@ -1,5 +1,5 @@ -Covariate Data — CovariateData-class • FeatureExtractionCovariate Data — CovariateData-class • FeatureExtraction FeatureExtraction - 3.12.0 + 3.13.0 @@ -129,7 +129,7 @@

See also

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/FeatureExtraction-package.html b/docs/reference/FeatureExtraction-package.html index 2394e46..1b67bc4 100644 --- a/docs/reference/FeatureExtraction-package.html +++ b/docs/reference/FeatureExtraction-package.html @@ -1,5 +1,5 @@ -FeatureExtraction: Generating Features for a Cohort — FeatureExtraction-package • FeatureExtractionFeatureExtraction: Generating Features for a Cohort — FeatureExtraction-package • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -110,7 +110,7 @@

Author

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/aggregateCovariates.html b/docs/reference/aggregateCovariates.html index 6ddaae9..b310f14 100644 --- a/docs/reference/aggregateCovariates.html +++ b/docs/reference/aggregateCovariates.html @@ -1,5 +1,5 @@ -Aggregate covariate data — aggregateCovariates • FeatureExtractionAggregate covariate data — aggregateCovariates • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -107,7 +107,7 @@

Examples

temporal = FALSE ) aggregatedCovariateData <- aggregateCovariates(covariateData) -#> Aggregating covariates took 0.441 secs +#> Aggregating covariates took 2.79 secs # } @@ -124,7 +124,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/computeStandardizedDifference.html b/docs/reference/computeStandardizedDifference.html index dd0739a..1e83d3d 100644 --- a/docs/reference/computeStandardizedDifference.html +++ b/docs/reference/computeStandardizedDifference.html @@ -1,5 +1,5 @@ -Compute standardized difference of mean for all covariates. — computeStandardizedDifference • FeatureExtractionCompute standardized difference of mean for all covariates. — computeStandardizedDifference • FeatureExtractionConvert prespecified covariate settings into detailed covariate settings — convertPrespecSettingsToDetailedSettings • FeatureExtractionConvert prespecified covariate settings into detailed covariate settings — convertPrespecSettingsToDetailedSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -123,7 +123,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createAnalysisDetails.html b/docs/reference/createAnalysisDetails.html index 23b158b..5389a79 100644 --- a/docs/reference/createAnalysisDetails.html +++ b/docs/reference/createAnalysisDetails.html @@ -1,5 +1,5 @@ -Create detailed covariate settings — createAnalysisDetails • FeatureExtractionCreate detailed covariate settings — createAnalysisDetails • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -178,7 +178,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createCohortAttrCovariateSettings.html b/docs/reference/createCohortAttrCovariateSettings.html index a3e7012..fb8c63a 100644 --- a/docs/reference/createCohortAttrCovariateSettings.html +++ b/docs/reference/createCohortAttrCovariateSettings.html @@ -1,5 +1,5 @@ -Create cohort attribute covariate settings — createCohortAttrCovariateSettings • FeatureExtractionCreate cohort attribute covariate settings — createCohortAttrCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -187,7 +187,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createCohortBasedCovariateSettings.html b/docs/reference/createCohortBasedCovariateSettings.html index 1a661af..3195f6b 100644 --- a/docs/reference/createCohortBasedCovariateSettings.html +++ b/docs/reference/createCohortBasedCovariateSettings.html @@ -1,5 +1,5 @@ -Create settings for covariates based on other cohorts — createCohortBasedCovariateSettings • FeatureExtractionCreate settings for covariates based on other cohorts — createCohortBasedCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -163,7 +163,7 @@

Details

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createCohortBasedTemporalCovariateSettings.html b/docs/reference/createCohortBasedTemporalCovariateSettings.html index ceb72b1..2b64586 100644 --- a/docs/reference/createCohortBasedTemporalCovariateSettings.html +++ b/docs/reference/createCohortBasedTemporalCovariateSettings.html @@ -1,5 +1,5 @@ -Create settings for temporal covariates based on other cohorts — createCohortBasedTemporalCovariateSettings • FeatureExtractionCreate settings for temporal covariates based on other cohorts — createCohortBasedTemporalCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -171,7 +171,7 @@

Details

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createCovariateSettings.html b/docs/reference/createCovariateSettings.html index a41f408..3001849 100644 --- a/docs/reference/createCovariateSettings.html +++ b/docs/reference/createCovariateSettings.html @@ -1,5 +1,5 @@ -Create covariate settings — createCovariateSettings • FeatureExtractionCreate covariate settings — createCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -1109,7 +1109,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createDefaultCovariateSettings.html b/docs/reference/createDefaultCovariateSettings.html index 84be26e..7c0e7c4 100644 --- a/docs/reference/createDefaultCovariateSettings.html +++ b/docs/reference/createDefaultCovariateSettings.html @@ -1,5 +1,5 @@ -Create default covariate settings — createDefaultCovariateSettings • FeatureExtractionCreate default covariate settings — createDefaultCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -149,7 +149,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createDefaultTemporalCovariateSettings.html b/docs/reference/createDefaultTemporalCovariateSettings.html index ad650b6..24de983 100644 --- a/docs/reference/createDefaultTemporalCovariateSettings.html +++ b/docs/reference/createDefaultTemporalCovariateSettings.html @@ -1,5 +1,5 @@ -Create default covariate settings — createDefaultTemporalCovariateSettings • FeatureExtractionCreate default covariate settings — createDefaultTemporalCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -149,7 +149,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createDetailedCovariateSettings.html b/docs/reference/createDetailedCovariateSettings.html index 2cfe61c..8348d9d 100644 --- a/docs/reference/createDetailedCovariateSettings.html +++ b/docs/reference/createDetailedCovariateSettings.html @@ -1,5 +1,5 @@ -Create detailed covariate settings — createDetailedCovariateSettings • FeatureExtractionCreate detailed covariate settings — createDetailedCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -137,7 +137,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createDetailedTemporalCovariateSettings.html b/docs/reference/createDetailedTemporalCovariateSettings.html index ab49f27..7b92782 100644 --- a/docs/reference/createDetailedTemporalCovariateSettings.html +++ b/docs/reference/createDetailedTemporalCovariateSettings.html @@ -1,5 +1,5 @@ -Create detailed temporal covariate settings — createDetailedTemporalCovariateSettings • FeatureExtractionCreate detailed temporal covariate settings — createDetailedTemporalCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -157,7 +157,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createEmptyCovariateData.html b/docs/reference/createEmptyCovariateData.html index 0fc5be0..a028f71 100644 --- a/docs/reference/createEmptyCovariateData.html +++ b/docs/reference/createEmptyCovariateData.html @@ -1,5 +1,5 @@ -Creates an empty covariate data object — createEmptyCovariateData • FeatureExtractionCreates an empty covariate data object — createEmptyCovariateData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -128,7 +128,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createTable1.html b/docs/reference/createTable1.html index 29e30e0..5fc475a 100644 --- a/docs/reference/createTable1.html +++ b/docs/reference/createTable1.html @@ -1,5 +1,5 @@ -Create a table 1 — createTable1 • FeatureExtractionCreate a table 1 — createTable1 • FeatureExtractionCreate covariate settings for a table 1 — createTable1CovariateSettings • FeatureExtractionCreate covariate settings for a table 1 — createTable1CovariateSettings • FeatureExtractionCreate covariate settings — createTemporalCovariateSettings • FeatureExtractionCreate covariate settings — createTemporalCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -486,7 +486,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/createTemporalSequenceCovariateSettings.html b/docs/reference/createTemporalSequenceCovariateSettings.html index 24b275f..9ac900c 100644 --- a/docs/reference/createTemporalSequenceCovariateSettings.html +++ b/docs/reference/createTemporalSequenceCovariateSettings.html @@ -1,5 +1,5 @@ -Create covariate settings — createTemporalSequenceCovariateSettings • FeatureExtractionCreate covariate settings — createTemporalSequenceCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -315,7 +315,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/dot-createLooCovariateSettings.html b/docs/reference/dot-createLooCovariateSettings.html index d12b599..c766307 100644 --- a/docs/reference/dot-createLooCovariateSettings.html +++ b/docs/reference/dot-createLooCovariateSettings.html @@ -1,5 +1,5 @@ -Get covariate settings — .createLooCovariateSettings • FeatureExtractionGet covariate settings — .createLooCovariateSettings • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -109,7 +109,7 @@

Value

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/dot-getDbLooCovariateData.html b/docs/reference/dot-getDbLooCovariateData.html index d1eef43..458d0bf 100644 --- a/docs/reference/dot-getDbLooCovariateData.html +++ b/docs/reference/dot-getDbLooCovariateData.html @@ -1,5 +1,5 @@ -Get covariate information from the database — .getDbLooCovariateData • FeatureExtractionGet covariate information from the database — .getDbLooCovariateData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -91,7 +91,8 @@

Get covariate information from the database

rowIdField = "subject_id", covariateSettings, aggregated = FALSE, - minCharacterizationMean = 0 + minCharacterizationMean = 0, + ... ) @@ -155,6 +156,10 @@

Arguments

will help reduce the file size of the characterization output, but will remove information on covariates that have very low values. The default is 0.

+ +
...
+

Additional arguments, not used.

+

Value

@@ -173,7 +178,7 @@

Value

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/filterByCohortDefinitionId.html b/docs/reference/filterByCohortDefinitionId.html index 471589b..b0d52d2 100644 --- a/docs/reference/filterByCohortDefinitionId.html +++ b/docs/reference/filterByCohortDefinitionId.html @@ -1,5 +1,5 @@ -Filter covariates by cohort definition IDs — filterByCohortDefinitionId • FeatureExtractionFilter covariates by cohort definition IDs — filterByCohortDefinitionId • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -134,7 +134,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/filterByRowId.html b/docs/reference/filterByRowId.html index 5535bdd..930738f 100644 --- a/docs/reference/filterByRowId.html +++ b/docs/reference/filterByRowId.html @@ -1,5 +1,5 @@ -Filter covariates by row ID — filterByRowId • FeatureExtractionFilter covariates by row ID — filterByRowId • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -130,7 +130,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/getDbCohortAttrCovariatesData.html b/docs/reference/getDbCohortAttrCovariatesData.html index db2c462..e23f9a9 100644 --- a/docs/reference/getDbCohortAttrCovariatesData.html +++ b/docs/reference/getDbCohortAttrCovariatesData.html @@ -1,5 +1,5 @@ -Getcovariate information from the database through the cohort_attribute table — getDbCohortAttrCovariatesData • FeatureExtractionGetcovariate information from the database through the cohort_attribute table — getDbCohortAttrCovariatesData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -191,8 +191,8 @@

Details

Examples

# \donttest{
-connectionDetails <- Eunomia::getEunomiaConnectionDetails()
-Eunomia::createCohorts(
+connectionDetails <- Eunomia::getEunomiaConnectionDetails()
+Eunomia::createCohorts(
   connectionDetails = connectionDetails,
   cdmDatabaseSchema = "main",
   cohortDatabaseSchema = "main",
@@ -237,8 +237,8 @@ 

Examples

aggregated = FALSE ) #> Constructing covariates from cohort attributes table -#> Inserting data took 0.00588 secs -#> Loading took 0.0269 secs +#> Inserting data took 0.0172 secs +#> Loading took 0.0838 secs # }
@@ -255,7 +255,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/getDbCohortBasedCovariatesData.html b/docs/reference/getDbCohortBasedCovariatesData.html index 2f33870..16cd0ed 100644 --- a/docs/reference/getDbCohortBasedCovariatesData.html +++ b/docs/reference/getDbCohortBasedCovariatesData.html @@ -1,5 +1,5 @@ -Get covariate information from the database based on other cohorts — getDbCohortBasedCovariatesData • FeatureExtractionGet covariate information from the database based on other cohorts — getDbCohortBasedCovariatesData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -91,6 +91,12 @@

Get covariate information from the database based on other cohorts

cdmVersion = "5", rowIdField = "subject_id", covariateSettings, + targetDatabaseSchema = NULL, + targetCovariateTable = NULL, + targetCovariateContinuousTable = NULL, + targetCovariateRefTable = NULL, + targetAnalysisRefTable = NULL, + targetTimeRefTable = NULL, aggregated = FALSE, minCharacterizationMean = 0, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema") @@ -153,6 +159,34 @@

Arguments

createCohortBasedTemporalCovariateSettings functions.

+
targetDatabaseSchema
+

(Optional) The name of the database schema where the resulting covariates +should be stored. If not provided, results will be fetched to R.

+ + +
targetCovariateTable
+

(Optional) The name of the table where the resulting covariates will +be stored. If not provided, results will be fetched to R. The table can be +a permanent table in the targetDatabaseSchema or a temp table. If +it is a temp table, do not specify targetDatabaseSchema.

+ + +
targetCovariateContinuousTable
+

(Optional) The name of the table where the resulting continuous covariates should be stored.

+ + +
targetCovariateRefTable
+

(Optional) The name of the table where the covariate reference will be stored.

+ + +
targetAnalysisRefTable
+

(Optional) The name of the table where the analysis reference will be stored.

+ + +
targetTimeRefTable
+

(Optional) The name of the table for the time reference

+ +
aggregated

Should aggregate statistics be computed instead of covariates per cohort entry?

@@ -208,7 +242,7 @@

Details

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/getDbCovariateData.html b/docs/reference/getDbCovariateData.html index ac14aa1..3063818 100644 --- a/docs/reference/getDbCovariateData.html +++ b/docs/reference/getDbCovariateData.html @@ -1,5 +1,5 @@ -Get covariate information from the database — getDbCovariateData • FeatureExtractionGet covariate information from the database — getDbCovariateData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -94,6 +94,15 @@

Get covariate information from the database

cohortIds = c(-1), rowIdField = "subject_id", covariateSettings, + exportToTable = FALSE, + createTable = exportToTable, + dropTableIfExists = exportToTable, + targetDatabaseSchema = NULL, + targetCovariateTable = NULL, + targetCovariateContinuousTable = NULL, + targetCovariateRefTable = NULL, + targetAnalysisRefTable = NULL, + targetTimeRefTable = NULL, aggregated = FALSE, minCharacterizationMean = 0, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), @@ -174,6 +183,53 @@

Arguments

of the createCovariate functions, or a list of such objects.

+
exportToTable
+

Whether to export to a table rather than Andromeda object

+ + +
createTable
+

Run sql to create table? Code does not check if table exists.

+ + +
dropTableIfExists
+

If targetDatabaseSchema, drop any existing tables. Otherwise, results are merged +into existing table data. Overides createTable.

+ + +
targetDatabaseSchema
+

(Optional) The name of the database schema where the resulting covariates +should be stored as a table. If not provided, results will be fetched to R.

+ + +
targetCovariateTable
+

(Optional) The name of the table where the resulting covariates will +be stored. If not provided, results will be fetched to R. The table can be +a permanent table in the targetDatabaseSchema or a temp table. If +it is a temp table, do not specify targetDatabaseSchema.

+ + +
targetCovariateContinuousTable
+

(Optional) The name of the table where the resulting continuous covariates will +be stored. If not provided, results will be fetched to R. The table can be +a permanent table in the targetDatabaseSchema or a temp table. If +it is a temp table, do not specify targetDatabaseSchema.

+ + +
targetCovariateRefTable
+

(Optional) The name of the table where the covariate reference will be stored. If +it is a temp table, do not specify targetDatabaseSchema.

+ + +
targetAnalysisRefTable
+

(Optional) The name of the table where the analysis reference will be stored. If +it is a temp table, do not specify targetDatabaseSchema.

+ + +
targetTimeRefTable
+

(Optional) The name of the table for the time reference. If +it is a temp table, do not specify targetDatabaseSchema.

+ +
aggregated

Should aggregate statistics be computed instead of covariates per cohort entry? If aggregated is set to FALSE, the results returned will be based @@ -218,9 +274,9 @@

Details

Examples

# \donttest{
-eunomiaConnectionDetails <- Eunomia::getEunomiaConnectionDetails()
+eunomiaConnectionDetails <- Eunomia::getEunomiaConnectionDetails()
 covSettings <- createDefaultCovariateSettings()
-Eunomia::createCohorts(
+Eunomia::createCohorts(
   connectionDetails = eunomiaConnectionDetails,
   cdmDatabaseSchema = "main",
   cohortDatabaseSchema = "main",
@@ -258,9 +314,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.41 secs +#> Executing SQL took 2.06 secs #> Fetching data from server -#> Fetching data took 0.158 secs +#> Fetching data took 0.671 secs # }
@@ -277,7 +333,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/getDbDefaultCovariateData.html b/docs/reference/getDbDefaultCovariateData.html index 0f3f1f1..1cb21fe 100644 --- a/docs/reference/getDbDefaultCovariateData.html +++ b/docs/reference/getDbDefaultCovariateData.html @@ -1,5 +1,5 @@ -Get default covariate information from the database — getDbDefaultCovariateData • FeatureExtractionGet default covariate information from the database — getDbDefaultCovariateData • FeatureExtractionGet the default table 1 specifications — getDefaultTable1Specifications • FeatureExtractionGet the default table 1 specifications — getDefaultTable1Specifications • FeatureExtractionPackage index • FeatureExtractionPackage index • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -79,10 +79,6 @@

All functions

-

show(<CovariateData>) summary(<CovariateData>)

- -

Covariate Data

-

aggregateCovariates()

Aggregate covariate data

@@ -94,6 +90,10 @@

All functions convertPrespecSettingsToDetailedSettings()

Convert prespecified covariate settings into detailed covariate settings

+ +

show(<CovariateData>) summary(<CovariateData>)

+ +

Covariate Data

createAnalysisDetails()

@@ -227,7 +227,7 @@

All functions
-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/isAggregatedCovariateData.html b/docs/reference/isAggregatedCovariateData.html index 9a91c38..0653b3e 100644 --- a/docs/reference/isAggregatedCovariateData.html +++ b/docs/reference/isAggregatedCovariateData.html @@ -1,5 +1,5 @@ -Check whether covariate data is aggregated — isAggregatedCovariateData • FeatureExtractionCheck whether covariate data is aggregated — isAggregatedCovariateData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -122,7 +122,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/isCovariateData.html b/docs/reference/isCovariateData.html index ba0b904..ea8ae33 100644 --- a/docs/reference/isCovariateData.html +++ b/docs/reference/isCovariateData.html @@ -1,5 +1,5 @@ -Check whether an object is a CovariateData object — isCovariateData • FeatureExtractionCheck whether an object is a CovariateData object — isCovariateData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -121,7 +121,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/isTemporalCovariateData.html b/docs/reference/isTemporalCovariateData.html index 8c483c6..1b2f9a6 100644 --- a/docs/reference/isTemporalCovariateData.html +++ b/docs/reference/isTemporalCovariateData.html @@ -1,5 +1,5 @@ -Check whether covariate data is temporal — isTemporalCovariateData • FeatureExtractionCheck whether covariate data is temporal — isTemporalCovariateData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -122,7 +122,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/loadCovariateData.html b/docs/reference/loadCovariateData.html index 66943f4..b8c658a 100644 --- a/docs/reference/loadCovariateData.html +++ b/docs/reference/loadCovariateData.html @@ -1,5 +1,5 @@ -Load the covariate data from a folder — loadCovariateData • FeatureExtractionLoad the covariate data from a folder — loadCovariateData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -128,7 +128,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/replaceCovariateSettingsCohortSchemaTable.html b/docs/reference/replaceCovariateSettingsCohortSchemaTable.html index 4d5867a..3fca53e 100644 --- a/docs/reference/replaceCovariateSettingsCohortSchemaTable.html +++ b/docs/reference/replaceCovariateSettingsCohortSchemaTable.html @@ -1,5 +1,5 @@ -Utility function to set the cohort table & schema on createCohortBasedCovariateSettings with information from the execution settings — replaceCovariateSettingsCohortSchemaTable • FeatureExtractionUtility function to set the cohort table & schema on createCohortBasedCovariateSettings with information from the execution settings — replaceCovariateSettingsCohortSchemaTable • FeatureExtractionSave the covariate data to folder — saveCovariateData • FeatureExtractionSave the covariate data to folder — saveCovariateData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -137,7 +137,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/reference/tidyCovariateData.html b/docs/reference/tidyCovariateData.html index 0eeb6e8..f5e2b6b 100644 --- a/docs/reference/tidyCovariateData.html +++ b/docs/reference/tidyCovariateData.html @@ -1,5 +1,5 @@ -Tidy covariate data — tidyCovariateData • FeatureExtractionTidy covariate data — tidyCovariateData • FeatureExtraction @@ -17,7 +17,7 @@ FeatureExtraction - 3.12.0 + 3.13.0 @@ -137,7 +137,7 @@

Examples

normalize = TRUE, removeRedundancy = TRUE ) -#> Tidying covariates took 0.22 secs +#> Tidying covariates took 1.71 secs # } @@ -154,7 +154,7 @@

Examples

-

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.2.0.

diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 2986c72..ed7afbb 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -4,20 +4,19 @@ /articles/CreatingCovariatesUsingCohortAttributes.html /articles/CreatingCustomCovariateBuilders.html /articles/CreatingCustomCovariateBuildersKorean.html +/articles/index.html /articles/UsingFeatureExtraction.html /articles/UsingFeatureExtractionKorean.html -/articles/index.html /authors.html /index.html /news/index.html /pull_request_template.html -/reference/CovariateData-class.html -/reference/FeatureExtraction-package.html /reference/aggregateCovariates.html /reference/byMaxFf.html /reference/bySumFf.html /reference/computeStandardizedDifference.html /reference/convertPrespecSettingsToDetailedSettings.html +/reference/CovariateData-class.html /reference/createAnalysisDetails.html /reference/createCohortAttrCovariateSettings.html /reference/createCohortBasedCovariateSettings.html @@ -35,6 +34,7 @@ /reference/createTemporalSequenceCovariateSettings.html /reference/dot-createLooCovariateSettings.html /reference/dot-getDbLooCovariateData.html +/reference/FeatureExtraction-package.html /reference/filterByCohortDefinitionId.html /reference/filterByRowId.html /reference/filterCovariateDataCovariates.html diff --git a/extras/CohortBasedCovariatesVignetteDataFetch.R b/extras/CohortBasedCovariatesVignetteDataFetch.R index f9fd175..ce62771 100644 --- a/extras/CohortBasedCovariatesVignetteDataFetch.R +++ b/extras/CohortBasedCovariatesVignetteDataFetch.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/extras/DefaultCovariateSettingsTemplate.R b/extras/DefaultCovariateSettingsTemplate.R index b7210f8..40ed0de 100644 --- a/extras/DefaultCovariateSettingsTemplate.R +++ b/extras/DefaultCovariateSettingsTemplate.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/extras/DetailedCovariateSettingsTemplate.R b/extras/DetailedCovariateSettingsTemplate.R index 61a6e61..88677a9 100644 --- a/extras/DetailedCovariateSettingsTemplate.R +++ b/extras/DetailedCovariateSettingsTemplate.R @@ -1,4 +1,4 @@ -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/extras/FeatureExtraction.pdf b/extras/FeatureExtraction.pdf index c2e45b0..ea6e9eb 100644 Binary files a/extras/FeatureExtraction.pdf and b/extras/FeatureExtraction.pdf differ diff --git a/extras/GetHdpsCovariates.R b/extras/GetHdpsCovariates.R index 150cf1d..098f099 100644 --- a/extras/GetHdpsCovariates.R +++ b/extras/GetHdpsCovariates.R @@ -1,6 +1,6 @@ # @file GetHdpsCovariates.R # -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/extras/PackageMaintenance.R b/extras/PackageMaintenance.R index a17d432..c44b82f 100644 --- a/extras/PackageMaintenance.R +++ b/extras/PackageMaintenance.R @@ -1,6 +1,6 @@ # @file PackageMaintenance # -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/extras/VignetteDataFetch.R b/extras/VignetteDataFetch.R index 13e63d0..a6d029e 100644 --- a/extras/VignetteDataFetch.R +++ b/extras/VignetteDataFetch.R @@ -1,6 +1,6 @@ # @file VignetteDataFetch.R # -# Copyright 2025 Observational Health Data Sciences and Informatics +# Copyright 2026 Observational Health Data Sciences and Informatics # # This file is part of FeatureExtraction # diff --git a/inst/doc/CreatingCovariatesBasedOnOtherCohorts.pdf b/inst/doc/CreatingCovariatesBasedOnOtherCohorts.pdf index 70ad1ce..f19c604 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 b123d17..7c65014 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 113e9bc..209ccfd 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 d70b37e..0cd129b 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 02bddec..2aa9268 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 1cc8fef..147fc6f 100644 Binary files a/inst/doc/UsingFeatureExtractionKorean.pdf and b/inst/doc/UsingFeatureExtractionKorean.pdf differ diff --git a/inst/sql/sql_server/CreateExportTables.sql b/inst/sql/sql_server/CreateExportTables.sql new file mode 100644 index 0000000..4dc2fd2 --- /dev/null +++ b/inst/sql/sql_server/CreateExportTables.sql @@ -0,0 +1,62 @@ +CREATE TABLE @covariate_table ( + covariate_id BIGINT, + {@temporal}?{time_id BIGINT,} + {@aggregated}?{ + cohort_definition_id BIGINT, + sum_value BIGINT, + average_value FLOAT + }:{ + @row_id_field BIGINT, + covariate_value INT + } + ); + +CREATE TABLE @covariate_continuous_table ( + covariate_id BIGINT, + {@temporal}?{time_id BIGINT,} + + {@aggregated}?{ + cohort_definition_id BIGINT, + count_value BIGINT, + min_value FLOAT, + max_value FLOAT, + average_value FLOAT, + standard_deviation FLOAT, + median_value FLOAT, + p10_value FLOAT, + p25_value FLOAT, + p75_value FLOAT, + p90_value FLOAT + }:{ + @row_id_field BIGINT, + covariate_value FLOAT + } + + ); + +CREATE TABLE @covariate_ref_table ( + covariate_id BIGINT, + covariate_name VARCHAR(512), + analysis_id INT, + concept_id INT, + value_as_concept_id INT, + collisions INT + ); + +CREATE TABLE @analysis_ref_table ( + analysis_id BIGINT, + analysis_name VARCHAR(512), + domain_id VARCHAR(20), + start_day INT, + end_day INT, + is_binary VARCHAR(1), + missing_means_zero VARCHAR(1) + ); + + +CREATE TABLE @time_ref_table ( + time_part VARCHAR(20), + time_interval BIGINT, + sequence_start_day BIGINT, + sequence_end_day BIGINT + ); diff --git a/inst/sql/sql_server/DemographicsTime.sql b/inst/sql/sql_server/DemographicsTime.sql index c509b32..38d6784 100644 --- a/inst/sql/sql_server/DemographicsTime.sql +++ b/inst/sql/sql_server/DemographicsTime.sql @@ -36,20 +36,20 @@ FROM ( cohort.@row_id_field AS row_id, } {@sub_type == 'priorObservation'} ? { - DATEDIFF(DAY, observation_period_start_date, cohort_start_date) AS days + DATEDIFF(DAY, op.observation_period_start_date, cohort_start_date) AS days } {@sub_type == 'postObservation'} ? { - DATEDIFF(DAY, cohort_start_date, observation_period_end_date) AS days + DATEDIFF(DAY, cohort_start_date, op.observation_period_end_date) AS days } {@sub_type == 'inCohort'} ? { DATEDIFF(DAY, cohort_start_date, cohort_end_date) AS days } FROM @cohort_table cohort {@sub_type != 'inCohort'} ? { - INNER JOIN @cdm_database_schema.observation_period - ON cohort.subject_id = observation_period.person_id - AND observation_period_start_date <= cohort_start_date - AND observation_period_end_date >= cohort_start_date + INNER JOIN @cdm_database_schema.observation_period op + ON op.person_id = cohort.subject_id + AND op.observation_period_start_date <= cohort_start_date + AND op.observation_period_end_date >= cohort_start_date } {@cohort_definition_id != -1} ? { WHERE cohort.cohort_definition_id IN (@cohort_definition_id)} ) raw_data; diff --git a/inst/sql/sql_server/DropExportTables.sql b/inst/sql/sql_server/DropExportTables.sql new file mode 100644 index 0000000..9b91034 --- /dev/null +++ b/inst/sql/sql_server/DropExportTables.sql @@ -0,0 +1,16 @@ +{@temp_tables}?{ +IF OBJECT_ID('tempdb..@covariate_table', 'U') IS NOT NULL DROP TABLE @covariate_table; +IF OBJECT_ID('tempdb..@covariate_continuous_table', 'U') IS NOT NULL DROP TABLE @covariate_continuous_table; +IF OBJECT_ID('tempdb..@covariate_ref_table', 'U') IS NOT NULL DROP TABLE @covariate_ref_table; +IF OBJECT_ID('tempdb..@analysis_ref_table', 'U') IS NOT NULL DROP TABLE @analysis_ref_table; +IF OBJECT_ID('tempdb..@time_ref_table', 'U') IS NOT NULL DROP TABLE @time_ref_table; +}:{ +DROP TABLE IF EXISTS @covariate_table; +DROP TABLE IF EXISTS @covariate_continuous_table; +DROP TABLE IF EXISTS @covariate_ref_table; +DROP TABLE IF EXISTS @analysis_ref_table; +DROP TABLE IF EXISTS @time_ref_table; +} + + + diff --git a/inst/sql/sql_server/GetAttrCovariates.sql b/inst/sql/sql_server/GetAttrCovariates.sql index 7a71b66..908d539 100644 --- a/inst/sql/sql_server/GetAttrCovariates.sql +++ b/inst/sql/sql_server/GetAttrCovariates.sql @@ -1,7 +1,7 @@ /************************************************************************ @file GetAttrCovariates.sql -Copyright 2025 Observational Health Data Sciences and Informatics +Copyright 2026 Observational Health Data Sciences and Informatics This file is part of FeatureExtraction diff --git a/inst/sql/sql_server/GetHdpsCovariates.sql b/inst/sql/sql_server/GetHdpsCovariates.sql index 52450bf..57a44f3 100644 --- a/inst/sql/sql_server/GetHdpsCovariates.sql +++ b/inst/sql/sql_server/GetHdpsCovariates.sql @@ -1,5 +1,5 @@ /************************************************************************ -Copyright 2025 Observational Health Data Sciences and Informatics +Copyright 2026 Observational Health Data Sciences and Informatics This file is part of FeatureExtraction diff --git a/inst/sql/sql_server/IncludeDescendants.sql b/inst/sql/sql_server/IncludeDescendants.sql index e97e6d5..5ca458a 100644 --- a/inst/sql/sql_server/IncludeDescendants.sql +++ b/inst/sql/sql_server/IncludeDescendants.sql @@ -1,5 +1,5 @@ /************************************************************************ -Copyright 2025 Observational Health Data Sciences and Informatics +Copyright 2026 Observational Health Data Sciences and Informatics This file is part of FeatureExtraction diff --git a/inst/sql/sql_server/RemoveCovariateTempTables.sql b/inst/sql/sql_server/RemoveCovariateTempTables.sql index aaf3fb1..daad97b 100644 --- a/inst/sql/sql_server/RemoveCovariateTempTables.sql +++ b/inst/sql/sql_server/RemoveCovariateTempTables.sql @@ -1,5 +1,5 @@ /************************************************************************ -Copyright 2025 Observational Health Data Sciences and Informatics +Copyright 2026 Observational Health Data Sciences and Informatics This file is part of FeatureExtraction diff --git a/java/org/ohdsi/featureExtraction/FeatureExtraction.java b/java/org/ohdsi/featureExtraction/FeatureExtraction.java index 7e0de8c..d403e82 100644 --- a/java/org/ohdsi/featureExtraction/FeatureExtraction.java +++ b/java/org/ohdsi/featureExtraction/FeatureExtraction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2025 Observational Health Data Sciences and Informatics + * Copyright 2026 Observational Health Data Sciences and Informatics * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/java/org/ohdsi/featureExtraction/ReadCSVFile.java b/java/org/ohdsi/featureExtraction/ReadCSVFile.java index 6e423b4..29652fb 100644 --- a/java/org/ohdsi/featureExtraction/ReadCSVFile.java +++ b/java/org/ohdsi/featureExtraction/ReadCSVFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2025 Observational Health Data Sciences and Informatics + * Copyright 2026 Observational Health Data Sciences and Informatics * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/java/org/ohdsi/featureExtraction/ReadCSVFileWithHeader.java b/java/org/ohdsi/featureExtraction/ReadCSVFileWithHeader.java index 028d3d0..ae8ac5a 100644 --- a/java/org/ohdsi/featureExtraction/ReadCSVFileWithHeader.java +++ b/java/org/ohdsi/featureExtraction/ReadCSVFileWithHeader.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2025 Observational Health Data Sciences and Informatics + * Copyright 2026 Observational Health Data Sciences and Informatics * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/man/dot-getDbLooCovariateData.Rd b/man/dot-getDbLooCovariateData.Rd index ab94c1a..7524281 100644 --- a/man/dot-getDbLooCovariateData.Rd +++ b/man/dot-getDbLooCovariateData.Rd @@ -14,7 +14,8 @@ rowIdField = "subject_id", covariateSettings, aggregated = FALSE, - minCharacterizationMean = 0 + minCharacterizationMean = 0, + ... ) } \arguments{ @@ -54,6 +55,8 @@ cohort entry?} \item{minCharacterizationMean}{The minimum mean value for binary characterization output. Values below this will be cut off from output. This will help reduce the file size of the characterization output, but will remove information on covariates that have very low values. The default is 0.} + +\item{...}{Additional arguments, not used.} } \value{ Returns an object of type \code{covariateData}, containing information on the covariates. diff --git a/man/getDbCohortBasedCovariatesData.Rd b/man/getDbCohortBasedCovariatesData.Rd index 933bcd0..510934b 100644 --- a/man/getDbCohortBasedCovariatesData.Rd +++ b/man/getDbCohortBasedCovariatesData.Rd @@ -14,6 +14,12 @@ getDbCohortBasedCovariatesData( cdmVersion = "5", rowIdField = "subject_id", covariateSettings, + targetDatabaseSchema = NULL, + targetCovariateTable = NULL, + targetCovariateContinuousTable = NULL, + targetCovariateRefTable = NULL, + targetAnalysisRefTable = NULL, + targetTimeRefTable = NULL, aggregated = FALSE, minCharacterizationMean = 0, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema") @@ -54,6 +60,22 @@ is more than one period per person.} \code{\link{createCohortBasedCovariateSettings}} or \code{\link{createCohortBasedTemporalCovariateSettings}} functions.} +\item{targetDatabaseSchema}{(Optional) The name of the database schema where the resulting covariates +should be stored. If not provided, results will be fetched to R.} + +\item{targetCovariateTable}{(Optional) The name of the table where the resulting covariates will +be stored. If not provided, results will be fetched to R. The table can be +a permanent table in the \code{targetDatabaseSchema} or a temp table. If +it is a temp table, do not specify \code{targetDatabaseSchema}.} + +\item{targetCovariateContinuousTable}{(Optional) The name of the table where the resulting continuous covariates should be stored.} + +\item{targetCovariateRefTable}{(Optional) The name of the table where the covariate reference will be stored.} + +\item{targetAnalysisRefTable}{(Optional) The name of the table where the analysis reference will be stored.} + +\item{targetTimeRefTable}{(Optional) The name of the table for the time reference} + \item{aggregated}{Should aggregate statistics be computed instead of covariates per cohort entry?} diff --git a/man/getDbCovariateData.Rd b/man/getDbCovariateData.Rd index 92aa19b..b2b2fb5 100644 --- a/man/getDbCovariateData.Rd +++ b/man/getDbCovariateData.Rd @@ -17,6 +17,15 @@ getDbCovariateData( cohortIds = c(-1), rowIdField = "subject_id", covariateSettings, + exportToTable = FALSE, + createTable = exportToTable, + dropTableIfExists = exportToTable, + targetDatabaseSchema = NULL, + targetCovariateTable = NULL, + targetCovariateContinuousTable = NULL, + targetCovariateRefTable = NULL, + targetAnalysisRefTable = NULL, + targetTimeRefTable = NULL, aggregated = FALSE, minCharacterizationMean = 0, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), @@ -69,6 +78,35 @@ there is more than one period per person.} \item{covariateSettings}{Either an object of type \code{covariateSettings} as created using one of the createCovariate functions, or a list of such objects.} +\item{exportToTable}{Whether to export to a table rather than Andromeda object} + +\item{createTable}{Run sql to create table? Code does not check if table exists.} + +\item{dropTableIfExists}{If targetDatabaseSchema, drop any existing tables. Otherwise, results are merged +into existing table data. Overides createTable.} + +\item{targetDatabaseSchema}{(Optional) The name of the database schema where the resulting covariates +should be stored as a table. If not provided, results will be fetched to R.} + +\item{targetCovariateTable}{(Optional) The name of the table where the resulting covariates will +be stored. If not provided, results will be fetched to R. The table can be +a permanent table in the \code{targetDatabaseSchema} or a temp table. If +it is a temp table, do not specify \code{targetDatabaseSchema}.} + +\item{targetCovariateContinuousTable}{(Optional) The name of the table where the resulting continuous covariates will +be stored. If not provided, results will be fetched to R. The table can be +a permanent table in the \code{targetDatabaseSchema} or a temp table. If +it is a temp table, do not specify \code{targetDatabaseSchema}.} + +\item{targetCovariateRefTable}{(Optional) The name of the table where the covariate reference will be stored. If +it is a temp table, do not specify \code{targetDatabaseSchema}.} + +\item{targetAnalysisRefTable}{(Optional) The name of the table where the analysis reference will be stored. If +it is a temp table, do not specify \code{targetDatabaseSchema}.} + +\item{targetTimeRefTable}{(Optional) The name of the table for the time reference. If +it is a temp table, do not specify \code{targetDatabaseSchema}.} + \item{aggregated}{Should aggregate statistics be computed instead of covariates per cohort entry? If aggregated is set to FALSE, the results returned will be based on each subject_id and cohort_start_date in your cohort table. If your cohort diff --git a/man/getDbDefaultCovariateData.Rd b/man/getDbDefaultCovariateData.Rd index 5ac6df8..99dda8c 100644 --- a/man/getDbDefaultCovariateData.Rd +++ b/man/getDbDefaultCovariateData.Rd @@ -14,10 +14,12 @@ getDbDefaultCovariateData( cdmVersion = "5", rowIdField = "subject_id", covariateSettings, - targetDatabaseSchema, - targetCovariateTable, - targetCovariateRefTable, - targetAnalysisRefTable, + targetDatabaseSchema = NULL, + targetCovariateTable = NULL, + targetCovariateContinuousTable = NULL, + targetCovariateRefTable = NULL, + targetAnalysisRefTable = NULL, + targetTimeRefTable = NULL, aggregated = FALSE, minCharacterizationMean = 0, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema") @@ -58,17 +60,21 @@ is more than one period per person.} of the createCovariate functions, or a list of such objects.} \item{targetDatabaseSchema}{(Optional) The name of the database schema where the resulting covariates -should be stored.} +should be stored. If not provided, results will be fetched to R.} \item{targetCovariateTable}{(Optional) The name of the table where the resulting covariates will be stored. If not provided, results will be fetched to R. The table can be a permanent table in the \code{targetDatabaseSchema} or a temp table. If it is a temp table, do not specify \code{targetDatabaseSchema}.} +\item{targetCovariateContinuousTable}{(Optional) The name of the table where the resulting continuous covariates should be stored.} + \item{targetCovariateRefTable}{(Optional) The name of the table where the covariate reference will be stored.} \item{targetAnalysisRefTable}{(Optional) The name of the table where the analysis reference will be stored.} +\item{targetTimeRefTable}{(Optional) The name of the table for the time reference} + \item{aggregated}{Should aggregate statistics be computed instead of covariates per cohort entry?} @@ -118,9 +124,7 @@ results <- getDbDefaultCovariateData( connection = connection, cdmDatabaseSchema = "main", cohortTable = "cohort", - covariateSettings = createDefaultCovariateSettings(), - targetDatabaseSchema = "main", - targetCovariateTable = "ut_cov" + covariateSettings = createDefaultCovariateSettings() ) } } diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index dd59bcf..2007a29 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -2,6 +2,19 @@ library(testthat) library(FeatureExtraction) library(dplyr) +# AGS: This rJava code block was used to add the Java dependencies to the classpath for testing. It is needed to run the tests on all platforms, but it is not needed when running individual test files in RStudio, which is why it is not included in the helper functions file. If we want to run individual test files, we can use the loadRenderTranslateUnitTestSql function defined below, which also adds the Java dependencies to the classpath if they are not already there. +# library(rJava) +# .jinit() +# jar_dirs <- c( +# system.file("java", package = "DatabaseConnector"), +# system.file("java", package = "SqlRender"), +# system.file("java", package = "FeatureExtraction") +# ) +# jar_files <- unlist( +# lapply(jar_dirs, list.files, pattern = "\\.jar$", full.names = TRUE) +# ) +# .jaddClassPath(jar_files) + dbms <- getOption("dbms", default = "sqlite") message("************* Testing on ", dbms, " *************\n") @@ -98,7 +111,7 @@ checkRemoteFileAvailable <- function(remoteFile) { } # Then stop if status > 400 if (httr::http_error(resp)) { - message_for_status(resp) + httr::message_for_status(resp) return(NULL) } return("success") diff --git a/tests/testthat/test-GetDefaultCovariates.R b/tests/testthat/test-GetDefaultCovariates.R index 25bede6..c832a4c 100644 --- a/tests/testthat/test-GetDefaultCovariates.R +++ b/tests/testthat/test-GetDefaultCovariates.R @@ -41,22 +41,3 @@ test_that("Test exit conditions", { aggregated = TRUE )) }) - -# AGS - This test fails and is likely due to a bug when using SqlLite -# test_that("Test target table", { -# connection <- DatabaseConnector::connect(connectionDetails) -# Eunomia::createCohorts(connectionDetails) -# -# results <- getDbDefaultCovariateData(connection = connection, -# cdmDatabaseSchema = "main", -# cohortTable = "cohort", -# covariateSettings = createDefaultCovariateSettings(), -# targetDatabaseSchema = "main", -# targetCovariateTable = "ut_cov", -# targetCovariateRefTable = "ut_cov_ref", -# targetAnalysisRefTable = "ut_cov_analysis_ref") -# -# on.exit(DatabaseConnector::disconnect(connection)) -# }) -# -# unlink(connectionDetails$server()) diff --git a/tests/testthat/test-Table1.R b/tests/testthat/test-Table1.R index ad169f8..3300adc 100644 --- a/tests/testthat/test-Table1.R +++ b/tests/testthat/test-Table1.R @@ -80,7 +80,6 @@ test_that("createTable1 works with categorical covariates", { }) - test_that("createTable1 works with continuous covariates", { skip_on_cran() skip_if_not(dbms == "sqlite" && exists("eunomiaConnection"))