diff --git a/DESCRIPTION b/DESCRIPTION index 9ceb6d4..521f730 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: FeatureExtraction Type: Package Title: Generating Features for a Cohort Version: 3.13.0 -Date: 2026-02-28 +Date: 2026-03-05 Authors@R: c( person("Martijn", "Schuemie", , "schuemie@ohdsi.org", role = c("aut")), person("Marc", "Suchard", role = c("aut")), 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 f2bf40f..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 # @@ -71,7 +71,7 @@ #' privileges where temp tables can be created. #' @param covariateCohortDatabaseSchema The database schema where the cohorts used to define the covariates can be found. #' @param covariateCohortTable The table where the cohorts used to define the covariates can be found. -#' +#' #' @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. @@ -85,10 +85,10 @@ #' @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}. +#' 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 @@ -187,22 +187,23 @@ getDbCovariateData <- function(connectionDetails = NULL, } else { cohortDatabaseSchemaTable <- paste(cohortDatabaseSchema, cohortTable, sep = ".") } - + # check for temporal features in any of the settings - if(inherits(covariateSettings, 'covariateSettings')){ + if (inherits(covariateSettings, "covariateSettings")) { anyTemporal <- covariateSettings$temporal | covariateSettings$temporalSequence - } else{ + } else { anyTemporal <- sum(unlist(lapply( - X = covariateSettings, - FUN = function(x){ - sum(c(x$temporal,x$temporalSequence)) == 1 - }))) > 0 + 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)){ + if (is.null(targetDatabaseSchema)) { # turn off create table since the tables are temp tempOutputTables <- TRUE # covariate tables @@ -235,7 +236,6 @@ getDbCovariateData <- function(connectionDetails = NULL, } else { targetTimeRefTable <- paste0("#", targetTimeRefTable) } - } else { tempOutputTables <- FALSE targetCovariateTable <- paste(targetDatabaseSchema, targetCovariateTable, sep = ".") @@ -244,13 +244,13 @@ getDbCovariateData <- function(connectionDetails = NULL, targetAnalysisRefTable <- paste(targetDatabaseSchema, targetAnalysisRefTable, sep = ".") targetTimeRefTable <- paste(targetDatabaseSchema, targetTimeRefTable, sep = ".") } - + # drop table if required - if(dropTableIfExists){ - message('Dropping export tables') + if (dropTableIfExists) { + message("Dropping export tables") sql <- SqlRender::loadRenderTranslateSql( - sqlFilename = 'DropExportTables.sql', - packageName = 'FeatureExtraction', + sqlFilename = "DropExportTables.sql", + packageName = "FeatureExtraction", dbms = attr(connection, "dbms"), tempEmulationSchema = tempEmulationSchema, temp_tables = tempOutputTables, @@ -260,45 +260,42 @@ getDbCovariateData <- function(connectionDetails = NULL, analysis_ref_table = targetAnalysisRefTable, time_ref_table = targetTimeRefTable ) - + DatabaseConnector::executeSql( - connection = connection, + connection = connection, sql = sql ) } - - if(dropTableIfExists & !createTable){ - stop('Seem to be exporting to tables but create table is FALSE and dropTable is TRUE') + + 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') + if (createTable) { + message("Creating export tables") sql <- SqlRender::loadRenderTranslateSql( - sqlFilename = 'CreateExportTables.sql', - packageName = 'FeatureExtraction', + sqlFilename = "CreateExportTables.sql", + packageName = "FeatureExtraction", dbms = attr(connection, "dbms"), tempEmulationSchema = tempEmulationSchema, - aggregated = aggregated, temporal = anyTemporal, - row_id_field = 'row_id', - + 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, + 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, @@ -336,7 +333,7 @@ getDbCovariateData <- function(connectionDetails = NULL, covariateCohortTable ) } - + for (i in 1:length(covariateSettings)) { fun <- attr(covariateSettings[[i]], "fun") args <- list( @@ -374,33 +371,33 @@ getDbCovariateData <- function(connectionDetails = NULL, } else if (hasData(tempCovariateData$covariatesContinuous)) { covariateData$covariatesContinuous <- tempCovariateData$covariatesContinuous } - - if(hasData(tempCovariateData$covariateRef)){ + + if (hasData(tempCovariateData$covariateRef)) { Andromeda::appendToTable(covariateData$covariateRef, tempCovariateData$covariateRef) } - if(hasData(tempCovariateData$analysisRef)){ + 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 (!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 } } } - - if(!is.null(covariateData)){ + + if (!is.null(covariateData)) { attr(covariateData, "metaData")$populationSize <- populationSize attr(covariateData, "metaData")$cohortIds <- cohortIds } 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 f295d77..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 # @@ -28,10 +28,10 @@ #' 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 @@ -171,13 +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 6243635..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 # @@ -31,7 +31,7 @@ #' 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 @@ -98,8 +98,8 @@ getDbDefaultCovariateData <- function(connection, minCharacterizationMean <- utils::type.convert(minCharacterizationMean, as.is = TRUE) checkmate::assertNumeric(x = minCharacterizationMean, lower = 0, upper = 1, add = errorMessages) checkmate::reportAssertions(collection = errorMessages) - - + + targetTables <- list( covariates = targetCovariateTable, covariatesContinuous = targetCovariateContinuousTable, @@ -108,9 +108,9 @@ getDbDefaultCovariateData <- function(connection, timeRef = targetTimeRefTable ) # Is the target schema missing or are all the specified tables temp - allTempTables <- all(substr(targetTables,1,1) == "#") + allTempTables <- all(substr(targetTables, 1, 1) == "#") extractToAndromeda <- is.null(targetCovariateTable) - + settings <- .toJson(covariateSettings) rJava::J("org.ohdsi.featureExtraction.FeatureExtraction")$init(system.file("", package = "FeatureExtraction")) @@ -146,32 +146,32 @@ getDbDefaultCovariateData <- function(connection, 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) + if (extractToAndromeda) { + sql <- SqlRender::translate( + sql = todo$sqlQueryFeatures, + targetDialect = attr(connection, "dbms"), + tempEmulationSchema = tempEmulationSchema + ) DatabaseConnector::querySqlToAndromeda( connection = connection, sql = sql, andromeda = covariateData, andromedaTableName = "covariates", snakeCaseToCamelCase = TRUE - ) - } else{ - + ) + } else { # for testing to see column order - #print(todo$sqlQueryFeatures) - + # print(todo$sqlQueryFeatures) + sql <- " INSERT INTO @target_covariate_table( - + {@temporal | @temporal_sequence} ? {time_id,} - + {@aggregated}?{ cohort_definition_id, covariate_id, @@ -182,9 +182,9 @@ getDbDefaultCovariateData <- function(connection, row_id, covariate_value } - + ) @sub_query; " - + sql <- SqlRender::render( sql = sql, target_covariate_table = targetTables$covariates, @@ -193,7 +193,7 @@ getDbDefaultCovariateData <- function(connection, temporal_sequence = covariateSettings$temporalSequence, aggregated = aggregated ) - + sql <- SqlRender::translate( sql = sql, targetDialect = DatabaseConnector::dbms(connection), @@ -203,18 +203,17 @@ getDbDefaultCovariateData <- function(connection, connection = connection, sql = sql ) - } - } # Continuous aggregated features if (!is.null(todo$sqlQueryContinuousFeatures)) { - - if(extractToAndromeda){ - sql <- SqlRender::translate(sql = todo$sqlQueryContinuousFeatures, - targetDialect = attr(connection, "dbms"), - tempEmulationSchema = tempEmulationSchema) + if (extractToAndromeda) { + sql <- SqlRender::translate( + sql = todo$sqlQueryContinuousFeatures, + targetDialect = attr(connection, "dbms"), + tempEmulationSchema = tempEmulationSchema + ) DatabaseConnector::querySqlToAndromeda( connection = connection, sql = sql, @@ -222,11 +221,11 @@ getDbDefaultCovariateData <- function(connection, andromedaTableName = "covariatesContinuous", snakeCaseToCamelCase = TRUE ) - } else{ + } else { sql <- " INSERT INTO @target_covariate_continuous_table( {@aggregated}?{ - + cohort_definition_id, covariate_id, {@temporal | @temporal_sequence} ? {time_id,} @@ -236,22 +235,22 @@ getDbDefaultCovariateData <- function(connection, average_value, standard_deviation, median_value, - p10_value, - p25_value, - p75_value, + p10_value, + p25_value, + p75_value, p90_value - + }:{ - + covariate_id, {@temporal | @temporal_sequence} ? {time_id,} row_id, covariate_value - + } - + ) @sub_query;" - + sql <- SqlRender::render( sql = sql, target_covariate_continuous_table = targetTables$covariatesContinuous, @@ -260,7 +259,7 @@ getDbDefaultCovariateData <- function(connection, temporal_sequence = covariateSettings$temporalSequence, aggregated = aggregated ) - + sql <- SqlRender::translate( sql = sql, targetDialect = DatabaseConnector::dbms(connection), @@ -271,16 +270,16 @@ getDbDefaultCovariateData <- function(connection, sql = sql ) } - } # Covariate reference if (!is.null(todo$sqlQueryFeatureRef)) { - - if(extractToAndromeda){ - sql <- SqlRender::translate(sql = todo$sqlQueryFeatureRef, - targetDialect = attr(connection, "dbms"), - tempEmulationSchema = tempEmulationSchema) + if (extractToAndromeda) { + sql <- SqlRender::translate( + sql = todo$sqlQueryFeatureRef, + targetDialect = attr(connection, "dbms"), + tempEmulationSchema = tempEmulationSchema + ) DatabaseConnector::querySqlToAndromeda( connection = connection, sql = sql, @@ -290,32 +289,32 @@ getDbDefaultCovariateData <- function(connection, ) collisions <- covariateData$covariateRef %>% - dplyr::filter(collisions > 0) %>% - dplyr::collect() - + dplyr::filter(collisions > 0) %>% + dplyr::collect() + if (nrow(collisions) > 0) { warning(sprintf( "Collisions in covariate IDs detected for post-coordinated concepts with covariate IDs %s", paste(collisions$covariateId, paste = ", ") )) - } - } else{ + } + } else { sql <- " INSERT INTO @target_covariate_ref_table( covariate_id, covariate_name, analysis_id, concept_id, - value_as_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) ) - + sql <- SqlRender::translate( sql = sql, targetDialect = DatabaseConnector::dbms(connection), @@ -326,17 +325,17 @@ getDbDefaultCovariateData <- function(connection, sql = sql ) } - } - + # Analysis reference if (!is.null(todo$sqlQueryAnalysisRef)) { - - if(extractToAndromeda){ - sql <- SqlRender::translate(sql = todo$sqlQueryAnalysisRef, - targetDialect = attr(connection, "dbms"), - tempEmulationSchema = tempEmulationSchema) + if (extractToAndromeda) { + sql <- SqlRender::translate( + sql = todo$sqlQueryAnalysisRef, + targetDialect = attr(connection, "dbms"), + tempEmulationSchema = tempEmulationSchema + ) DatabaseConnector::querySqlToAndromeda( connection = connection, sql = sql, @@ -344,7 +343,7 @@ getDbDefaultCovariateData <- function(connection, andromedaTableName = "analysisRef", snakeCaseToCamelCase = TRUE ) - } else{ + } else { sql <- " INSERT INTO @target_analysis_ref_table( analysis_id, @@ -357,14 +356,14 @@ getDbDefaultCovariateData <- function(connection, 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 ) - + sql <- SqlRender::translate( sql = sql, targetDialect = DatabaseConnector::dbms(connection), @@ -375,17 +374,17 @@ getDbDefaultCovariateData <- function(connection, sql = sql ) } - } - + # Time reference if (!is.null(todo$sqlQueryTimeRef)) { - - if(extractToAndromeda){ - sql <- SqlRender::translate(sql = todo$sqlQueryTimeRef, - targetDialect = attr(connection, "dbms"), - tempEmulationSchema = tempEmulationSchema) + if (extractToAndromeda) { + sql <- SqlRender::translate( + sql = todo$sqlQueryTimeRef, + targetDialect = attr(connection, "dbms"), + tempEmulationSchema = tempEmulationSchema + ) DatabaseConnector::querySqlToAndromeda( connection = connection, sql = sql, @@ -393,7 +392,7 @@ getDbDefaultCovariateData <- function(connection, andromedaTableName = "timeRef", snakeCaseToCamelCase = TRUE ) - } else{ + } else { # TODO - what columns are in time ref table?! sql <- " INSERT INTO @target_time_ref_table( @@ -402,13 +401,13 @@ getDbDefaultCovariateData <- function(connection, 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), @@ -419,7 +418,6 @@ getDbDefaultCovariateData <- function(connection, sql = sql ) } - } delta <- Sys.time() - start @@ -458,7 +456,7 @@ getDbDefaultCovariateData <- function(connection, class(covariateData) <- "CovariateData" attr(class(covariateData), "package") <- "FeatureExtraction" return(covariateData) - } else{ + } 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 d2bce2b..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 # 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 @@ @@ -118,7 +118,7 @@vignettes/CreatingCovariatesBasedOnOtherCohorts.Rmd
CreatingCovariatesBasedOnOtherCohorts.RmdSite 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 @@ @@ -99,8 +99,8 @@vignettes/CreatingCovariatesUsingCohortAttributes.Rmd
CreatingCovariatesUsingCohortAttributes.RmdSite 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 @@ @@ -99,8 +99,8 @@vignettes/CreatingCustomCovariateBuilders.Rmd
CreatingCustomCovariateBuilders.RmdSite 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 @@ @@ -99,8 +99,8 @@vignettes/CreatingCustomCovariateBuildersKorean.Rmd
CreatingCustomCovariateBuildersKorean.Rmdvignettes/UsingFeatureExtraction.Rmd
UsingFeatureExtraction.RmdSite 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 @@ @@ -99,8 +99,8 @@vignettes/UsingFeatureExtractionKorean.Rmd
UsingFeatureExtractionKorean.RmdSite 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 @@ -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 @@ New Features:
+getDbCovariateData in the database and added ability to control all target tables with new target*Table parameters (#152, #321)Bugfixes:
+getDbDefaultCovariateData works and is consistentAdditional arguments, not used.
# \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
# }
createCohortBasedTemporalCovariateSettings functions.
+(Optional) The name of the database schema where the resulting covariates +should be stored. If not provided, results will be fetched to R.
(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.
(Optional) The name of the table where the resulting continuous covariates should be stored.
(Optional) The name of the table where the covariate reference will be stored.
(Optional) The name of the table where the analysis reference will be stored.
(Optional) The name of the table for the time reference
Should aggregate statistics be computed instead of covariates per cohort entry?
Whether to export to a table rather than Andromeda object
Run sql to create table? Code does not check if table exists.
If targetDatabaseSchema, drop any existing tables. Otherwise, results are merged +into existing table data. Overides createTable.
(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.
(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.
(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.
(Optional) The name of the table where the covariate reference will be stored. If
+it is a temp table, do not specify targetDatabaseSchema.
(Optional) The name of the table where the analysis reference will be stored. If
+it is a temp table, do not specify targetDatabaseSchema.
(Optional) The name of the table for the time reference. If
+it is a temp table, do not specify targetDatabaseSchema.
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 @@
# \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
# }
Covariate Data
Aggregate covariate data
convertPrespecSettingsToDetailedSettings()
Convert prespecified covariate settings into detailed covariate settings
Covariate Data