From 94e9644642656fcf25261b6109cce7584adf38cf Mon Sep 17 00:00:00 2001 From: Gowtham Rao Date: Wed, 8 Mar 2023 05:19:59 -0500 Subject: [PATCH 01/11] Support for list of CovariateSettings https://github.com/OHDSI/Characterization/issues/18 --- R/HelperFunctions.R | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/R/HelperFunctions.R b/R/HelperFunctions.R index eb98ea6..33a8570 100644 --- a/R/HelperFunctions.R +++ b/R/HelperFunctions.R @@ -231,13 +231,18 @@ -.checkCovariateSettings <- function( - covariateSettings, - errorMessages -) { - checkmate::assertClass( - x = covariateSettings, - classes = "covariateSettings", - add = errorMessages - ) +.checkCovariateSettings <- function(covariateSettings, + errorMessages) { + if (class(covariateSettings) == "covariateSettings") { + checkmate::assertClass(x = covariateSettings, + classes = "covariateSettings", + add = errorMessages) + } else { + for (j in (1:length(covariateSetting))) { + checkmate::assertClass(x = covariateSettings[[j]], + classes = "covariateSettings", + add = errorMessages) + } + } + } From 63e59519973a34f62db7881438193ac2fc289757 Mon Sep 17 00:00:00 2001 From: Gowtham Rao Date: Wed, 8 Mar 2023 06:31:26 -0500 Subject: [PATCH 02/11] Add tests --- R/HelperFunctions.R | 2 +- tests/testthat/test-aggregateCovariate.R | 31 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/R/HelperFunctions.R b/R/HelperFunctions.R index 33a8570..0901191 100644 --- a/R/HelperFunctions.R +++ b/R/HelperFunctions.R @@ -238,7 +238,7 @@ classes = "covariateSettings", add = errorMessages) } else { - for (j in (1:length(covariateSetting))) { + for (j in (1:length(covariateSettings))) { checkmate::assertClass(x = covariateSettings[[j]], classes = "covariateSettings", add = errorMessages) diff --git a/tests/testthat/test-aggregateCovariate.R b/tests/testthat/test-aggregateCovariate.R index 9a2423d..4581ae9 100644 --- a/tests/testthat/test-aggregateCovariate.R +++ b/tests/testthat/test-aggregateCovariate.R @@ -30,6 +30,37 @@ test_that("createAggregateCovariateSettings", { ) }) +test_that("createAggregateCovariateSettingsList", { + targetIds <- sample(x = 100, size = sample(10, 1)) + outcomeIds <- sample(x = 100, size = sample(10, 1)) + covariateSettings1 <- FeatureExtraction::createCovariateSettings( + useDemographicsGender = T, + useDemographicsAge = T, + useCharlsonIndex = T + ) + covariateSettings2 <- FeatureExtraction::createCovariateSettings( + useConditionOccurrenceAnyTimePrior = TRUE + ) + covariateSetting <- list(covariateSettings1, covariateSettings2) + + res <- createAggregateCovariateSettings( + targetIds = targetIds, + outcomeIds = outcomeIds, + riskWindowStart = 1, startAnchor = "cohort start", + riskWindowEnd = 365, endAnchor = "cohort start", + covariateSettings = covariateSettings + ) + + testthat::expect_equal( + res$targetIds, + targetIds + ) + testthat::expect_equal( + res$covariateSettings, + covariateSettings + ) +}) + test_that("computeAggregateCovariateAnalyses", { targetIds <- c(1, 2, 4) outcomeIds <- c(3) From c66344db3a94c394d792c5ae16074c8b7973c618 Mon Sep 17 00:00:00 2001 From: Gowtham Rao Date: Wed, 8 Mar 2023 06:41:13 -0500 Subject: [PATCH 03/11] Update test-aggregateCovariate.R --- tests/testthat/test-aggregateCovariate.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-aggregateCovariate.R b/tests/testthat/test-aggregateCovariate.R index 4581ae9..b7493b8 100644 --- a/tests/testthat/test-aggregateCovariate.R +++ b/tests/testthat/test-aggregateCovariate.R @@ -41,7 +41,7 @@ test_that("createAggregateCovariateSettingsList", { covariateSettings2 <- FeatureExtraction::createCovariateSettings( useConditionOccurrenceAnyTimePrior = TRUE ) - covariateSetting <- list(covariateSettings1, covariateSettings2) + covariateSettings <- list(covariateSettings1, covariateSettings2) res <- createAggregateCovariateSettings( targetIds = targetIds, From 937b1ec6410a7f6457c44d30da9157d7655c235b Mon Sep 17 00:00:00 2001 From: jreps Date: Mon, 13 Mar 2023 16:46:25 -0400 Subject: [PATCH 04/11] shiny app in package - adding shiny app --- NAMESPACE | 2 + R/ViewShiny.R | 199 ++++++++++++++++++++++++++++++++++++ inst/shinyConfig.json | 32 ++++++ man/viewCharacterization.Rd | 22 ++++ 4 files changed, 255 insertions(+) create mode 100644 R/ViewShiny.R create mode 100644 inst/shinyConfig.json create mode 100644 man/viewCharacterization.Rd diff --git a/NAMESPACE b/NAMESPACE index 91a8032..c0204a0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -26,5 +26,7 @@ export(saveCharacterizationSettings) export(saveDechallengeRechallengeAnalyses) export(saveRechallengeFailCaseSeriesAnalyses) export(saveTimeToEventAnalyses) +export(viewCharacterization) importFrom(dplyr,"%>%") +importFrom(methods,is) importFrom(rlang,.data) diff --git a/R/ViewShiny.R b/R/ViewShiny.R new file mode 100644 index 0000000..01676da --- /dev/null +++ b/R/ViewShiny.R @@ -0,0 +1,199 @@ +#' viewCharacterization - Interactively view the characterization results +#' +#' @description +#' This is a shiny app for viewing interactive plots and tables +#' @details +#' Input is the output of ... +#' @param resultLocation The location of the results +#' @param cohortDefinitionSet The cohortDefinitionSet extracted using webAPI +#' @return +#' Opens a shiny app for interactively viewing the results +#' +#' @export +viewCharacterization <- function( + resultLocation, + cohortDefinitionSet = NULL + ) { + + server <- file.path(resultLocation, 'sqliteCharacterization', 'sqlite.sqlite') + + connectionDetailsSettings <- list( + dbms = 'sqlite', + server = server + ) + + connectionDetails <- do.call( + what = DatabaseConnector::createConnectionDetails, + args = connectionDetailsSettings + ) + + con <- DatabaseConnector::connect(connectionDetails) + on.exit(DatabaseConnector::disconnect(con)) + + tables <- tolower(DatabaseConnector::getTableNames(con, 'main')) + + if(!'cg_cohort_definition' %in% tables){ + cohortIds <- unique( + c( + DatabaseConnector::querySql(con, 'select distinct TARGET_COHORT_ID from c_cohort_details where TARGET_COHORT_ID != 0;')$TARGET_COHORT_ID, + DatabaseConnector::querySql(con, 'select distinct OUTCOME_COHORT_ID from c_cohort_details where OUTCOME_COHORT_ID != 0;')$OUTCOME_COHORT_ID, + DatabaseConnector::querySql(con, 'select distinct TARGET_COHORT_DEFINITION_ID from c_time_to_event;')$TARGET_COHORT_DEFINITION_ID, + DatabaseConnector::querySql(con, 'select distinct OUTCOME_COHORT_DEFINITION_ID from c_time_to_event;')$OUTCOME_COHORT_DEFINITION_ID, + DatabaseConnector::querySql(con, 'select distinct TARGET_COHORT_DEFINITION_ID from c_rechallenge_fail_case_series;')$TARGET_COHORT_DEFINITION_ID, + DatabaseConnector::querySql(con, 'select distinct OUTCOME_COHORT_DEFINITION_ID from c_rechallenge_fail_case_series;')$OUTCOME_COHORT_DEFINITION_ID + ) + ) + + DatabaseConnector::insertTable( + connection = con, + databaseSchema = 'main', + tableName = 'cg_COHORT_DEFINITION', + data = data.frame( + cohortDefinitionId = cohortIds, + cohortName = getCohortNames(cohortIds, cohortDefinitionSet) + ), + camelCaseToSnakeCase = T + ) + } + + if(!'database_meta_data' %in% tables){ + dbIds <- unique( + c( + DatabaseConnector::querySql(con, 'select distinct DATABASE_ID from c_analysis_ref;')$DATABASE_ID, + DatabaseConnector::querySql(con, 'select distinct DATABASE_ID from c_dechallenge_rechallenge;')$DATABASE_ID, + DatabaseConnector::querySql(con, 'select distinct DATABASE_ID from c_time_to_event;')$DATABASE_ID + ) + ) + + DatabaseConnector::insertTable( + connection = con, + databaseSchema = 'main', + tableName = 'DATABASE_META_DATA', + data = data.frame( + databaseId = dbIds, + cdmSourceAbbreviation = paste0('database ', dbIds) + ), + camelCaseToSnakeCase = T + ) + } + + if(!'i_incidence_summary' %in% tables){ + + x <- c("refId", "databaseId", "sourceName", + "targetCohortDefinitionId", "targetName", "tarId", + "tarStartWith", "tarStartOffset", "tarEndWith", "tarEndOffset", + "subgroupId", 'subgroupName', + 'outcomeId','outcomeCohortDefinitionId', 'outcomeName', + 'clean_window', + 'ageId', 'ageGroupName', + 'genderId', 'genderName', + 'startYear', 'personsAtRiskPe', 'personsAtRisk', + 'personDaysPe', 'personDays', + 'personOutcomesPe', 'personOutcomes', + 'outcomesPe', 'outcomes', + 'incidenceProportionP100p', + 'incidenceRateP100py' + ) + df <- data.frame(matrix(ncol = length(x), nrow = 0)) + colnames(df) <- x + + DatabaseConnector::insertTable( + connection = con, + databaseSchema = 'main', + tableName = 'i_incidence_summary', + data = df, + camelCaseToSnakeCase = T + ) + } + + databaseSettings <- list( + connectionDetailSettings = connectionDetailSettings, + schema = 'main', + tablePrefix = 'c_', + cohortTablePrefix = 'cg_', + incidenceTablePrefix = 'i_', + databaseTable = 'DATABASE_META_DATA' + ) + + viewChars(databaseSettings) + +} + +viewChars <- function(databaseSettings){ + ensure_installed("ShinyAppBuilder") + ensure_installed("ResultModelManager") + + connectionDetails <- do.call( + DatabaseConnector::createConnectionDetails, + databaseSettings$connectionDetailSettings + ) + connection <- ResultModelManager::ConnectionHandler$new(connectionDetails) + databaseSettings$connectionDetailSettings <- NULL + + # set database settings into system variables + Sys.setenv("resultDatabaseDetails_characterization" = as.character(ParallelLogger::convertSettingsToJson(databaseSettings))) + + config <- ParallelLogger::loadSettingsFromJson( + fileName = system.file( + 'shinyConfig.json', + package = "Characterization" + ) + ) + + ShinyAppBuilder::viewShiny(config = config, connection = connection) +} + + + +getCohortNames <- function(cohortIds, cohortDefinitionSet){ + + if(!is.null(cohortDefinitionSet)){ + cohortNames <- sapply( + cohortIds, + function(x){ + cohortDefinitionSet$cohortName[cohortDefinitionSet$cohortId == x] + } + ) + } else{ + cohortNames <- paste0('cohort ', cohortIds) + } + + return(cohortNames) +} + + +# Borrowed from devtools: https://github.com/hadley/devtools/blob/ba7a5a4abd8258c52cb156e7b26bb4bf47a79f0b/R/utils.r#L44 +is_installed <- function (pkg, version = 0) { + installed_version <- tryCatch(utils::packageVersion(pkg), + error = function(e) NA) + !is.na(installed_version) && installed_version >= version +} + +# Borrowed and adapted from devtools: https://github.com/hadley/devtools/blob/ba7a5a4abd8258c52cb156e7b26bb4bf47a79f0b/R/utils.r#L74 +ensure_installed <- function(pkg) { + if (!is_installed(pkg)) { + msg <- paste0(sQuote(pkg), " must be installed for this functionality.") + if (interactive()) { + message(msg, "\nWould you like to install it?") + if (utils::menu(c("Yes", "No")) == 1) { + if(pkg%in%c("ShinyAppBuilder", "ResultModelManager")){ + + # add code to check for devtools... + dvtCheck <- tryCatch(utils::packageVersion('devtools'), + error = function(e) NA) + if(is.na(dvtCheck)){ + utils::install.packages('devtools') + } + + devtools::install_github(paste0('OHDSI/',pkg)) + }else{ + utils::install.packages(pkg) + } + } else { + stop(msg, call. = FALSE) + } + } else { + stop(msg, call. = FALSE) + } + } +} diff --git a/inst/shinyConfig.json b/inst/shinyConfig.json new file mode 100644 index 0000000..98114b2 --- /dev/null +++ b/inst/shinyConfig.json @@ -0,0 +1,32 @@ +{ + "shinyModules": [ + { + "id": "about", + "tabName": "About", + "tabText": "About", + "shinyModulePackage": "OhdsiShinyModules", + "uiFunction": "aboutViewer", + "serverFunction": "aboutServer", + "databaseConnectionKeyService": null, + "databaseConnectionKeyUsername": null, + "infoBoxFile": "aboutHelperFile()", + "icon": "info", + "keyring": true, + "order": 1 + }, + { + "id": "characterization", + "tabName": "Characterization", + "tabText": "Characterization", + "shinyModulePackage": "OhdsiShinyModules", + "uiFunction": "descriptionViewer", + "serverFunction": "descriptionServer", + "databaseConnectionKeyService": "resultDatabaseDetails", + "databaseConnectionKeyUsername": "characterization", + "infoBoxFile": "descriptionHelperFile()", + "icon": "chart-line", + "keyring": false, + "order": 2 + } + ] +} diff --git a/man/viewCharacterization.Rd b/man/viewCharacterization.Rd new file mode 100644 index 0000000..712066a --- /dev/null +++ b/man/viewCharacterization.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ViewShiny.R +\name{viewCharacterization} +\alias{viewCharacterization} +\title{viewCharacterization - Interactively view the characterization results} +\usage{ +viewCharacterization(resultLocation, cohortDefinitionSet = NULL) +} +\arguments{ +\item{resultLocation}{The location of the results} + +\item{cohortDefinitionSet}{The cohortDefinitionSet extracted using webAPI} +} +\value{ +Opens a shiny app for interactively viewing the results +} +\description{ +This is a shiny app for viewing interactive plots and tables +} +\details{ +Input is the output of ... +} From 79cba46099fe49082a59e434e22dc583150a4bc8 Mon Sep 17 00:00:00 2001 From: jreps Date: Mon, 13 Mar 2023 16:48:59 -0400 Subject: [PATCH 05/11] Update DESCRIPTION adding shiny packages to description --- DESCRIPTION | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6e7ab62..9a3eb9c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -30,10 +30,14 @@ Suggests: kableExtra, knitr, markdown, + ResultModelManager, + ShinyAppBuilder, withr Remotes: ohdsi/FeatureExtraction, - ohdsi/Eunomia + ohdsi/Eunomia, + ohdsi/ResultModelManager, + ohdsi/ShinyAppBuilder NeedsCompilation: no RoxygenNote: 7.2.3 Encoding: UTF-8 From 41a438403046f73ceb3737bcf4eceb111329220a Mon Sep 17 00:00:00 2001 From: jreps Date: Tue, 14 Mar 2023 08:48:15 -0400 Subject: [PATCH 06/11] Update ViewShiny.R fixed missing s typo in connectionDetailsSettings --- R/ViewShiny.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/ViewShiny.R b/R/ViewShiny.R index 01676da..0a3b5b6 100644 --- a/R/ViewShiny.R +++ b/R/ViewShiny.R @@ -107,7 +107,7 @@ viewCharacterization <- function( } databaseSettings <- list( - connectionDetailSettings = connectionDetailSettings, + connectionDetailsSettings = connectionDetailsSettings, schema = 'main', tablePrefix = 'c_', cohortTablePrefix = 'cg_', @@ -125,10 +125,10 @@ viewChars <- function(databaseSettings){ connectionDetails <- do.call( DatabaseConnector::createConnectionDetails, - databaseSettings$connectionDetailSettings + databaseSettings$connectionDetailsSettings ) connection <- ResultModelManager::ConnectionHandler$new(connectionDetails) - databaseSettings$connectionDetailSettings <- NULL + databaseSettings$connectionDetailsSettings <- NULL # set database settings into system variables Sys.setenv("resultDatabaseDetails_characterization" = as.character(ParallelLogger::convertSettingsToJson(databaseSettings))) From 1c081acf5f0107ce1d6b21500abac0e05c3fdb67 Mon Sep 17 00:00:00 2001 From: jreps Date: Tue, 14 Mar 2023 08:56:23 -0400 Subject: [PATCH 07/11] fixing R check fixing R check --- DESCRIPTION | 1 + NAMESPACE | 1 - R/Characterization.R | 1 - R/HelperFunctions.R | 6 +++--- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9a3eb9c..ef9569c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,6 +25,7 @@ Imports: readr, rlang Suggests: + devtools, testthat, Eunomia, kableExtra, diff --git a/NAMESPACE b/NAMESPACE index c0204a0..dfa7bce 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -28,5 +28,4 @@ export(saveRechallengeFailCaseSeriesAnalyses) export(saveTimeToEventAnalyses) export(viewCharacterization) importFrom(dplyr,"%>%") -importFrom(methods,is) importFrom(rlang,.data) diff --git a/R/Characterization.R b/R/Characterization.R index 20b810e..3885f20 100644 --- a/R/Characterization.R +++ b/R/Characterization.R @@ -18,6 +18,5 @@ "_PACKAGE" #' @importFrom rlang .data -#' @importFrom methods is #' @importFrom dplyr %>% NULL diff --git a/R/HelperFunctions.R b/R/HelperFunctions.R index eb98ea6..98b40d5 100644 --- a/R/HelperFunctions.R +++ b/R/HelperFunctions.R @@ -29,7 +29,7 @@ connectionDetails, errorMessages ) { - if (is(connectionDetails, "connectionDetails")) { + if (inherits(connectionDetails, "connectionDetails")) { checkmate::assertClass( x = connectionDetails, classes = "connectionDetails", @@ -99,7 +99,7 @@ return() } - if(class(settings) == 'timeToEventSettings'){ + if(inherits(settings,'timeToEventSettings')){ settings <- list(settings) } @@ -133,7 +133,7 @@ return() } - if(class(settings) == 'aggregateCovariateSettings'){ + if(inherits(settings,'aggregateCovariateSettings')){ settings <- list(settings) } From a217d88b6be87f14080007437d4fc992944ce485 Mon Sep 17 00:00:00 2001 From: jreps Date: Tue, 14 Mar 2023 12:44:39 -0400 Subject: [PATCH 08/11] shiny app test code - added tests to shiny app - restructured shiny app code to help code coverage --- R/ViewShiny.R | 28 ++++-- tests/testthat/test-viewShiny.R | 149 ++++++++++++++++++++++++++++++++ 2 files changed, 172 insertions(+), 5 deletions(-) create mode 100644 tests/testthat/test-viewShiny.R diff --git a/R/ViewShiny.R b/R/ViewShiny.R index 0a3b5b6..9215598 100644 --- a/R/ViewShiny.R +++ b/R/ViewShiny.R @@ -15,6 +15,18 @@ viewCharacterization <- function( cohortDefinitionSet = NULL ) { + databaseSettings <- prepareCharacterizationShiny( + resultLocation = resultLocation, + cohortDefinitionSet = cohortDefinitionSet + ) + + viewChars(databaseSettings) +} + +prepareCharacterizationShiny <- function( + resultLocation, + cohortDefinitionSet + ){ server <- file.path(resultLocation, 'sqliteCharacterization', 'sqlite.sqlite') connectionDetailsSettings <- list( @@ -93,7 +105,7 @@ viewCharacterization <- function( 'outcomesPe', 'outcomes', 'incidenceProportionP100p', 'incidenceRateP100py' - ) + ) df <- data.frame(matrix(ncol = length(x), nrow = 0)) colnames(df) <- x @@ -115,11 +127,13 @@ viewCharacterization <- function( databaseTable = 'DATABASE_META_DATA' ) - viewChars(databaseSettings) - + return(databaseSettings) } -viewChars <- function(databaseSettings){ +viewChars <- function( + databaseSettings, + testApp = F + ){ ensure_installed("ShinyAppBuilder") ensure_installed("ResultModelManager") @@ -140,7 +154,11 @@ viewChars <- function(databaseSettings){ ) ) - ShinyAppBuilder::viewShiny(config = config, connection = connection) + if(!testApp){ + ShinyAppBuilder::viewShiny(config = config, connection = connection) + } else{ + ShinyAppBuilder::createShinyApp(config = config, connection = connection) + } } diff --git a/tests/testthat/test-viewShiny.R b/tests/testthat/test-viewShiny.R new file mode 100644 index 0000000..93599ad --- /dev/null +++ b/tests/testthat/test-viewShiny.R @@ -0,0 +1,149 @@ +context("ViewShiny") + +# create a folder with results for the shiny app +resultLocation <- file.path(tempdir(), 'shinyResults') +if(!dir.exists(resultLocation)){ + dir.create(resultLocation, recursive = T) +} + +test_that("is_installed", { + testthat::expect_equal(is_installed('FeatureExtraction'), T) + testthat::expect_equal(is_installed('MadeUp4u834t3f'), F) +}) + +test_that("ensure_installed", { + testthat::expect_equal(ensure_installed('FeatureExtraction'), NULL) +}) + +test_that("prepareCharacterizationShiny works", { + + targetIds <- c(1, 2, 4) + outcomeIds <- c(3) + + timeToEventSettings1 <- createTimeToEventSettings( + targetIds = 1, + outcomeIds = c(3, 4) + ) + timeToEventSettings2 <- createTimeToEventSettings( + targetIds = 2, + outcomeIds = c(3, 4) + ) + + dechallengeRechallengeSettings <- createDechallengeRechallengeSettings( + targetIds = targetIds, + outcomeIds = outcomeIds, + dechallengeStopInterval = 30, + dechallengeEvaluationWindow = 31 + ) + + aggregateCovariateSettings1 <- createAggregateCovariateSettings( + targetIds = targetIds, + outcomeIds = outcomeIds, + riskWindowStart = 1, + startAnchor = "cohort start", + riskWindowEnd = 365, + endAnchor = "cohort start", + covariateSettings = FeatureExtraction::createCovariateSettings( + useDemographicsGender = T, + useDemographicsAge = T, + useDemographicsRace = T + ) + ) + + aggregateCovariateSettings2 <- createAggregateCovariateSettings( + targetIds = targetIds, + outcomeIds = outcomeIds, + riskWindowStart = 1, + startAnchor = "cohort start", + riskWindowEnd = 365, + endAnchor = "cohort start", + covariateSettings = FeatureExtraction::createCovariateSettings( + useConditionOccurrenceLongTerm = T + ) + ) + + characterizationSettings <- createCharacterizationSettings( + timeToEventSettings = list( + timeToEventSettings1, + timeToEventSettings2 + ), + dechallengeRechallengeSettings = list( + dechallengeRechallengeSettings + ), + aggregateCovariateSettings = list( + aggregateCovariateSettings1, + aggregateCovariateSettings2 + ) + ) + + runCharacterizationAnalyses( + connectionDetails = connectionDetails, + cdmDatabaseSchema = "main", + targetDatabaseSchema = "main", + targetTable = "cohort", + outcomeDatabaseSchema = "main", + outcomeTable = "cohort", + characterizationSettings = characterizationSettings, + saveDirectory = resultLocation, + tablePrefix = "c_", + databaseId = "1" + ) + +settings <- prepareCharacterizationShiny( + resultLocation = resultLocation, + cohortDefinitionSet = NULL +) + +testthat::expect_true(settings$schema == 'main') +testthat::expect_true(settings$tablePrefix == 'c_') +testthat::expect_true(settings$cohortTablePrefix == 'cg_') +testthat::expect_true(settings$incidenceTablePrefix == 'i_') +testthat::expect_true(settings$databaseTable == 'DATABASE_META_DATA') + +connectionDetailsTest <- do.call( + what = DatabaseConnector::createConnectionDetails, + args = list( + dbms = 'sqlite', + server = file.path(resultLocation, 'sqliteCharacterization', 'sqlite.sqlite') + ) +) +conTest <- DatabaseConnector::connect(connectionDetailsTest) +tables <- tolower( + DatabaseConnector::getTableNames( + connection = conTest, + databaseSchema = 'main' + ) +) + +# make sure the extra tables are added +testthat::expect_true('cg_cohort_definition' %in% tables) +testthat::expect_true('database_meta_data' %in% tables) +testthat::expect_true('i_incidence_summary' %in% tables) + +}) + +test_that("shiny app works", { + + settings <- prepareCharacterizationShiny( + resultLocation = resultLocation, + cohortDefinitionSet = NULL + ) + + app <- viewChars( + databaseSettings = settings, + testApp = T + ) + +shiny::testServer( + app = app, + args = list( + ), + expr = { + + testthat::expect_equal(runServer[['About']],0) + session$setInputs(menu = 'About') + testthat::expect_equal(runServer[['About']],1) + + }) + +}) From e848a05a0288f6c2c9ad45587c86de1b2a94de1e Mon Sep 17 00:00:00 2001 From: jreps Date: Tue, 14 Mar 2023 13:04:48 -0400 Subject: [PATCH 09/11] fixing warnings/notes - removing class() and adding inherits() - adding shiny to depends for tests --- DESCRIPTION | 1 + R/HelperFunctions.R | 2 +- R/RunCharacterization.R | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ef9569c..40270bb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -33,6 +33,7 @@ Suggests: markdown, ResultModelManager, ShinyAppBuilder, + shiny, withr Remotes: ohdsi/FeatureExtraction, diff --git a/R/HelperFunctions.R b/R/HelperFunctions.R index 98b40d5..a13eb9d 100644 --- a/R/HelperFunctions.R +++ b/R/HelperFunctions.R @@ -65,7 +65,7 @@ return() } - if(class(settings) == 'dechallengeRechallengeSettings'){ + if(inherits(settings, 'dechallengeRechallengeSettings')){ settings <- list(settings) } diff --git a/R/RunCharacterization.R b/R/RunCharacterization.R index df98e3c..0a03bb0 100644 --- a/R/RunCharacterization.R +++ b/R/RunCharacterization.R @@ -33,13 +33,13 @@ createCharacterizationSettings <- function( errorMessages = errorMessages ) - if (class(timeToEventSettings) == "timeToEventSettings") { + if (inherits(timeToEventSettings, "timeToEventSettings")) { timeToEventSettings <- list(timeToEventSettings) } - if (class(dechallengeRechallengeSettings) == "dechallengeRechallengeSettings") { + if (inherits(dechallengeRechallengeSettings, "dechallengeRechallengeSettings")) { dechallengeRechallengeSettings <- list(dechallengeRechallengeSettings) } - if (class(aggregateCovariateSettings) == "aggregateCovariateSettings") { + if (inherits(aggregateCovariateSettings, "aggregateCovariateSettings")) { aggregateCovariateSettings <- list(aggregateCovariateSettings) } From 9d974216c29579170f25766bc0cbc8c1f22a992f Mon Sep 17 00:00:00 2001 From: jreps Date: Wed, 15 Mar 2023 11:28:13 -0400 Subject: [PATCH 10/11] issue 22 fix - adding code to address issue 22 - T is now restricted to first occurrence with a requirement of minPriorObservation days (a new input with default of 0) - Includes characterization for T with O during and not during TAR plus T with O for the first time during and not during TAR - added cohort_counts to the database and exported csvs that tell you how many patients are in allT, T, O, firstO, TnO, TnfirstO, TnOc and TnfirstOc --- R/AggregateCovariates.R | 23 +- R/HelperFunctions.R | 12 ++ R/SaveLoad.R | 35 +++- .../resultsDataModelSpecification.csv | 196 +++++++++--------- .../sql/sql_server/DropAggregateCovariate.sql | 12 ++ inst/sql/sql_server/ResultTables.sql | 8 + .../createTargetOutcomeCombinations.sql | 188 ++++++++++++++++- man/createAggregateCovariateSettings.Rd | 3 + tests/testthat/test-aggregateCovariate.R | 16 +- 9 files changed, 390 insertions(+), 103 deletions(-) diff --git a/R/AggregateCovariates.R b/R/AggregateCovariates.R index 0be09dd..02e17ac 100644 --- a/R/AggregateCovariates.R +++ b/R/AggregateCovariates.R @@ -18,6 +18,7 @@ #' #' @param targetIds A list of cohortIds for the target cohorts #' @param outcomeIds A list of cohortIds for the outcome cohorts +#' @param minPriorObservation The minimum time in the database a patient in the target cohorts must be observed prior to index #' @template timeAtRisk #' @param covariateSettings An object created using \code{FeatureExtraction::createCovariateSettings} #' @@ -28,6 +29,7 @@ createAggregateCovariateSettings <- function( targetIds, outcomeIds, + minPriorObservation = 0, riskWindowStart = 1, startAnchor = 'cohort start', riskWindowEnd = 365, @@ -57,19 +59,26 @@ createAggregateCovariateSettings <- function( endAnchor = endAnchor, errorMessages = errorMessages ) - + # check covariateSettings .checkCovariateSettings( covariateSettings = covariateSettings, errorMessages = errorMessages ) + # check minPriorObservation + .checkMinPriorObservation( + minPriorObservation = minPriorObservation, + errorMessages = errorMessages + ) + checkmate::reportAssertions(errorMessages) # create list result <- list( targetIds = targetIds, outcomeIds = outcomeIds, + minPriorObservation = minPriorObservation, riskWindowStart = riskWindowStart, startAnchor = startAnchor, riskWindowEnd = riskWindowEnd , @@ -126,6 +135,7 @@ computeAggregateCovariateAnalyses <- function( createCohortsOfInterest( connection = connection, dbms = connectionDetails$dbms, + cdmDatabaseSchema = cdmDatabaseSchema, aggregateCovariateSettings, targetDatabaseSchema, targetTable, @@ -135,16 +145,16 @@ computeAggregateCovariateAnalyses <- function( ) ## get counts - sql <- 'select cohort_definition_id, count(*) N from #agg_cohorts group by cohort_definition_id;' + sql <- 'select cohort_definition_id, count(*) row_count, count(distinct subject_id) person_count from #agg_cohorts group by cohort_definition_id;' sql <- SqlRender::translate( sql = sql, targetDialect = connectionDetails$dbms ) counts <- DatabaseConnector::querySql( connection = connection, - sql = sql + sql = sql, + snakeCaseToCamelCase = T, ) - #print(counts) # testing message("Computing aggregate covariate results") @@ -159,6 +169,8 @@ computeAggregateCovariateAnalyses <- function( cdmVersion = cdmVersion, aggregated = T ) + # adding counts as a new table + result$cohortCounts <- counts # add databaseId and runId to each table in results # could add settings table with this and just have setting id @@ -234,6 +246,7 @@ computeAggregateCovariateAnalyses <- function( createCohortsOfInterest <- function( connection, + cdmDatabaseSchema, dbms, aggregateCovariateSettings, targetDatabaseSchema, @@ -247,6 +260,7 @@ createCohortsOfInterest <- function( sqlFilename = "createTargetOutcomeCombinations.sql", packageName = "Characterization", dbms = dbms, + cdm_database_schema = cdmDatabaseSchema, tempEmulationSchema = tempEmulationSchema, target_database_schema = targetDatabaseSchema, target_table = targetTable, @@ -254,6 +268,7 @@ createCohortsOfInterest <- function( outcome_table = outcomeTable, target_ids = paste(aggregateCovariateSettings$targetIds, collapse = ',', sep = ','), outcome_ids = paste(aggregateCovariateSettings$outcomeIds, collapse = ',', sep = ','), + min_prior_observation = aggregateCovariateSettings$minPriorObservation, tar_start = aggregateCovariateSettings$riskWindowStart, tar_start_anchor = ifelse( aggregateCovariateSettings$startAnchor == 'cohort start', diff --git a/R/HelperFunctions.R b/R/HelperFunctions.R index a13eb9d..311e6bb 100644 --- a/R/HelperFunctions.R +++ b/R/HelperFunctions.R @@ -241,3 +241,15 @@ add = errorMessages ) } + +.checkMinPriorObservation <- function( + minPriorObservation, + errorMessages +) { + checkmate::assertCount( + x = minPriorObservation, + null.ok = F, + .var.name = 'minPriorObservation', + add = errorMessages + ) +} diff --git a/R/SaveLoad.R b/R/SaveLoad.R index 73b5ca6..1720eee 100644 --- a/R/SaveLoad.R +++ b/R/SaveLoad.R @@ -404,6 +404,38 @@ exportAggregateCovariateToCsv <- function( } ) + # cohort details + Andromeda::batchApply( + tbl = result$cohortCounts, + fun = function(x) { + + append <- file.exists( + file.path( + saveDirectory, + "cohort_counts.csv" + ) + ) + + dat <- as.data.frame( + x %>% + dplyr::collect() + ) + + colnames(dat) <- SqlRender::camelCaseToSnakeCase( + string = colnames(dat) + ) + + readr::write_csv( + x = dat, + file = file.path( + saveDirectory, + "cohort_counts.csv" + ), + append = append + ) + + } + ) # cohort details Andromeda::batchApply( @@ -577,7 +609,8 @@ exportAggregateCovariateToCsv <- function( "analysis_ref.csv", "covariate_ref.csv", "covariates.csv", - "covariates_continuous.csv" + "covariates_continuous.csv", + "cohort_counts.csv" ) ) ) diff --git a/inst/settings/resultsDataModelSpecification.csv b/inst/settings/resultsDataModelSpecification.csv index f960897..29beb0a 100644 --- a/inst/settings/resultsDataModelSpecification.csv +++ b/inst/settings/resultsDataModelSpecification.csv @@ -1,94 +1,102 @@ -table_name,column_name,data_type,is_required,primary_key,empty_is_na,min_cell_count,description -time_to_event,database_id,varchar(100),Y,Y,N,N,The database identifier -time_to_event,target_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the target cohort -time_to_event,outcome_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the outcome cohort -time_to_event,outcome_type,varchar(100),Y,Y,N,N,Is the outvome a first occurrence or repeat -time_to_event,target_outcome_type,varchar(40),Y,Y,N,N,When does the outcome occur relative to target -time_to_event,time_to_event,int,Y,N,N,N,The time (in days) from target index to outcome start -time_to_event,num_events,int,Y,N,N,N,Number of events that occur during the specified time to event -time_to_event,time_scale,varchar(20),Y,N,N,N,time scale for the number of events -rechallenge_fail_case_series,database_id,varchar(100),Y,Y,N,N,The database identifier -rechallenge_fail_case_series,dechallenge_stop_interval,int,Y,N,N,N,The time period that É -rechallenge_fail_case_series,dechallenge_evaluation_window,int,Y,N,N,N,The time period that É -rechallenge_fail_case_series,target_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the target cohort -rechallenge_fail_case_series,outcome_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the outcome cohort -rechallenge_fail_case_series,person_key,int,Y,Y,N,N,The dense rank for the patient (an identifier that is not the same as the database) -rechallenge_fail_case_series,subject_id,bigint,Y,N,N,N,The person identifier for the failed case series (optional) -rechallenge_fail_case_series,dechallenge_exposure_number,int,Y,N,N,N,The number of times a dechallenge has occurred -rechallenge_fail_case_series,dechallenge_exposure_start_date_offset,int,Y,N,N,N,The offset for the dechallenge start (number of days after index) -rechallenge_fail_case_series,dechallenge_exposure_end_date_offset,int,Y,N,N,N,The offset for the dechallenge end (number of days after index) -rechallenge_fail_case_series,dechallenge_outcome_number,int,Y,N,N,N,The number of times an outcome has occurred during the dechallenge -rechallenge_fail_case_series,dechallenge_outcome_start_date_offset,int,Y,N,N,N,The offset for the outcome start (number of days after index) -rechallenge_fail_case_series,rechallenge_exposure_number,int,Y,N,N,N,The number of times a rechallenge exposure has occurred -rechallenge_fail_case_series,rechallenge_exposure_start_date_offset,int,Y,N,N,N,The offset for the rechallenge start (number of days after index) -rechallenge_fail_case_series,rechallenge_exposure_end_date_offset,int,Y,N,N,N,The offset for the rechallenge end (number of days after index) -rechallenge_fail_case_series,rechallenge_outcome_number,int,Y,N,N,N,The number of times the outcome has occurred during the rechallenge -rechallenge_fail_case_series,rechallenge_outcome_start_date_offset,int,Y,N,N,N,The offset for the outcome start (number of days after index) -dechallenge_rechallenge,database_id,varchar(100),Y,Y,N,N,The database identifier -dechallenge_rechallenge,dechallenge_stop_interval,int,Y,Y,N,N,The dechallenge stop interval -dechallenge_rechallenge,dechallenge_evaluation_window,int,Y,Y,N,N,The dechallenge evaluation window -dechallenge_rechallenge,target_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the target cohort -dechallenge_rechallenge,outcome_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the outcome cohort -dechallenge_rechallenge,num_exposure_eras,int,Y,N,N,N,The number of exposure eras -dechallenge_rechallenge,num_persons_exposed,int,Y,N,N,N,The number of persons exposed -dechallenge_rechallenge,num_cases,int,Y,N,N,N,The number of cases -dechallenge_rechallenge,dechallenge_attempt,int,Y,N,N,N,The number of dechallenge attempts -dechallenge_rechallenge,dechallenge_fail,int,Y,N,N,N,The dechallenge fail count -dechallenge_rechallenge,dechallenge_success,int,Y,N,N,N,The dechallenge success count -dechallenge_rechallenge,rechallenge_attempt,int,Y,N,N,N,The rechallenge attempt count -dechallenge_rechallenge,rechallenge_fail,int,Y,N,N,N,The rechallenge fail count -dechallenge_rechallenge,rechallenge_success,int,Y,N,N,N,The rechallenge success count -dechallenge_rechallenge,pct_dechallenge_attempt,float,Y,N,N,N,The percentage of dechallenge attempts -dechallenge_rechallenge,pct_dechallenge_success,float,Y,N,N,N,The percentage of dechallenge success -dechallenge_rechallenge,pct_dechallenge_fail,float,Y,N,N,N,The percentage of dechallenge fails -dechallenge_rechallenge,pct_rechallenge_attempt,float,Y,N,N,N,The percentage of rechallenge attempts -dechallenge_rechallenge,pct_rechallenge_success,float,Y,N,N,N,The percentage of rechallenge success -dechallenge_rechallenge,pct_rechallenge_fail,float,Y,N,N,N,The percentage of rechallenge fails -analysis_ref,database_id,varchar(100),Y,Y,N,N,The database identifier -analysis_ref,run_id,int,Y,Y,N,N,The run identifier -analysis_ref,analysis_id,int,Y,Y,N,N,The analysis identifier -analysis_ref,analysis_name,varchar,Y,N,N,N,The analysis name -analysis_ref,domain_id,varchar,Y,N,N,N,The domain id -analysis_ref,start_day,int,Y,N,N,N,The start day -analysis_ref,end_day,int,Y,N,N,N,The end day -analysis_ref,is_binary,varchar(1),Y,N,N,N,Is this a binary analysis -analysis_ref,missing_means_zero,varchar(1),Y,N,N,N,Missing means zero -covariate_ref,database_id,varchar(100),Y,Y,N,N,The database identifier -covariate_ref,run_id,int,Y,Y,N,N,The run identifier -covariate_ref,covariate_id,bigint,Y,Y,N,N,The covariate identifier -covariate_ref,covariate_name,varchar,Y,N,N,N,The covariate name -covariate_ref,analysis_id,int,Y,N,N,N,The analysis identifier -covariate_ref,concept_id,bigint,Y,N,N,N,The concept identifier -covariates,database_id,varchar(100),Y,Y,N,N,The database identifier -covariates,run_id,int,Y,Y,N,N,The run identifier -covariates,cohort_definition_id,int,Y,Y,N,N,The cohort definition id -covariates,covariate_id,bigint,Y,Y,N,N,The covaraite id -covariates,sum_value,int,Y,N,N,N,The sum value -covariates,average_value,float,Y,N,N,N,The average value -covariates_continuous,database_id,varchar(100),Y,Y,N,N,The database identifier -covariates_continuous,run_id,int,Y,Y,N,N,The run identifier -covariates_continuous,cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id -covariates_continuous,covariate_id,int,Y,Y,N,N,The covariate identifier -covariates_continuous,count_value,int,Y,N,N,N,The count value -covariates_continuous,min_value,float,Y,N,N,N,The min value -covariates_continuous,max_value,float,Y,N,N,N,The max value -covariates_continuous,average_value,float,Y,N,N,N,The average value -covariates_continuous,standard_deviation,float,Y,N,N,N,The standard devidation -covariates_continuous,median_value,float,Y,N,N,N,The median value -covariates_continuous,p_10_value,float,Y,N,N,N,The 10th percentile -covariates_continuous,p_25_value,float,Y,N,N,N,The 25th percentile -covariates_continuous,p_75_value,float,Y,N,N,N,The 75th percentile -covariates_continuous,p_90_value,float,Y,N,N,N,The 90th percentile -settings,run_id,int,Y,Y,N,N,The run identifier -settings,database_id,varchar(100),Y,Y,N,N,The database identifier -settings,covariate_setting_json,varchar,Y,N,N,N,The covariate settings JSON -settings,risk_window_start,int,Y,N,N,N,The risk window start -settings,risk_window_end,int,Y,N,N,N,The risk window end -settings,start_anchor,varchar(15),Y,N,N,N,The start anchor -settings,end_anchor,varchar(15),Y,N,N,N,The end anchor -cohort_details,run_id,int,Y,Y,N,N,The run identifier -cohort_details,database_id,varchar(100),Y,Y,N,N,The database identifier -cohort_details,cohort_definition_id,int,Y,N,N,N,The study cohort id -cohort_details,cohort_type,varchar(10),Y,N,N,N,The cohort type -cohort_details,target_cohort_id,int,Y,N,N,N,The target cohort id -cohort_details,outcome_cohort_id,int,Y,N,N,N,The outcome cohort id +table_name,column_name,data_type,is_required,primary_key,empty_is_na,min_cell_count,description +time_to_event,database_id,varchar(100),Y,Y,N,N,The database identifier +time_to_event,target_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the target cohort +time_to_event,outcome_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the outcome cohort +time_to_event,outcome_type,varchar(100),Y,Y,N,N,Is the outvome a first occurrence or repeat +time_to_event,target_outcome_type,varchar(40),Y,Y,N,N,When does the outcome occur relative to target +time_to_event,time_to_event,int,Y,N,N,N,The time (in days) from target index to outcome start +time_to_event,num_events,int,Y,N,N,N,Number of events that occur during the specified time to event +time_to_event,time_scale,varchar(20),Y,N,N,N,time scale for the number of events +rechallenge_fail_case_series,database_id,varchar(100),Y,Y,N,N,The database identifier +rechallenge_fail_case_series,dechallenge_stop_interval,int,Y,N,N,N,The time period that É +rechallenge_fail_case_series,dechallenge_evaluation_window,int,Y,N,N,N,The time period that É +rechallenge_fail_case_series,target_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the target cohort +rechallenge_fail_case_series,outcome_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the outcome cohort +rechallenge_fail_case_series,person_key,int,Y,Y,N,N,The dense rank for the patient (an identifier that is not the same as the database) +rechallenge_fail_case_series,subject_id,bigint,Y,N,N,N,The person identifier for the failed case series (optional) +rechallenge_fail_case_series,dechallenge_exposure_number,int,Y,N,N,N,The number of times a dechallenge has occurred +rechallenge_fail_case_series,dechallenge_exposure_start_date_offset,int,Y,N,N,N,The offset for the dechallenge start (number of days after index) +rechallenge_fail_case_series,dechallenge_exposure_end_date_offset,int,Y,N,N,N,The offset for the dechallenge end (number of days after index) +rechallenge_fail_case_series,dechallenge_outcome_number,int,Y,N,N,N,The number of times an outcome has occurred during the dechallenge +rechallenge_fail_case_series,dechallenge_outcome_start_date_offset,int,Y,N,N,N,The offset for the outcome start (number of days after index) +rechallenge_fail_case_series,rechallenge_exposure_number,int,Y,N,N,N,The number of times a rechallenge exposure has occurred +rechallenge_fail_case_series,rechallenge_exposure_start_date_offset,int,Y,N,N,N,The offset for the rechallenge start (number of days after index) +rechallenge_fail_case_series,rechallenge_exposure_end_date_offset,int,Y,N,N,N,The offset for the rechallenge end (number of days after index) +rechallenge_fail_case_series,rechallenge_outcome_number,int,Y,N,N,N,The number of times the outcome has occurred during the rechallenge +rechallenge_fail_case_series,rechallenge_outcome_start_date_offset,int,Y,N,N,N,The offset for the outcome start (number of days after index) +dechallenge_rechallenge,database_id,varchar(100),Y,Y,N,N,The database identifier +dechallenge_rechallenge,dechallenge_stop_interval,int,Y,Y,N,N,The dechallenge stop interval +dechallenge_rechallenge,dechallenge_evaluation_window,int,Y,Y,N,N,The dechallenge evaluation window +dechallenge_rechallenge,target_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the target cohort +dechallenge_rechallenge,outcome_cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id for the outcome cohort +dechallenge_rechallenge,num_exposure_eras,int,Y,N,N,N,The number of exposure eras +dechallenge_rechallenge,num_persons_exposed,int,Y,N,N,N,The number of persons exposed +dechallenge_rechallenge,num_cases,int,Y,N,N,N,The number of cases +dechallenge_rechallenge,dechallenge_attempt,int,Y,N,N,N,The number of dechallenge attempts +dechallenge_rechallenge,dechallenge_fail,int,Y,N,N,N,The dechallenge fail count +dechallenge_rechallenge,dechallenge_success,int,Y,N,N,N,The dechallenge success count +dechallenge_rechallenge,rechallenge_attempt,int,Y,N,N,N,The rechallenge attempt count +dechallenge_rechallenge,rechallenge_fail,int,Y,N,N,N,The rechallenge fail count +dechallenge_rechallenge,rechallenge_success,int,Y,N,N,N,The rechallenge success count +dechallenge_rechallenge,pct_dechallenge_attempt,float,Y,N,N,N,The percentage of dechallenge attempts +dechallenge_rechallenge,pct_dechallenge_success,float,Y,N,N,N,The percentage of dechallenge success +dechallenge_rechallenge,pct_dechallenge_fail,float,Y,N,N,N,The percentage of dechallenge fails +dechallenge_rechallenge,pct_rechallenge_attempt,float,Y,N,N,N,The percentage of rechallenge attempts +dechallenge_rechallenge,pct_rechallenge_success,float,Y,N,N,N,The percentage of rechallenge success +dechallenge_rechallenge,pct_rechallenge_fail,float,Y,N,N,N,The percentage of rechallenge fails +analysis_ref,database_id,varchar(100),Y,Y,N,N,The database identifier +analysis_ref,run_id,int,Y,Y,N,N,The run identifier +analysis_ref,analysis_id,int,Y,Y,N,N,The analysis identifier +analysis_ref,analysis_name,varchar,Y,N,N,N,The analysis name +analysis_ref,domain_id,varchar,Y,N,N,N,The domain id +analysis_ref,start_day,int,Y,N,N,N,The start day +analysis_ref,end_day,int,Y,N,N,N,The end day +analysis_ref,is_binary,varchar(1),Y,N,N,N,Is this a binary analysis +analysis_ref,missing_means_zero,varchar(1),Y,N,N,N,Missing means zero +covariate_ref,database_id,varchar(100),Y,Y,N,N,The database identifier +covariate_ref,run_id,int,Y,Y,N,N,The run identifier +covariate_ref,covariate_id,bigint,Y,Y,N,N,The covariate identifier +covariate_ref,covariate_name,varchar,Y,N,N,N,The covariate name +covariate_ref,analysis_id,int,Y,N,N,N,The analysis identifier +covariate_ref,concept_id,bigint,Y,N,N,N,The concept identifier +covariates,database_id,varchar(100),Y,Y,N,N,The database identifier +covariates,run_id,int,Y,Y,N,N,The run identifier +covariates,cohort_definition_id,int,Y,Y,N,N,The cohort definition id +covariates,covariate_id,bigint,Y,Y,N,N,The covaraite id +covariates,sum_value,int,Y,N,N,N,The sum value +covariates,average_value,float,Y,N,N,N,The average value +covariates_continuous,database_id,varchar(100),Y,Y,N,N,The database identifier +covariates_continuous,run_id,int,Y,Y,N,N,The run identifier +covariates_continuous,cohort_definition_id,bigint,Y,Y,N,N,The cohort definition id +covariates_continuous,covariate_id,int,Y,Y,N,N,The covariate identifier +covariates_continuous,count_value,int,Y,N,N,N,The count value +covariates_continuous,min_value,float,Y,N,N,N,The min value +covariates_continuous,max_value,float,Y,N,N,N,The max value +covariates_continuous,average_value,float,Y,N,N,N,The average value +covariates_continuous,standard_deviation,float,Y,N,N,N,The standard devidation +covariates_continuous,median_value,float,Y,N,N,N,The median value +covariates_continuous,p_10_value,float,Y,N,N,N,The 10th percentile +covariates_continuous,p_25_value,float,Y,N,N,N,The 25th percentile +covariates_continuous,p_75_value,float,Y,N,N,N,The 75th percentile +covariates_continuous,p_90_value,float,Y,N,N,N,The 90th percentile +settings,run_id,int,Y,Y,N,N,The run identifier +settings,database_id,varchar(100),Y,Y,N,N,The database identifier +settings,covariate_setting_json,varchar,Y,N,N,N,The covariate settings JSON +settings,risk_window_start,int,Y,N,N,N,The risk window start +settings,risk_window_end,int,Y,N,N,N,The risk window end +settings,start_anchor,varchar(15),Y,N,N,N,The start anchor +settings,end_anchor,varchar(15),Y,N,N,N,The end anchor +cohort_details,run_id,int,Y,Y,N,N,The run identifier +cohort_details,database_id,varchar(100),Y,Y,N,N,The database identifier +cohort_details,cohort_definition_id,int,Y,N,N,N,The study cohort id +cohort_details,cohort_type,varchar(10),Y,N,N,N,The cohort type +cohort_details,target_cohort_id,int,Y,N,N,N,The target cohort id +cohort_details,outcome_cohort_id,int,Y,N,N,N,The outcome cohort id +cohort_counts,run_id,int,Y,Y,N,N,The run identifier +cohort_counts,database_id,varchar(100),Y,Y,N,N,The database identifier +cohort_counts,cohort_definition_id,int,Y,N,N,N,The study cohort id +cohort_counts,row_count,int,Y,N,N,N,The number of rows in each cohort +cohort_counts,person_count,int,Y,N,N,N,The number of distinct people in each cohort + + + diff --git a/inst/sql/sql_server/DropAggregateCovariate.sql b/inst/sql/sql_server/DropAggregateCovariate.sql index fb46e83..b319cff 100644 --- a/inst/sql/sql_server/DropAggregateCovariate.sql +++ b/inst/sql/sql_server/DropAggregateCovariate.sql @@ -1,20 +1,32 @@ -- clean up by removing the temp tables +TRUNCATE TABLE #targets_agg_all; +DROP TABLE #targets_agg_all; + TRUNCATE TABLE #targets_agg; DROP TABLE #targets_agg; TRUNCATE TABLE #outcomes_agg; DROP TABLE #outcomes_agg; +TRUNCATE TABLE #outcomes_agg_first; +DROP TABLE #outcomes_agg_first; + TRUNCATE TABLE #cohort_details; DROP TABLE #cohort_details; TRUNCATE TABLE #target_with_outcome; DROP TABLE #target_with_outcome; +TRUNCATE TABLE #target_outcome_f; +DROP TABLE #target_outcome_f; + TRUNCATE TABLE #target_nooutcome; DROP TABLE #target_nooutcome; +TRUNCATE TABLE #target_noout_f; +DROP TABLE #target_noout_f; + TRUNCATE TABLE #agg_cohorts; DROP TABLE #agg_cohorts; diff --git a/inst/sql/sql_server/ResultTables.sql b/inst/sql/sql_server/ResultTables.sql index 95f47ae..663249e 100644 --- a/inst/sql/sql_server/ResultTables.sql +++ b/inst/sql/sql_server/ResultTables.sql @@ -121,3 +121,11 @@ CREATE TABLE @my_schema.@table_prefixcovariates_continuous ( p_75_value float, p_90_value float ); + +CREATE TABLE @my_schema.@table_prefixcohort_counts( + run_id int NOT NULL, + database_id varchar(100) NOT NULL, + cohort_definition_id int NOT NULL, + row_count int NOT NULL, + person_count int NOT NULL +); diff --git a/inst/sql/sql_server/createTargetOutcomeCombinations.sql b/inst/sql/sql_server/createTargetOutcomeCombinations.sql index c354232..0ba0f12 100644 --- a/inst/sql/sql_server/createTargetOutcomeCombinations.sql +++ b/inst/sql/sql_server/createTargetOutcomeCombinations.sql @@ -1,9 +1,26 @@ --need to know indication/target/outcome tuples +drop table if exists #targets_agg_all; +select * into #targets_agg_all +from @target_database_schema.@target_table +where cohort_definition_id in +(@target_ids); + +-- first T with > minPrioObs drop table if exists #targets_agg; select * into #targets_agg +from +(select *, +row_number() over(partition by subject_id, cohort_definition_id, cohort_start_date order by cohort_start_date asc) as rn from @target_database_schema.@target_table where cohort_definition_id in -(@target_ids); +(@target_ids) +) temp_t +inner join @cdm_database_schema.observation_period op +on op.person_id = temp_t.subject_id +and temp_t.cohort_start_date >= op.observation_period_start_date +and temp_t.cohort_start_date <= op.observation_period_end_date +where temp_t.rn = 1 +and datediff(day, op.observation_period_start_date, temp_t.cohort_start_date) >= @min_prior_observation; drop table if exists #outcomes_agg; select * into #outcomes_agg @@ -11,6 +28,16 @@ from @outcome_database_schema.@outcome_table where cohort_definition_id in (@outcome_ids); +-- first outcomes +drop table if exists #outcomes_agg_first; +select * into #outcomes_agg_first +from (select *, +row_number() over(partition by subject_id, cohort_definition_id, cohort_start_date order by cohort_start_date asc) as rn +from #outcomes_agg +) as o +where o.rn = 1 +; + -- create all the cohort details drop table if exists #cohort_details; @@ -53,6 +80,39 @@ CROSS JOIN union +select distinct +t.cohort_definition_id as target_cohort_id, +o.cohort_definition_id as outcome_cohort_id, +'TnfirstO' as cohort_type +from +(select distinct cohort_definition_id from #targets_agg) as t +CROSS JOIN +(select distinct cohort_definition_id from #outcomes_agg) as o + +union + +select distinct +t.cohort_definition_id as target_cohort_id, +o.cohort_definition_id as outcome_cohort_id, +'firstOnT' as cohort_type +from +(select distinct cohort_definition_id from #targets_agg) as t +CROSS JOIN +(select distinct cohort_definition_id from #outcomes_agg) as o + +union + +select distinct +t.cohort_definition_id as target_cohort_id, +o.cohort_definition_id as outcome_cohort_id, +'TnfirstOc' as cohort_type +from +(select distinct cohort_definition_id from #targets_agg) as t +CROSS JOIN +(select distinct cohort_definition_id from #outcomes_agg) as o + +union + select distinct t.cohort_definition_id as target_cohort_id, 0 as outcome_cohort_id, @@ -61,12 +121,29 @@ from (select distinct cohort_definition_id from #targets_agg) as t union +select distinct +t.cohort_definition_id as target_cohort_id, +0 as outcome_cohort_id, +'allT' as cohort_type +from (select distinct cohort_definition_id from #targets_agg) as t + +union + select distinct 0 as target_cohort_id, o.cohort_definition_id as outcome_cohort_id, 'O' as cohort_type from (select distinct cohort_definition_id from #outcomes_agg) as o +union + +select distinct +0 as target_cohort_id, +o.cohort_definition_id as outcome_cohort_id, +'firstO' as cohort_type +from (select distinct cohort_definition_id from #outcomes_agg) as o + + ) temp; @@ -92,6 +169,26 @@ and -- outcome starts (ends?) after TAR start o.cohort_start_date >= dateadd(day, @tar_start, t.@tar_start_anchor); +-- TnfirstO +drop table if exists #target_outcome_f; +select +t.subject_id, +t.cohort_start_date, +t.cohort_end_date, +o.cohort_start_date as outcome_start_date, +o.cohort_end_date as outcome_end_date, +t.cohort_definition_id as target_cohort_id, +o.cohort_definition_id as outcome_cohort_id +into #target_outcome_f +from #targets_agg t inner join #outcomes_agg_first o +on t.subject_id = o.subject_id +where +-- outcome starts before TAR end +o.cohort_start_date <= dateadd(day, @tar_end, t.@tar_end_anchor) +and +-- outcome starts (ends?) after TAR start +o.cohort_start_date >= dateadd(day, @tar_start, t.@tar_start_anchor); + -- 2) get all the people without the outcome in TAR drop table if exists #target_nooutcome; @@ -111,6 +208,23 @@ and t.subject_id = two.subject_id and o.cohort_definition_id = two.outcome_cohort_id where two.subject_id IS NULL; +drop table if exists #target_noout_f; +select +t.subject_id, +t.cohort_start_date, +t.cohort_end_date, +t.cohort_definition_id as target_cohort_id, +o.cohort_definition_id as outcome_cohort_id +into #target_noout_f +from #targets_agg t +CROSS JOIN +( select distinct cohort_definition_id from #outcomes_agg) o +left outer join #target_outcome_f two +on t.cohort_definition_id = two.target_cohort_id +and t.subject_id = two.subject_id +and o.cohort_definition_id = two.outcome_cohort_id +where two.subject_id IS NULL; + -- Final: select into #agg_cohorts select * into #agg_cohorts @@ -132,6 +246,21 @@ and cd.cohort_type = 'TnO' union +-- T with first O indexed at T + +select +tno.subject_id, +tno.cohort_start_date, +tno.cohort_end_date, +cd.cohort_definition_id +from #target_outcome_f tno +INNER JOIN #cohort_details cd +on cd.target_cohort_id = tno.target_cohort_id +and cd.outcome_cohort_id = tno.outcome_cohort_id +and cd.cohort_type = 'TnfirstO' + +union + -- T with O indexed at O select @@ -143,7 +272,22 @@ from #target_with_outcome tno INNER JOIN #cohort_details cd on cd.target_cohort_id = tno.target_cohort_id and cd.outcome_cohort_id = tno.outcome_cohort_id -and cd.cohort_type = 'TnOc' +and cd.cohort_type = 'OnT' + +union + +-- T with first O indexed at O + +select +tno.subject_id, +tno.outcome_start_date as cohort_start_date, +tno.outcome_end_date as cohort_end_date, +cd.cohort_definition_id +from #target_outcome_f tno +INNER JOIN #cohort_details cd +on cd.target_cohort_id = tno.target_cohort_id +and cd.outcome_cohort_id = tno.outcome_cohort_id +and cd.cohort_type = 'firstOnT' union @@ -162,6 +306,21 @@ and cd.cohort_type = 'TnOc' union +-- T without first O + +select +tnoc.subject_id, +tnoc.cohort_start_date, +tnoc.cohort_end_date, +cd.cohort_definition_id +from #target_noout_f tnoc +INNER JOIN #cohort_details cd +on cd.target_cohort_id = tnoc.target_cohort_id +and cd.outcome_cohort_id = tnoc.outcome_cohort_id +and cd.cohort_type = 'TnfirstOc' + +union + -- Ts and Os select distinct * from ( @@ -178,6 +337,18 @@ and cd.cohort_type = 'T' union +select +t.subject_id, +t.cohort_start_date, +t.cohort_end_date, +cd.cohort_definition_id +from #targets_agg_all as t +INNER JOIN #cohort_details cd +on cd.target_cohort_id = t.cohort_definition_id +and cd.cohort_type = 'allT' + +union + select o.subject_id, o.cohort_start_date, @@ -187,6 +358,19 @@ from #outcomes_agg as o INNER JOIN #cohort_details cd on cd.outcome_cohort_id = o.cohort_definition_id and cd.cohort_type = 'O' + +union + +select +o.subject_id, +o.cohort_start_date, +o.cohort_end_date, +cd.cohort_definition_id +from #outcomes_agg_first as o +INNER JOIN #cohort_details cd +on cd.outcome_cohort_id = o.cohort_definition_id +and cd.cohort_type = 'firstO' + ) temp_ts ) temp_ts2; diff --git a/man/createAggregateCovariateSettings.Rd b/man/createAggregateCovariateSettings.Rd index 76f7f1c..aed6f80 100644 --- a/man/createAggregateCovariateSettings.Rd +++ b/man/createAggregateCovariateSettings.Rd @@ -7,6 +7,7 @@ createAggregateCovariateSettings( targetIds, outcomeIds, + minPriorObservation = 0, riskWindowStart = 1, startAnchor = "cohort start", riskWindowEnd = 365, @@ -19,6 +20,8 @@ createAggregateCovariateSettings( \item{outcomeIds}{A list of cohortIds for the outcome cohorts} +\item{minPriorObservation}{The minimum time in the database a patient in the target cohorts must be observed prior to index} + \item{riskWindowStart}{The start of the risk window (in days) relative to the `startAnchor`.} \item{startAnchor}{The anchor point for the start of the risk window. Can be `"cohort start"` diff --git a/tests/testthat/test-aggregateCovariate.R b/tests/testthat/test-aggregateCovariate.R index 9a2423d..6a35300 100644 --- a/tests/testthat/test-aggregateCovariate.R +++ b/tests/testthat/test-aggregateCovariate.R @@ -15,6 +15,7 @@ test_that("createAggregateCovariateSettings", { res <- createAggregateCovariateSettings( targetIds = targetIds, outcomeIds = outcomeIds, + minPriorObservation = 10, riskWindowStart = 1, startAnchor = "cohort start", riskWindowEnd = 365, endAnchor = "cohort start", covariateSettings = covariateSettings @@ -28,6 +29,11 @@ test_that("createAggregateCovariateSettings", { res$covariateSettings, covariateSettings ) + + testthat::expect_equal( + res$minPriorObservation, + 10 + ) }) test_that("computeAggregateCovariateAnalyses", { @@ -42,6 +48,7 @@ test_that("computeAggregateCovariateAnalyses", { res <- createAggregateCovariateSettings( targetIds = targetIds, outcomeIds = outcomeIds, + minPriorObservation = 30, riskWindowStart = 1, startAnchor = "cohort start", riskWindowEnd = 5 * 365, endAnchor = "cohort start", covariateSettings = covariateSettings @@ -59,7 +66,7 @@ test_that("computeAggregateCovariateAnalyses", { testthat::expect_true(inherits(agc, "CovariateData")) testthat::expect_true(length(unique(as.data.frame(agc$covariates)$cohortDefinitionId)) - <= length(res$targetIds) * length(res$outcomeIds) * 3 + length(res$targetIds) + length(res$outcomeIds)) + <= length(res$targetIds) * length(res$outcomeIds) * 6 + length(res$targetIds)*2 + length(res$outcomeIds)*2) testthat::expect_true( sum(names(agc) %in% c( "analysisRef", @@ -71,6 +78,11 @@ test_that("computeAggregateCovariateAnalyses", { )) == 6 ) + testthat::expect_true( + nrow(as.data.frame(agc$cohortDetails)) == + nrow(as.data.frame(agc$cohortCounts)) + ) + # check cohortDetails testthat::expect_true( length(unique(as.data.frame(agc$cohortDetails)$cohortDefinitionId)) == @@ -78,7 +90,7 @@ test_that("computeAggregateCovariateAnalyses", { ) testthat::expect_true( - nrow(as.data.frame(agc$cohortDetails)) == 13 # 4 T/Os, 3 TnO, 3 TnOc, 3 OnT + nrow(as.data.frame(agc$cohortDetails)) == 26 # 8 T/Os, 6 TnO, 6 TnOc, 6 OnT ) # test saving/loading From 2042123ae97da248b5cfa06f3c4a62544e4dac58 Mon Sep 17 00:00:00 2001 From: jreps Date: Wed, 15 Mar 2023 12:48:09 -0400 Subject: [PATCH 11/11] preparing new release - updating news - updating website - updating description --- DESCRIPTION | 4 +- NEWS.md | 7 + _pkgdown.yml | 6 +- docs/404.html | 4 +- docs/articles/InstallationGuide.html | 13 +- .../UsingCharacterizationPackage.html | 2429 ++++++++++++++--- docs/articles/index.html | 4 +- docs/authors.html | 8 +- docs/index.html | 25 +- docs/news/index.html | 9 +- docs/pkgdown.yml | 4 +- docs/pull_request_template.html | 4 +- docs/reference/Characterization-package.html | 7 +- .../computeAggregateCovariateAnalyses.html | 4 +- ...computeDechallengeRechallengeAnalyses.html | 4 +- ...puteRechallengeFailCaseSeriesAnalyses.html | 4 +- .../reference/computeTimeToEventAnalyses.html | 4 +- .../createAggregateCovariateSettings.html | 9 +- .../createCharacterizationSettings.html | 4 +- .../createCharacterizationTables.html | 4 +- .../createDechallengeRechallengeSettings.html | 4 +- docs/reference/createSqliteDatabase.html | 4 +- docs/reference/createTimeToEventSettings.html | 4 +- .../exportAggregateCovariateToCsv.html | 4 +- docs/reference/exportDatabaseToCsv.html | 4 +- .../exportDechallengeRechallengeToCsv.html | 4 +- .../exportRechallengeFailCaseSeriesToCsv.html | 4 +- docs/reference/exportTimeToEventToCsv.html | 4 +- docs/reference/index.html | 12 +- .../loadAggregateCovariateAnalyses.html | 10 +- .../loadCharacterizationSettings.html | 8 +- .../loadDechallengeRechallengeAnalyses.html | 10 +- ...loadRechallengeFailCaseSeriesAnalyses.html | 10 +- docs/reference/loadTimeToEventAnalyses.html | 10 +- .../runCharacterizationAnalyses.html | 4 +- .../saveAggregateCovariateAnalyses.html | 10 +- .../saveCharacterizationSettings.html | 8 +- .../saveDechallengeRechallengeAnalyses.html | 10 +- ...saveRechallengeFailCaseSeriesAnalyses.html | 10 +- docs/reference/saveTimeToEventAnalyses.html | 10 +- docs/reference/viewCharacterization.html | 128 + docs/sitemap.xml | 3 + 42 files changed, 2339 insertions(+), 493 deletions(-) create mode 100644 docs/reference/viewCharacterization.html diff --git a/DESCRIPTION b/DESCRIPTION index 40270bb..59aa8d5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: Characterization Type: Package Title: Characterizations of Cohorts -Version: 0.0.6 -Date: 2023-02-13 +Version: 0.1.0 +Date: 2023-03-13 Authors@R: c( person("Jenna", "Reps", , "reps@ohdsi.org", role = c("aut", "cre")), person("Patrick", "Ryan", , "ryan@ohdsi.org", role = c("aut")) diff --git a/NEWS.md b/NEWS.md index dc98ade..79c5acd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +Characterization 0.1.0 +====================== + +- added support to enable target cohorts with multiple cohort entries for the aggregate covariate analysis by restructing to first cohort entry and ensuring the subject has a user specified minPriorObservation days observation in the database at first entry and also perform analysis on first outcomes and any outcome that is recorded during TAR. +- added shiny app + + Characterization 0.0.1 ====================== diff --git a/_pkgdown.yml b/_pkgdown.yml index 89c427c..0549e21 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -87,6 +87,10 @@ reference: - createSqliteDatabase - createCharacterizationTables - exportDatabaseToCsv - + - title: "Shiny App" + desc: > + Functions to interactively exlore the results from runCharacterizationAnalyses(). + contents: + - viewCharacterization diff --git a/docs/404.html b/docs/404.html index 60042e4..20886a8 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -115,7 +115,7 @@

Page not found (404)

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/articles/InstallationGuide.html b/docs/articles/InstallationGuide.html index fc35bfb..a2b2c58 100644 --- a/docs/articles/InstallationGuide.html +++ b/docs/articles/InstallationGuide.html @@ -33,7 +33,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -96,7 +96,7 @@

Characterization Installation Guide

Jenna Reps

-

2022-12-16

+

2023-03-15

Source: vignettes/InstallationGuide.Rmd @@ -107,7 +107,7 @@

2022-12-16

@@ -231,7 +230,7 @@

Acknowledgments

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/articles/UsingCharacterizationPackage.html b/docs/articles/UsingCharacterizationPackage.html index 66e5172..c2be504 100644 --- a/docs/articles/UsingCharacterizationPackage.html +++ b/docs/articles/UsingCharacterizationPackage.html @@ -33,7 +33,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -97,7 +97,7 @@

Using Characterization Package

Jenna Reps

-

2022-12-16

+

2023-03-15

Source: vignettes/UsingCharacterizationPackage.Rmd @@ -108,7 +108,7 @@

2022-12-16

Introduction @@ -165,28 +165,28 @@

Setup | | 0% | |======================================================================| 100% -
## Executing SQL took 0.00556 secs
+
## Executing SQL took 0.00634 secs
## Creating cohort: Diclofenac
 ## 
   |                                                                            
   |                                                                      |   0%
   |                                                                            
   |======================================================================| 100%
-
## Executing SQL took 0.00483 secs
+
## Executing SQL took 0.00962 secs
## Creating cohort: GiBleed
 ## 
   |                                                                            
   |                                                                      |   0%
   |                                                                            
   |======================================================================| 100%
-
## Executing SQL took 0.0104 secs
+
## Executing SQL took 0.0088 secs
## Creating cohort: NSAIDs
 ## 
   |                                                                            
   |                                                                      |   0%
   |                                                                            
   |======================================================================| 100%
-
## Executing SQL took 0.0512 secs
+
## Executing SQL took 0.0492 secs
## Cohorts created in table main.cohort
##   cohortId       name
 ## 1        1  Celecoxib
@@ -332,16 +332,16 @@ 

Aggreagate Covariates -100000 +1 8507001 -914 +237 -0.4956616 +0.4947808 @@ -352,16 +352,16 @@

Aggreagate Covariates -100000 +1 8532001 -930 +242 -0.5043384 +0.5052192 @@ -372,7 +372,7 @@

Aggreagate Covariates -100031 +2 8507001 @@ -392,7 +392,7 @@

Aggreagate Covariates -100031 +2 8532001 @@ -412,16 +412,16 @@

Aggreagate Covariates -100032 +3 8507001 -734 +57 -0.4929483 +0.4596774 @@ -432,16 +432,16 @@

Aggreagate Covariates -100032 +3 8532001 -755 +67 -0.5070517 +0.5403226 @@ -452,16 +452,16 @@

Aggreagate Covariates -100033 +4 8507001 -180 +237 -0.5070423 +0.4947808 @@ -472,16 +472,16 @@

Aggreagate Covariates -100033 +4 8532001 -175 +242 -0.4929577 +0.5052192 @@ -492,16 +492,16 @@

Aggreagate Covariates -200000 +5 8507001 -407 +894 -0.4788235 +0.4966667 @@ -512,16 +512,16 @@

Aggreagate Covariates -200000 +5 8532001 -443 +906 -0.5211765 +0.5033333 @@ -532,16 +532,16 @@

Aggreagate Covariates -200031 +6 8507001 -57 +395 -0.4596774 +0.4759036 @@ -552,16 +552,16 @@

Aggreagate Covariates -200031 +6 8532001 -67 +435 -0.5403226 +0.5240964 @@ -572,16 +572,16 @@

Aggreagate Covariates -200032 +7 8507001 -350 +1289 -0.4820937 +0.4901141 @@ -592,16 +592,16 @@

Aggreagate Covariates -200032 +7 8532001 -376 +1341 -0.5179063 +0.5098859 @@ -612,16 +612,16 @@

Aggreagate Covariates -200033 +8 8507001 -57 +180 -0.4596774 +0.5070423 @@ -632,16 +632,16 @@

Aggreagate Covariates -200033 +8 8532001 -67 +175 -0.5403226 +0.4929577 @@ -652,16 +652,16 @@

Aggreagate Covariates -300000 +9 8507001 -237 +57 -0.4947808 +0.4596774 @@ -672,16 +672,16 @@

Aggreagate Covariates -300000 +9 8532001 -242 +67 -0.5052192 +0.5403226 @@ -692,16 +692,16 @@

Aggreagate Covariates -400000 +10 8507001 -1321 +237 -0.4903489 +0.4947808 @@ -712,16 +712,16 @@

Aggreagate Covariates -400000 +10 8532001 -1373 +242 -0.5096511 +0.5052192 @@ -732,16 +732,16 @@

Aggreagate Covariates -400031 +11 8507001 -237 +714 -0.4947808 +0.4941176 @@ -752,16 +752,16 @@

Aggreagate Covariates -400031 +11 8532001 -242 +731 -0.5052192 +0.5058824 @@ -772,16 +772,16 @@

Aggreagate Covariates -400032 +12 8507001 -1084 +338 -0.4893905 +0.4787535 @@ -792,16 +792,16 @@

Aggreagate Covariates -400032 +12 8532001 -1131 +368 -0.5106095 +0.5212465 @@ -812,16 +812,16 @@

Aggreagate Covariates -400033 +13 8507001 -237 +1052 -0.4947808 +0.4890748 @@ -832,73 +832,18 @@

Aggreagate Covariates -400033 +13 8532001 -242 +1099 -0.5052192 +0.5109252 - - -
    -
  • covariatesContinuous:
  • -
-
- - - - - - - - - - - - - - - - - - - - - + + @@ -951,40 +892,36 @@

Aggreagate Covariates

- - - + + @@ -995,40 +932,56 @@

Aggreagate Covariates

- + + + + + + + + @@ -1039,40 +992,56 @@

Aggreagate Covariates

+ + + + + + + + @@ -1083,40 +1052,1735 @@

Aggreagate Covariates

- + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
-databaseId - -runId - -cohortDefinitionId - -covariateId - -countValue - -minValue - -maxValue - -averageValue - -standardDeviation - -medianValue - -p10Value - -p25Value - -p75Value - -p90Value -
Eunomia @@ -907,40 +852,36 @@

Aggreagate Covariates

-200031 - -1901 - -41 +14 -0 +8507001 -2 +180 -0.4274194 +0.5070423 -0.4606464 +
+Eunomia -0 +1 -0 +14 -0 +8532001 -1 +175 -1 +0.4929577
-200033 - -1901 - -41 +15 -0 +8507001 -2 +57 -0.4274194 +0.4596774 -0.4606464 +
+Eunomia -0 +1 -0 +15 -0 +8532001 -1 +67 -1 +0.5403226
-200032 +16 -1901 +8507001 -263 +237 -0 +0.4947808 -3 +
+Eunomia -0.3994490 +1 -0.3163975 +16 -0 +8532001 -0 +242 -0 +0.5052192 +
+Eunomia 1 -1 +17 + +8507001 + +714 + +0.4941176
-100031 +17 -1901 +8532001 -275 +731 -0 +0.5058824 +
+Eunomia -2 +1 -0.9549296 +18 -0.4233403 +8507001 -1 +338 -0 +0.4787535 +
+Eunomia 1 -1 +18 -2 +8532001 + +368 + +0.5212465
-100033 +19 -1901 +8507001 -275 +1052 -0 +0.4890748 -2 +
+Eunomia -0.9577465 +1 -0.4256226 +19 -1 +8532001 -0 +1099 -1 +0.5109252 -1 +
+Eunomia + +1 + +20 + +8507001 + +914 + +0.4956616 +
+Eunomia + +1 + +20 + +8532001 + +930 + +0.5043384 +
+Eunomia + +1 + +21 + +8507001 + +407 + +0.4788235 +
+Eunomia + +1 + +21 + +8532001 + +443 + +0.5211765 +
+Eunomia + +1 + +22 + +8507001 + +1321 + +0.4903489 +
+Eunomia + +1 + +22 + +8532001 + +1373 + +0.5096511 +
+Eunomia + +1 + +23 + +8507001 + +237 + +0.4947808 +
+Eunomia + +1 + +23 + +8532001 + +242 + +0.5052192 +
+Eunomia + +1 + +24 + +8507001 + +180 + +0.5070423 +
+Eunomia + +1 + +24 + +8532001 + +175 + +0.4929577 +
+Eunomia + +1 + +25 + +8507001 + +57 + +0.4596774 +
+Eunomia + +1 + +25 + +8532001 + +67 + +0.5403226 +
+Eunomia + +1 + +26 + +8507001 + +237 + +0.4947808 +
+Eunomia + +1 + +26 + +8532001 + +242 + +0.5052192 +
+
    +
  • covariatesContinuous:
  • +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1127,40 +2791,40 @@

Aggreagate Covariates

@@ -1171,40 +2835,40 @@

Aggreagate Covariates

@@ -1215,40 +2879,40 @@

Aggreagate Covariates

@@ -1259,40 +2923,40 @@

Aggreagate Covariates

@@ -1303,40 +2967,40 @@

Aggreagate Covariates

@@ -1347,40 +3011,40 @@

Aggreagate Covariates

@@ -1391,40 +3055,40 @@

Aggreagate Covariates

@@ -1435,40 +3099,40 @@

Aggreagate Covariates

@@ -1479,31 +3143,31 @@

Aggreagate Covariates

@@ -1567,31 +3231,31 @@

Aggreagate Covariates

@@ -1699,31 +3363,31 @@

Aggreagate Covariates

@@ -1743,31 +3407,31 @@

Aggreagate Covariates

@@ -1787,28 +3451,28 @@

Aggreagate Covariates

+ + +
+databaseId + +runId + +cohortDefinitionId + +covariateId + +countValue + +minValue + +maxValue + +averageValue + +standardDeviation + +medianValue + +p10Value + +p25Value + +p75Value + +p90Value +
+Eunomia + +1 + +3 + +1901 + +41 + +0 + +2 + +0.4274194 + +0.4606464 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +9 + +1901 + +41 + +0 + +2 + +0.4274194 + +0.4606464 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +15 + +1901 + +41 + +0 + +2 + +0.4274194 + +0.4606464 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +25 + +1901 + +41 + +0 + +2 + +0.4274194 + +0.4606464 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +12 + +1901 + +255 + +0 + +3 + +0.3980170 + +0.3159103 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +18 + +1901 + +255 + +0 + +3 + +0.3980170 + +0.3159103 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +8 + +1901 + +275 + +0 + +2 + +0.9549296 + +0.4233403 + +1 + +0 + +1 + +1 + +2 +
+Eunomia + +1 + +14 + +1901 + +275 + +0 + +2 + +0.9549296 + +0.4233403 + +1 + +0 + +1 + +1 + +2 +
+Eunomia + +1 + +2 + +1901 + +275 + +0 + +2 + +0.9577465 + +0.4256226 + +1 + +0 + +1 + +1 + +2 +
+Eunomia + +1 + +24 + +1901 + +275 + +0 + +2 + +0.9577465 + +0.4256226 + +1 + +0 + +1 + +1 + +2 +
+Eunomia + +1 + +6 + +1901 + +296 + +0 + +3 + +0.4024096 + +0.3450454 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +21 + +1901 + +304 + +0 + +3 + +0.4035294 + +0.3446752 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +10 + +1901 + +316 + +0 + +2 + +0.8183716 + +0.4280688 + +1 + +0 + +0 + +1 + +2 +
+Eunomia + +1 + +16 + +1901 + +316 + +0 + +2 + +0.8183716 + +0.4280688 + +1 + +0 + +0 + +1 + +2 +
+Eunomia + +1 + +1 + +1901 + +316 + +0 + +2 + +0.8204593 + +0.4299773 + +1 + +0 + +0 + +1 + +2 +
+Eunomia + +1 + +4 + +1901 + +316 + +0 + +2 + +0.8204593 + +0.4299773 + +1 + +0 + +0 + +1 + +2 +
+Eunomia + +1 + +23 + +1901 + +316 + +0 + +2 + +0.8204593 + +0.4299773 + +1 + +0 + +0 + +1 + +2 +
+Eunomia + +1 + +26 + +1901 + +316 + +0 + +2 + +0.8204593 + +0.4299773 + +1 + +0 + +0 + +1 + +2 +
+Eunomia + +1 + +11 + +1901 + +660 + +0 + +2 + +0.5307958 + +0.3688415 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +17 + +1901 + +660 + +0 + +2 + +0.5307958 + +0.3688415 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +13 + +1901 + +915 + +0 + +3 + +0.4872152 + +0.3557403 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +19 + +1901 + +915 + +0 + +3 + +0.4872152 + +0.3557403 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +5 + +1901 + +935 + +0 + +2 + +0.6144444 + +0.3867813 + +1 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +20 + +1901 + +958 + +0 + +2 + +0.6144252 + +0.3865994 + +1 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +7 + +1901 + +1231 + +0 + +3 + +0.5475285 + +0.3777510 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +22 + +1901 + +1262 + +0 + +3 + +0.5478842 + +0.3775118 + +0 + +0 + +0 + +1 + +1 +
+Eunomia + +1 + +9 + +1002 + +124 + +32 + +46 + +38.8709677 + +3.4000663 + +39 + +34 + +36 + +41 + +44 +
+Eunomia + +1 + +15 + +1002 + +124 + +32 + +46 + +38.8709677 + +3.4000663 + +39 + +34 + +36 + +41 + +44 +
+Eunomia + +1 + +3 + +1002 + +124 + +32 + +47 + +38.9758065 + +3.4226973 + +39 + +34 + +36 + +41 + +44 +
+Eunomia + +1 + +25 + +1002 + +124 + +32 + +47 + +38.9758065 + +3.4226973 + +39 + +34 + +36 + +41 + +44 +
+Eunomia + +1 + +8 + +1002 + +355 + +32 + +46 + +38.7746479 + +3.2746121 + +39 + +35 + +36 + +41 -2 +43
-200000 +14 -1901 +1002 -304 +355 -0 +32 -3 +46 -0.4035294 +38.7746479 -0.3446752 +3.2746121 -0 +39 -0 +35 -0 +36 -1 +41 -1 +43
-400031 +2 -1901 +1002 -316 +355 -0 +32 -2 +46 -0.8183716 +38.9014085 -0.4280688 +3.2449654 -1 +39 -0 +35 -0 +36 -1 +41 -2 +43
-300000 +24 -1901 +1002 -316 +355 -0 +32 -2 +46 -0.8204593 +38.9014085 -0.4299773 +3.2449654 -1 +39 -0 +35 -0 +36 -1 +41 -2 +43
-400033 +10 -1901 +1002 -316 +479 -0 +32 -2 +46 -0.8204593 +38.7995825 -0.4299773 +3.3042257 -1 +39 -0 +34 -0 +36 -1 +41 -2 +44
-100032 +16 -1901 +1002 -683 +479 -0 +32 -2 +46 -0.5332438 +38.7995825 -0.3691960 +3.3042257 -0 +39 -0 +34 -0 +36 -1 +41 -1 +44
-400032 +1 -1901 +1002 -946 +479 -0 +32 -3 +47 -0.4893905 +38.9206681 -0.3561536 +3.2884308 -0 +39 -0 +35 -0 +36 -1 +41 -1 +44
-100000 +4 -1901 +1002 -958 +479 -0 +32 -2 +47 -0.6144252 +38.9206681 -0.3865994 +3.2884308 -1 +39 -0 +35 -0 +36 -1 +41 -1 +44
-400000 +23 -1901 +1002 -1262 +479 -0 +32 -3 +47 -0.5478842 +38.9206681 -0.3775118 +3.2884308 -0 +39 -0 +35 -0 +36 -1 +41 -1 +44
-200031 +26 1002 -124 +479 32 -46 +47 -38.8709677 +38.9206681 -3.4000663 +3.2884308 39 -34 +35 36 @@ -1523,28 +3187,28 @@

Aggreagate Covariates

-200033 +12 1002 -124 +706 -32 +31 -47 +46 -38.9758065 +38.5226629 -3.4226973 +3.2712236 -39 +38 34 @@ -1556,7 +3220,7 @@

Aggreagate Covariates

-44 +43
-100031 +18 1002 -355 +706 -32 +31 46 -38.7746479 +38.5226629 -3.2746121 +3.2712236 -39 +38 -35 +34 36 @@ -1611,31 +3275,31 @@

Aggreagate Covariates

-100033 +6 1002 -355 +830 -32 +31 46 -38.9014085 +38.5746988 -3.2449654 +3.2910429 39 -35 +34 36 @@ -1655,25 +3319,25 @@

Aggreagate Covariates

-400031 +21 1002 -479 +850 -32 +31 46 -38.7995825 +38.5658824 -3.3042257 +3.2816028 39 @@ -1688,7 +3352,7 @@

Aggreagate Covariates

-44 +43
-300000 +11 1002 -479 +1445 -32 +31 47 -38.9206681 +38.6131488 -3.2884308 +3.3329496 39 -35 +34 36 @@ -1732,7 +3396,7 @@

Aggreagate Covariates

-44 +43
-400033 +17 1002 -479 +1445 -32 +31 47 -38.9206681 +38.6131488 -3.2884308 +3.3329496 39 -35 +34 36 @@ -1776,7 +3440,7 @@

Aggreagate Covariates

-44 +43
-200032 +5 1002 -726 +1800 31 -46 +47 -38.5137741 +38.6450000 -3.2604976 +3.3212435 -38 +39 34 @@ -1831,25 +3495,25 @@

Aggreagate Covariates

-200000 +20 1002 -850 +1844 31 -46 +47 -38.5658824 +38.6469631 -3.2816028 +3.3192555 39 @@ -1875,13 +3539,13 @@

Aggreagate Covariates

-100032 +13 1002 -1489 +2151 31 @@ -1890,10 +3554,10 @@

Aggreagate Covariates

-38.6165212 +38.5834496 -3.3301766 +3.3123287 39 @@ -1919,13 +3583,13 @@

Aggreagate Covariates

-100000 +19 1002 -1844 +2151 31 @@ -1934,10 +3598,10 @@

Aggreagate Covariates

-38.6469631 +38.5834496 -3.3192555 +3.3123287 39 @@ -1963,13 +3627,13 @@

Aggreagate Covariates

-400032 +7 1002 -2215 +2630 31 @@ -1978,10 +3642,10 @@

Aggreagate Covariates

-38.5828442 +38.6228137 -3.3071156 +3.3112779 39 @@ -2007,7 +3671,7 @@

Aggreagate Covariates

-400000 +22 1002 @@ -2343,8 +4007,8 @@

Dechallenge Rechallenge -
## Executing SQL took 0.066 secs
-## Computing dechallenge rechallenge for 3 target ids and 1outcome ids took 0.131 secs
+
## Executing SQL took 0.00906 secs
+## Computing dechallenge rechallenge for 3 target ids and 1outcome ids took 0.0708 secs

If you would like to save the results you can use the function saveDechallengeRechallengeAnalyses and this can then be loaded using loadDechallengeRechallengeAnalyses.

@@ -2450,8 +4114,8 @@

Dechallenge Rechallenge -
## Executing SQL took 0.104 secs
-## Computing dechallenge failed case series for 3 target ids and 1outcome ids took 0.158 secs
+
## Executing SQL took 0.0936 secs
+## Computing dechallenge failed case series for 3 target IDs and 1 outcome IDs took 0.135 secs

The results are Andromeda objects that can we viewed using dplyr. There is just one table named rechallengeFailCaseSeries:

@@ -2548,6 +4212,7 @@

Time to Event## Connecting using SQLite driver ## Uploading #cohort_settings ## +## Inserting data took 0.00473 secs ## Computing time to event results
## 
   |                                                                            
@@ -2584,8 +4249,8 @@ 

Time to Event## Executing SQL took 0.0434 secs -## Computing time-to-event for T-O pairs took 0.158 secs

+
## Executing SQL took 0.0428 secs
+## Computing time-to-event for T-O pairs took 0.16 secs

If you would like to save the results you can use the function saveTimeToEventAnalyses and this can then be loaded using loadTimeToEventAnalyses.

@@ -2989,7 +4654,7 @@

Run Multiple
 connectionDetailsT <- DatabaseConnector::createConnectionDetails(
   dbms = 'sqlite',
-  server = file.path(tempdir(),'example','sqliteCharacterization', 'sqlite')
+  server = file.path(tempdir(),'example','sqliteCharacterization', 'sqlite.sqlite')
 )
 
 exportDatabaseToCsv(
@@ -3020,7 +4685,7 @@ 

Run Multiple

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/articles/index.html b/docs/articles/index.html index 819227e..c31bf3e 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -89,7 +89,7 @@

All vignettes

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/authors.html b/docs/authors.html index c1598ff..d5c9951 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -90,14 +90,14 @@

Citation

-

Reps J, Ryan P (2022). +

Reps J, Ryan P (2023). Characterization: Characterizations of Cohorts. https://ohdsi.github.io/Characterization, https://github.com/OHDSI/Characterization.

@Manual{,
   title = {Characterization: Characterizations of Cohorts},
   author = {Jenna Reps and Patrick Ryan},
-  year = {2022},
+  year = {2023},
   note = {https://ohdsi.github.io/Characterization, https://github.com/OHDSI/Characterization},
 }
@@ -112,7 +112,7 @@

Citation

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/index.html b/docs/index.html index 27cfafc..a809885 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,7 +33,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -96,6 +96,8 @@
+

Build Status codecov.io

+

Characterization is part of HADES.

Introduction @@ -224,9 +226,28 @@

User Documentationpackage website.

+

Support +

+ +
+

Contributing

Read here how you can contribute to this package.

+
+
+

License +

+

Characterization is licensed under Apache License 2.0

+
+
+

Development +

+

Characterization is being developed in R Studio.

@@ -277,7 +298,7 @@

Developers

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/news/index.html b/docs/news/index.html index 192b085..0cdf562 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -72,6 +72,11 @@

Changelog

Source: NEWS.md +
+ +
  • added support to enable target cohorts with multiple cohort entries for the aggregate covariate analysis by restructing to first cohort entry and ensuring the subject has a user specified minPriorObservation days observation in the database at first entry and also perform analysis on first outcomes and any outcome that is recorded during TAR.
  • +
  • added shiny app
  • +

Initial version

@@ -90,7 +95,7 @@
-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index c92d37c..33dd174 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,8 +1,8 @@ pandoc: 2.19.2 -pkgdown: 2.0.6 +pkgdown: 2.0.7 pkgdown_sha: ~ articles: InstallationGuide: InstallationGuide.html UsingCharacterizationPackage: UsingCharacterizationPackage.html -last_built: 2022-12-16T22:10Z +last_built: 2023-03-15T16:42Z diff --git a/docs/pull_request_template.html b/docs/pull_request_template.html index a2c7f35..8e0be78 100644 --- a/docs/pull_request_template.html +++ b/docs/pull_request_template.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -94,7 +94,7 @@

NA

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/Characterization-package.html b/docs/reference/Characterization-package.html index a8f7548..0037c39 100644 --- a/docs/reference/Characterization-package.html +++ b/docs/reference/Characterization-package.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -88,7 +88,8 @@

See also

Author

Maintainer: Jenna Reps reps@ohdsi.org

-
+

Authors:

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/computeAggregateCovariateAnalyses.html b/docs/reference/computeAggregateCovariateAnalyses.html index b2e535b..8ea4096 100644 --- a/docs/reference/computeAggregateCovariateAnalyses.html +++ b/docs/reference/computeAggregateCovariateAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -165,7 +165,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/computeDechallengeRechallengeAnalyses.html b/docs/reference/computeDechallengeRechallengeAnalyses.html index d82e5d0..c74d039 100644 --- a/docs/reference/computeDechallengeRechallengeAnalyses.html +++ b/docs/reference/computeDechallengeRechallengeAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -150,7 +150,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/computeRechallengeFailCaseSeriesAnalyses.html b/docs/reference/computeRechallengeFailCaseSeriesAnalyses.html index 6717c60..60cfc21 100644 --- a/docs/reference/computeRechallengeFailCaseSeriesAnalyses.html +++ b/docs/reference/computeRechallengeFailCaseSeriesAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -155,7 +155,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/computeTimeToEventAnalyses.html b/docs/reference/computeTimeToEventAnalyses.html index 88bfbf0..146b10c 100644 --- a/docs/reference/computeTimeToEventAnalyses.html +++ b/docs/reference/computeTimeToEventAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -155,7 +155,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/createAggregateCovariateSettings.html b/docs/reference/createAggregateCovariateSettings.html index da2ee60..a0b0a36 100644 --- a/docs/reference/createAggregateCovariateSettings.html +++ b/docs/reference/createAggregateCovariateSettings.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -81,6 +81,7 @@

Create aggregate covariate study settings

createAggregateCovariateSettings(
   targetIds,
   outcomeIds,
+  minPriorObservation = 0,
   riskWindowStart = 1,
   startAnchor = "cohort start",
   riskWindowEnd = 365,
@@ -99,6 +100,10 @@ 

Arguments

A list of cohortIds for the outcome cohorts

+
minPriorObservation
+

The minimum time in the database a patient in the target cohorts must be observed prior to index

+ +
riskWindowStart

The start of the risk window (in days) relative to the `startAnchor`.

@@ -140,7 +145,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/createCharacterizationSettings.html b/docs/reference/createCharacterizationSettings.html index 1c5101e..5d758d8 100644 --- a/docs/reference/createCharacterizationSettings.html +++ b/docs/reference/createCharacterizationSettings.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -122,7 +122,7 @@

Details

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/createCharacterizationTables.html b/docs/reference/createCharacterizationTables.html index e708f68..7eb013f 100644 --- a/docs/reference/createCharacterizationTables.html +++ b/docs/reference/createCharacterizationTables.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -144,7 +144,7 @@

Details

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/createDechallengeRechallengeSettings.html b/docs/reference/createDechallengeRechallengeSettings.html index f6d1217..8a9fdec 100644 --- a/docs/reference/createDechallengeRechallengeSettings.html +++ b/docs/reference/createDechallengeRechallengeSettings.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -123,7 +123,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/createSqliteDatabase.html b/docs/reference/createSqliteDatabase.html index 68017dd..30b14d0 100644 --- a/docs/reference/createSqliteDatabase.html +++ b/docs/reference/createSqliteDatabase.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -110,7 +110,7 @@

Details

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/createTimeToEventSettings.html b/docs/reference/createTimeToEventSettings.html index 940d4f6..4cb3987 100644 --- a/docs/reference/createTimeToEventSettings.html +++ b/docs/reference/createTimeToEventSettings.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -110,7 +110,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/exportAggregateCovariateToCsv.html b/docs/reference/exportAggregateCovariateToCsv.html index 326a99f..b8dab95 100644 --- a/docs/reference/exportAggregateCovariateToCsv.html +++ b/docs/reference/exportAggregateCovariateToCsv.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -110,7 +110,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/exportDatabaseToCsv.html b/docs/reference/exportDatabaseToCsv.html index f194dab..b6d6dd5 100644 --- a/docs/reference/exportDatabaseToCsv.html +++ b/docs/reference/exportDatabaseToCsv.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -144,7 +144,7 @@

Details

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/exportDechallengeRechallengeToCsv.html b/docs/reference/exportDechallengeRechallengeToCsv.html index 0e4988c..d237188 100644 --- a/docs/reference/exportDechallengeRechallengeToCsv.html +++ b/docs/reference/exportDechallengeRechallengeToCsv.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -110,7 +110,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/exportRechallengeFailCaseSeriesToCsv.html b/docs/reference/exportRechallengeFailCaseSeriesToCsv.html index d8a6ecd..8fd1a4d 100644 --- a/docs/reference/exportRechallengeFailCaseSeriesToCsv.html +++ b/docs/reference/exportRechallengeFailCaseSeriesToCsv.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -110,7 +110,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/exportTimeToEventToCsv.html b/docs/reference/exportTimeToEventToCsv.html index 30b9e67..a7bbca2 100644 --- a/docs/reference/exportTimeToEventToCsv.html +++ b/docs/reference/exportTimeToEventToCsv.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -110,7 +110,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/index.html b/docs/reference/index.html index b59be76..7cc08c8 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -199,6 +199,14 @@

Insert into Database exportDatabaseToCsv()

Exports all tables in the result database to csv files

+

Shiny App

+

Functions to interactively exlore the results from runCharacterizationAnalyses().

+
+

viewCharacterization()

+

viewCharacterization - Interactively view the characterization results

diff --git a/docs/reference/loadAggregateCovariateAnalyses.html b/docs/reference/loadAggregateCovariateAnalyses.html index 3db8869..c4eabb2 100644 --- a/docs/reference/loadAggregateCovariateAnalyses.html +++ b/docs/reference/loadAggregateCovariateAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -78,13 +78,13 @@

Load the AggregateCovariate results

-
loadAggregateCovariateAnalyses(saveDirectory)
+
loadAggregateCovariateAnalyses(fileName)

Arguments

-
saveDirectory
-

An directory location to save the results into

+
fileName
+

The file to save the results into.

@@ -106,7 +106,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/loadCharacterizationSettings.html b/docs/reference/loadCharacterizationSettings.html index b1830e9..988d7c7 100644 --- a/docs/reference/loadCharacterizationSettings.html +++ b/docs/reference/loadCharacterizationSettings.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -78,12 +78,12 @@

Load the characterization settings previously saved as a json file

-
loadCharacterizationSettings(saveDirectory)
+
loadCharacterizationSettings(fileName)

Arguments

-
saveDirectory
+
fileName

The location of the the json settings

@@ -110,7 +110,7 @@

Details

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/loadDechallengeRechallengeAnalyses.html b/docs/reference/loadDechallengeRechallengeAnalyses.html index c2bb526..417352f 100644 --- a/docs/reference/loadDechallengeRechallengeAnalyses.html +++ b/docs/reference/loadDechallengeRechallengeAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -78,13 +78,13 @@

Load the DechallengeRechallenge results

-
loadDechallengeRechallengeAnalyses(saveDirectory)
+
loadDechallengeRechallengeAnalyses(fileName)

Arguments

-
saveDirectory
-

An directory location to save the results into

+
fileName
+

The file to save the results into.

@@ -106,7 +106,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/loadRechallengeFailCaseSeriesAnalyses.html b/docs/reference/loadRechallengeFailCaseSeriesAnalyses.html index 4a7801f..3f6b9a8 100644 --- a/docs/reference/loadRechallengeFailCaseSeriesAnalyses.html +++ b/docs/reference/loadRechallengeFailCaseSeriesAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -78,13 +78,13 @@

Load the RechallengeFailCaseSeries results

-
loadRechallengeFailCaseSeriesAnalyses(saveDirectory)
+
loadRechallengeFailCaseSeriesAnalyses(fileName)

Arguments

-
saveDirectory
-

An directory location to save the results into

+
fileName
+

The file to save the results into.

@@ -106,7 +106,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/loadTimeToEventAnalyses.html b/docs/reference/loadTimeToEventAnalyses.html index 3563050..af61ae4 100644 --- a/docs/reference/loadTimeToEventAnalyses.html +++ b/docs/reference/loadTimeToEventAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -78,13 +78,13 @@

Load the TimeToEvent results

-
loadTimeToEventAnalyses(saveDirectory)
+
loadTimeToEventAnalyses(fileName)

Arguments

-
saveDirectory
-

An directory location to save the results into

+
fileName
+

The file to save the results into.

@@ -106,7 +106,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/runCharacterizationAnalyses.html b/docs/reference/runCharacterizationAnalyses.html index cbd1111..416f975 100644 --- a/docs/reference/runCharacterizationAnalyses.html +++ b/docs/reference/runCharacterizationAnalyses.html @@ -18,7 +18,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -177,7 +177,7 @@

Details

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/saveAggregateCovariateAnalyses.html b/docs/reference/saveAggregateCovariateAnalyses.html index 4083254..db5c47a 100644 --- a/docs/reference/saveAggregateCovariateAnalyses.html +++ b/docs/reference/saveAggregateCovariateAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -78,7 +78,7 @@

Save the AggregateCovariate results

-
saveAggregateCovariateAnalyses(result, saveDirectory)
+
saveAggregateCovariateAnalyses(result, fileName)
@@ -87,8 +87,8 @@

Arguments

The output of running computeAggregateCovariateAnalyses()

-
saveDirectory
-

An directory location to save the results into

+
fileName
+

The file to save the results into.

@@ -110,7 +110,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/saveCharacterizationSettings.html b/docs/reference/saveCharacterizationSettings.html index 452c3df..34ec74e 100644 --- a/docs/reference/saveCharacterizationSettings.html +++ b/docs/reference/saveCharacterizationSettings.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -78,7 +78,7 @@

Save the characterization settings as a json

-
saveCharacterizationSettings(settings, saveDirectory)
+
saveCharacterizationSettings(settings, fileName)
@@ -87,7 +87,7 @@

Arguments

An object of class characterizationSettings created using createCharacterizationSettings

-
saveDirectory
+
fileName

The location to save the json settings

@@ -114,7 +114,7 @@

Details

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/saveDechallengeRechallengeAnalyses.html b/docs/reference/saveDechallengeRechallengeAnalyses.html index 1316456..9d465f3 100644 --- a/docs/reference/saveDechallengeRechallengeAnalyses.html +++ b/docs/reference/saveDechallengeRechallengeAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -78,7 +78,7 @@

Save the DechallengeRechallenge results

-
saveDechallengeRechallengeAnalyses(result, saveDirectory)
+
saveDechallengeRechallengeAnalyses(result, fileName)
@@ -87,8 +87,8 @@

Arguments

The output of running computeDechallengeRechallengeAnalyses()

-
saveDirectory
-

An directory location to save the results into

+
fileName
+

The file to save the results into.

@@ -110,7 +110,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/saveRechallengeFailCaseSeriesAnalyses.html b/docs/reference/saveRechallengeFailCaseSeriesAnalyses.html index d56acd8..de8f8b5 100644 --- a/docs/reference/saveRechallengeFailCaseSeriesAnalyses.html +++ b/docs/reference/saveRechallengeFailCaseSeriesAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -78,7 +78,7 @@

Save the RechallengeFailCaseSeries results

-
saveRechallengeFailCaseSeriesAnalyses(result, saveDirectory)
+
saveRechallengeFailCaseSeriesAnalyses(result, fileName)
@@ -87,8 +87,8 @@

Arguments

The output of running computeRechallengeFailCaseSeriesAnalyses()

-
saveDirectory
-

An directory location to save the results into

+
fileName
+

The file to save the results into.

@@ -110,7 +110,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/saveTimeToEventAnalyses.html b/docs/reference/saveTimeToEventAnalyses.html index 3d69544..914af23 100644 --- a/docs/reference/saveTimeToEventAnalyses.html +++ b/docs/reference/saveTimeToEventAnalyses.html @@ -17,7 +17,7 @@ Characterization - 0.0.4 + 0.1.0 @@ -78,7 +78,7 @@

Save the TimeToEvent results

-
saveTimeToEventAnalyses(result, saveDirectory)
+
saveTimeToEventAnalyses(result, fileName)
@@ -87,8 +87,8 @@

Arguments

The output of running computeTimeToEventAnalyses()

-
saveDirectory
-

An directory location to save the results into

+
fileName
+

The file to save the results into.

@@ -110,7 +110,7 @@

Value

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/viewCharacterization.html b/docs/reference/viewCharacterization.html new file mode 100644 index 0000000..eb0f2a4 --- /dev/null +++ b/docs/reference/viewCharacterization.html @@ -0,0 +1,128 @@ + +viewCharacterization - Interactively view the characterization results — viewCharacterization • Characterization + + +
+
+ + + +
+
+ + +
+

This is a shiny app for viewing interactive plots and tables

+
+ +
+
viewCharacterization(resultLocation, cohortDefinitionSet = NULL)
+
+ +
+

Arguments

+
resultLocation
+

The location of the results

+ + +
cohortDefinitionSet
+

The cohortDefinitionSet extracted using webAPI

+ +
+
+

Value

+ + +

Opens a shiny app for interactively viewing the results

+
+
+

Details

+

Input is the output of ...

+
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.7.

+
+ +
+ + + + + + + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index cd00cad..a679701 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -108,4 +108,7 @@ /reference/saveTimeToEventAnalyses.html + + /reference/viewCharacterization.html +