diff --git a/DESCRIPTION b/DESCRIPTION index 42ac855e7..b6714de50 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: CohortDiagnostics Type: Package Title: Diagnostics for OHDSI Cohorts -Version: 3.1.0 +Version: 3.1.1 Date: 2022-07-20 Authors@R: c( person("Gowtham", "Rao", email = "rao@ohdsi.org", role = c("aut", "cre")), @@ -43,7 +43,6 @@ Suggests: CirceR, DT, Eunomia, - ggiraph, ggplot2, htmltools, knitr, diff --git a/NAMESPACE b/NAMESPACE index 39635a404..4cf26a2ae 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,7 +10,6 @@ export(getDataMigrator) export(getDefaultCovariateSettings) export(getDefaultVocabularyTableNames) export(getResultsDataModelSpecifications) -export(launchCohortExplorer) export(launchDiagnosticsExplorer) export(migrateDataModel) export(runCohortRelationshipDiagnostics) diff --git a/NEWS.md b/NEWS.md index 608a15449..30681ca75 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,17 @@ +CohortDiagnostics 3.1.1 +======================= +Changes: + +1. Removed CohortExplorer app as it's now part of a [new package](https://github.com/ohdsi/cohortExplorer). + +2. Added support for custom FeatureExtraction features + +Bug Fixes: + +1. Fixed error when checking for cdm_source table + +2. Removal of `.data$` usage across package to fix tidyselect warning + CohortDiagnostics 3.1.0 ======================= Changes: diff --git a/R/CohortCharacterizationDiagnostics.R b/R/CohortCharacterizationDiagnostics.R index fb22e0a54..e55132e98 100644 --- a/R/CohortCharacterizationDiagnostics.R +++ b/R/CohortCharacterizationDiagnostics.R @@ -214,7 +214,7 @@ executeCohortCharacterization <- function(connection, startCohortCharacterization <- Sys.time() subset <- subsetToRequiredCohorts( cohorts = cohorts %>% - dplyr::filter(.data$cohortId %in% instantiatedCohorts), + dplyr::filter(cohortId %in% instantiatedCohorts), task = task, incremental = incremental, recordKeepingFile = recordKeepingFile diff --git a/R/CohortRelationship.R b/R/CohortRelationship.R index 24ec5207a..00d10af4c 100644 --- a/R/CohortRelationship.R +++ b/R/CohortRelationship.R @@ -85,7 +85,7 @@ runCohortRelationshipDiagnostics <- timePeriods <- relationshipDays %>% dplyr::distinct() %>% - dplyr::arrange(.data$startDay, .data$endDay) %>% + dplyr::arrange(startDay, endDay) %>% dplyr::mutate(timeId = dplyr::row_number()) ParallelLogger::logTrace(" - Creating Andromeda object to collect results") @@ -161,12 +161,12 @@ runCohortRelationshipDiagnostics <- resultsInAndromeda$cohortRelationships <- resultsInAndromeda$cohortRelationships %>% dplyr::inner_join(resultsInAndromeda$timePeriods, by = "timeId") %>% - dplyr::select(-.data$timeId) %>% + dplyr::select(-timeId) %>% dplyr::arrange( - .data$cohortId, - .data$comparatorCohortId, - .data$startDay, - .data$endDay + cohortId, + comparatorCohortId, + startDay, + endDay ) resultsInAndromeda$timePeriods <- NULL @@ -209,17 +209,17 @@ executeCohortRelationshipDiagnostics <- function(connection, startCohortRelationship <- Sys.time() allCohortIds <- cohortDefinitionSet %>% - dplyr::select(.data$cohortId, .data$checksum) %>% - dplyr::rename(targetCohortId = .data$cohortId, - targetChecksum = .data$checksum) %>% + dplyr::select(cohortId, checksum) %>% + dplyr::rename(targetCohortId = cohortId, + targetChecksum = checksum) %>% dplyr::distinct() combinationsOfPossibleCohortRelationships <- allCohortIds %>% tidyr::crossing(allCohortIds %>% - dplyr::rename(comparatorCohortId = .data$targetCohortId, - comparatorChecksum = .data$targetChecksum)) %>% - dplyr::filter(.data$targetCohortId != .data$comparatorCohortId) %>% - dplyr::arrange(.data$targetCohortId, .data$comparatorCohortId) %>% - dplyr::mutate(checksum = paste0(.data$targetChecksum, .data$comparatorChecksum)) + dplyr::rename(comparatorCohortId = targetCohortId, + comparatorChecksum = targetChecksum)) %>% + dplyr::filter(targetCohortId != comparatorCohortId) %>% + dplyr::arrange(targetCohortId, comparatorCohortId) %>% + dplyr::mutate(checksum = paste0(targetChecksum, comparatorChecksum)) subset <- subsetToRequiredCombis( combis = combinationsOfPossibleCohortRelationships, @@ -243,7 +243,7 @@ executeCohortRelationshipDiagnostics <- function(connection, (nrow(combinationsOfPossibleCohortRelationships) - ( nrow( combinationsOfPossibleCohortRelationships %>% - dplyr::filter(.data$targetCohortId %in% c(subset$targetCohortId)) + dplyr::filter(targetCohortId %in% c(subset$targetCohortId)) ) )) > 0) { ParallelLogger::logInfo( @@ -251,7 +251,7 @@ executeCohortRelationshipDiagnostics <- function(connection, " - Skipping %s combinations in incremental mode because these were previously computed.", nrow(combinationsOfPossibleCohortRelationships) - nrow( combinationsOfPossibleCohortRelationships %>% - dplyr::filter(.data$targetCohortId %in% c(subset$targetCohortId)) + dplyr::filter(targetCohortId %in% c(subset$targetCohortId)) ) ) ) diff --git a/R/ConceptSets.R b/R/ConceptSets.R index 8924d3e85..10c42f91f 100644 --- a/R/ConceptSets.R +++ b/R/ConceptSets.R @@ -110,10 +110,10 @@ combineConceptSetsFromCohorts <- function(cohorts) { checkmate::reportAssertions(errorMessage) checkmate::assertDataFrame( x = cohorts %>% dplyr::select( - .data$cohortId, - .data$sql, - .data$json, - .data$cohortName + cohortId, + sql, + json, + cohortName ), any.missing = FALSE, min.cols = 4, @@ -158,10 +158,10 @@ combineConceptSetsFromCohorts <- function(cohorts) { return(NULL) } conceptSets <- dplyr::bind_rows(conceptSets) %>% - dplyr::arrange(.data$cohortId, .data$conceptSetId) + dplyr::arrange(cohortId, conceptSetId) uniqueConceptSets <- conceptSets %>% - dplyr::select(.data$conceptSetExpression) %>% + dplyr::select(conceptSetExpression) %>% dplyr::distinct() %>% dplyr::mutate(uniqueConceptSetId = dplyr::row_number()) @@ -169,14 +169,14 @@ combineConceptSetsFromCohorts <- function(cohorts) { dplyr::inner_join(uniqueConceptSets, by = "conceptSetExpression") %>% dplyr::distinct() %>% dplyr::relocate( - .data$uniqueConceptSetId, - .data$cohortId, - .data$conceptSetId + uniqueConceptSetId, + cohortId, + conceptSetId ) %>% dplyr::arrange( - .data$uniqueConceptSetId, - .data$cohortId, - .data$conceptSetId + uniqueConceptSetId, + cohortId, + conceptSetId ) return(conceptSets) } @@ -371,7 +371,7 @@ runConceptSetDiagnostics <- function(connection, # Save concept set metadata --------------------------------------- conceptSetsExport <- makeDataExportable( x = conceptSets %>% - dplyr::select(-.data$uniqueConceptSetId) %>% + dplyr::select(-uniqueConceptSetId) %>% dplyr::distinct(), tableName = "concept_sets", minCellCount = minCellCount, @@ -387,7 +387,7 @@ runConceptSetDiagnostics <- function(connection, uniqueConceptSets <- conceptSets[!duplicated(conceptSets$uniqueConceptSetId),] %>% - dplyr::select(-.data$cohortId, -.data$conceptSetId) + dplyr::select(-cohortId, -conceptSetId) timeExecution( exportFolder, @@ -468,36 +468,36 @@ runConceptSetDiagnostics <- function(connection, tidyr::tibble() counts <- counts %>% - dplyr::rename(uniqueConceptSetId = .data$conceptSetId) %>% + dplyr::rename(uniqueConceptSetId = conceptSetId) %>% dplyr::inner_join( conceptSets %>% dplyr::select( - .data$uniqueConceptSetId, - .data$cohortId, - .data$conceptSetId + uniqueConceptSetId, + cohortId, + conceptSetId ), by = "uniqueConceptSetId" ) %>% - dplyr::select(-.data$uniqueConceptSetId) %>% + dplyr::select(-uniqueConceptSetId) %>% dplyr::mutate(databaseId = !!databaseId) %>% dplyr::relocate( - .data$databaseId, - .data$cohortId, - .data$conceptSetId, - .data$conceptId + databaseId, + cohortId, + conceptSetId, + conceptId ) %>% dplyr::distinct() counts <- counts %>% dplyr::group_by( - .data$databaseId, - .data$cohortId, - .data$conceptSetId, - .data$conceptId, - .data$sourceConceptId + databaseId, + cohortId, + conceptSetId, + conceptId, + sourceConceptId ) %>% dplyr::summarise( - conceptCount = max(.data$conceptCount), - conceptSubjects = max(.data$conceptSubjects) + conceptCount = max(conceptCount), + conceptSubjects = max(conceptSubjects) ) %>% dplyr::ungroup() @@ -611,7 +611,7 @@ runConceptSetDiagnostics <- function(connection, ) return(tidyr::tibble()) } - primaryCodesetIds <- primaryCodesetIds %>% dplyr::filter(.data$domain %in% + primaryCodesetIds <- primaryCodesetIds %>% dplyr::filter(domain %in% c(domains$domain %>% unique())) if (nrow(primaryCodesetIds) == 0) { warning( @@ -624,8 +624,8 @@ runConceptSetDiagnostics <- function(connection, return(tidyr::tibble()) } primaryCodesetIds <- conceptSets %>% - dplyr::filter(.data$cohortId %in% cohort$cohortId) %>% - dplyr::select(codeSetIds = .data$conceptSetId, .data$uniqueConceptSetId) %>% + dplyr::filter(cohortId %in% cohort$cohortId) %>% + dplyr::select(codeSetIds = conceptSetId, uniqueConceptSetId) %>% dplyr::inner_join(primaryCodesetIds, by = "codeSetIds") pasteIds <- function(row) { @@ -712,7 +712,7 @@ runConceptSetDiagnostics <- function(connection, counts <- lapply(split(primaryCodesetIds, 1:nrow(primaryCodesetIds)), getCounts) %>% dplyr::bind_rows() %>% - dplyr::arrange(.data$conceptCount) + dplyr::arrange(conceptCount) if (nrow(counts) > 0) { counts$cohortId <- cohort$cohortId @@ -849,32 +849,32 @@ runConceptSetDiagnostics <- function(connection, } data <- dplyr::bind_rows(data) %>% dplyr::distinct() %>% - dplyr::rename(uniqueConceptSetId = .data$codesetId) %>% + dplyr::rename(uniqueConceptSetId = codesetId) %>% dplyr::inner_join( conceptSets %>% dplyr::select( - .data$uniqueConceptSetId, - .data$cohortId, - .data$conceptSetId + uniqueConceptSetId, + cohortId, + conceptSetId ), by = "uniqueConceptSetId" ) %>% - dplyr::select(-.data$uniqueConceptSetId) %>% + dplyr::select(-uniqueConceptSetId) %>% dplyr::select( - .data$cohortId, - .data$conceptSetId, - .data$conceptId, - .data$conceptCount, - .data$conceptSubjects + cohortId, + conceptSetId, + conceptId, + conceptCount, + conceptSubjects ) %>% dplyr::group_by( - .data$cohortId, - .data$conceptSetId, - .data$conceptId + cohortId, + conceptSetId, + conceptId ) %>% dplyr::summarise( - conceptCount = max(.data$conceptCount), - conceptSubjects = max(.data$conceptSubjects) + conceptCount = max(conceptCount), + conceptSubjects = max(conceptSubjects) ) %>% dplyr::ungroup() data <- makeDataExportable( @@ -941,14 +941,14 @@ runConceptSetDiagnostics <- function(connection, snakeCaseToCamelCase = TRUE ) %>% dplyr::tibble() %>% - dplyr::rename(uniqueConceptSetId = .data$codesetId) %>% + dplyr::rename(uniqueConceptSetId = codesetId) %>% dplyr::inner_join(conceptSets, by = "uniqueConceptSetId" ) %>% dplyr::select( - .data$cohortId, - .data$conceptSetId, - .data$conceptId + cohortId, + conceptSetId, + conceptId ) resolvedConceptIds <- makeDataExportable( diff --git a/R/DataSourceInformation.R b/R/DataSourceInformation.R index 6bd7d7c57..72f66db48 100644 --- a/R/DataSourceInformation.R +++ b/R/DataSourceInformation.R @@ -49,10 +49,13 @@ getCdmDataSourceInformation <- } } - if (!DatabaseConnector::dbExistsTable(conn = connection, name = "cdm_source")) { + if (!DatabaseConnector::existsTable(connection = connection, + databaseSchema = cdmDatabaseSchema, + tableName = "cdm_source")) { warning("CDM Source table not found in CDM. Metadata on CDM source will be limited.") return(NULL) } + sqlCdmDataSource <- "select * from @cdm_database_schema.cdm_source;" cdmDataSource <- diff --git a/R/ExportCharacterization.R b/R/ExportCharacterization.R index cd772c2fb..ead0585b8 100644 --- a/R/ExportCharacterization.R +++ b/R/ExportCharacterization.R @@ -31,7 +31,7 @@ exportCharacterization <- function(characteristics, } else if (dplyr::pull(dplyr::count(characteristics$covariateRef)) > 0) { characteristics$filteredCovariates <- characteristics$covariates %>% - dplyr::filter(.data$mean >= minCharacterizationMean) %>% + dplyr::filter(mean >= minCharacterizationMean) %>% dplyr::mutate(databaseId = !!databaseId) %>% dplyr::left_join(counts, by = c("cohortId", "databaseId"), @@ -39,22 +39,22 @@ exportCharacterization <- function(characteristics, ) %>% dplyr::mutate( mean = dplyr::if_else( - .data$mean != 0 & .data$mean < minCellCount / as.numeric(.data$cohortEntries), - -minCellCount / as.numeric(.data$cohortEntries), - .data$mean + mean != 0 & mean < minCellCount / as.numeric(cohortEntries), + -minCellCount / as.numeric(cohortEntries), + mean ), sumValue = dplyr::if_else( - .data$sumValue != 0 & .data$sumValue < minCellCount, + sumValue != 0 & sumValue < minCellCount, -minCellCount, - .data$sumValue + sumValue ) ) %>% - dplyr::mutate(sd = dplyr::if_else(.data$mean >= 0, .data$sd, 0)) %>% + dplyr::mutate(sd = dplyr::if_else(mean >= 0, sd, 0)) %>% dplyr::mutate( - mean = round(.data$mean, digits = 4), - sd = round(.data$sd, digits = 4) + mean = round(mean, digits = 4), + sd = round(sd, digits = 4) ) %>% - dplyr::select(-.data$cohortEntries, -.data$cohortSubjects) %>% + dplyr::select(-cohortEntries, -cohortSubjects) %>% dplyr::distinct() %>% makeDataExportable( tableName = "temporal_covariate_value", minCellCount = minCellCount, diff --git a/R/InclusionRules.R b/R/InclusionRules.R index 6940c1868..21e08056e 100644 --- a/R/InclusionRules.R +++ b/R/InclusionRules.R @@ -27,7 +27,7 @@ getInclusionStats <- function(connection, ParallelLogger::logInfo("Fetching inclusion statistics from files") subset <- subsetToRequiredCohorts( cohorts = cohortDefinitionSet %>% - dplyr::filter(.data$cohortId %in% instantiatedCohorts), + dplyr::filter(cohortId %in% instantiatedCohorts), task = "runInclusionStatistics", incremental = incremental, recordKeepingFile = recordKeepingFile diff --git a/R/MetaDataDiagnostics.R b/R/MetaDataDiagnostics.R index afa82ccc9..9c9b29138 100644 --- a/R/MetaDataDiagnostics.R +++ b/R/MetaDataDiagnostics.R @@ -166,8 +166,8 @@ getVocabularyVersion <- function(connection, vocabularyDatabaseSchema) { snakeCaseToCamelCase = TRUE ) %>% dplyr::tibble() %>% - dplyr::rename(vocabularyVersion = .data$vocabularyVersion) %>% - dplyr::pull(.data$vocabularyVersion) %>% + dplyr::rename(vocabularyVersion = vocabularyVersion) %>% + dplyr::pull(vocabularyVersion) %>% unique() # Edge case where a CDM has more than a single entry diff --git a/R/Private.R b/R/Private.R index ef279e325..a1ed136e4 100644 --- a/R/Private.R +++ b/R/Private.R @@ -129,7 +129,7 @@ makeDataExportable <- function(x, if ("cohortDefinitionId" %in% colnames(x)) { x <- x %>% - dplyr::rename(cohortId = .data$cohortDefinitionId) + dplyr::rename(cohortId = cohortDefinitionId) } resultsDataModel <- getResultsDataModelSpecifications() @@ -140,29 +140,29 @@ makeDataExportable <- function(x, } fieldsInDataModel <- resultsDataModel %>% - dplyr::filter(.data$tableName == !!tableName) %>% - dplyr::pull(.data$columnName) %>% + dplyr::filter(tableName == !!tableName) %>% + dplyr::pull(columnName) %>% SqlRender::snakeCaseToCamelCase() %>% unique() requiredFieldsInDataModel <- resultsDataModel %>% - dplyr::filter(.data$tableName == !!tableName) %>% - dplyr::filter(.data$isRequired == "Yes") %>% - dplyr::pull(.data$columnName) %>% + dplyr::filter(tableName == !!tableName) %>% + dplyr::filter(isRequired == "Yes") %>% + dplyr::pull(columnName) %>% SqlRender::snakeCaseToCamelCase() %>% unique() primaryKeyInDataModel <- resultsDataModel %>% - dplyr::filter(.data$tableName == !!tableName) %>% - dplyr::filter(.data$primaryKey == "Yes") %>% - dplyr::pull(.data$columnName) %>% + dplyr::filter(tableName == !!tableName) %>% + dplyr::filter(primaryKey == "Yes") %>% + dplyr::pull(columnName) %>% SqlRender::snakeCaseToCamelCase() %>% unique() columnsToApplyMinCellValue <- resultsDataModel %>% - dplyr::filter(.data$tableName == !!tableName) %>% - dplyr::filter(.data$minCellCount == "Yes") %>% - dplyr::pull(.data$columnName) %>% + dplyr::filter(tableName == !!tableName) %>% + dplyr::filter(minCellCount == "Yes") %>% + dplyr::pull(columnName) %>% SqlRender::snakeCaseToCamelCase() %>% unique() diff --git a/R/ResultsDataModel.R b/R/ResultsDataModel.R index 701ae8681..90b50118f 100644 --- a/R/ResultsDataModel.R +++ b/R/ResultsDataModel.R @@ -37,8 +37,8 @@ getResultsDataModelSpecifications <- function() { #' @export getDefaultVocabularyTableNames <- function() { getResultsDataModelSpecifications() %>% - dplyr::filter(.data$isVocabularyTable == "Yes") %>% - dplyr::pull(.data$tableName) %>% + dplyr::filter(isVocabularyTable == "Yes") %>% + dplyr::pull(tableName) %>% unique() %>% sort() %>% SqlRender::snakeCaseToCamelCase() @@ -62,7 +62,7 @@ fixTableMetadataForBackwardCompatibility <- function(table, tableName) { } if ("referent_concept_id" %in% colnames(table)) { table <- table %>% - dplyr::select(-.data$referent_concept_id) + dplyr::select(-referent_concept_id) } } if (tableName %in% c("covariate_value", "temporal_covariate_value")) { @@ -90,18 +90,18 @@ checkFixColumnNames <- observeredNames <- colnames(table)[order(colnames(table))] tableSpecs <- specifications %>% - dplyr::filter(.data$tableName == !!tableName) + dplyr::filter(tableName == !!tableName) optionalNames <- tableSpecs %>% - dplyr::filter(.data$optional == "Yes") %>% - dplyr::select(.data$columnName) + dplyr::filter(optional == "Yes") %>% + dplyr::select(columnName) expectedNames <- tableSpecs %>% - dplyr::select(.data$columnName) %>% - dplyr::anti_join(dplyr::filter(optionalNames, !.data$columnName %in% observeredNames), + dplyr::select(columnName) %>% + dplyr::anti_join(dplyr::filter(optionalNames, !columnName %in% observeredNames), by = "columnName" ) %>% - dplyr::arrange(.data$columnName) %>% + dplyr::arrange(columnName) %>% dplyr::pull() if (!checkmate::testNames(observeredNames, must.include = expectedNames)) { @@ -131,7 +131,7 @@ checkAndFixDataTypes <- zipFileName, specifications = getResultsDataModelSpecifications()) { tableSpecs <- specifications %>% - filter(.data$tableName == !!tableName) + filter(tableName == !!tableName) observedTypes <- sapply(table, class) for (i in 1:length(observedTypes)) { @@ -205,9 +205,9 @@ checkAndFixDuplicateRows <- zipFileName, specifications = getResultsDataModelSpecifications()) { primaryKeys <- specifications %>% - dplyr::filter(.data$tableName == !!tableName & - .data$primaryKey == "Yes") %>% - dplyr::select(.data$columnName) %>% + dplyr::filter(tableName == !!tableName & + primaryKey == "Yes") %>% + dplyr::select(columnName) %>% dplyr::pull() duplicatedRows <- duplicated(table[, primaryKeys]) if (any(duplicatedRows)) { @@ -232,9 +232,9 @@ appendNewRows <- specifications = getResultsDataModelSpecifications()) { if (nrow(data) > 0) { primaryKeys <- specifications %>% - dplyr::filter(.data$tableName == !!tableName & - .data$primaryKey == "Yes") %>% - dplyr::select(.data$columnName) %>% + dplyr::filter(tableName == !!tableName & + primaryKey == "Yes") %>% + dplyr::select(columnName) %>% dplyr::pull() newData <- newData %>% dplyr::anti_join(data, by = primaryKeys) @@ -359,9 +359,9 @@ uploadResults <- function(connectionDetails, ParallelLogger::logInfo("Uploading table ", tableName) primaryKey <- specifications %>% - filter(.data$tableName == !!tableName & - .data$primaryKey == "Yes") %>% - select(.data$columnName) %>% + filter(tableName == !!tableName & + primaryKey == "Yes") %>% + select(columnName) %>% pull() if (purgeSiteDataBeforeUploading && @@ -431,11 +431,11 @@ uploadResults <- function(connectionDetails, # Primary key fields cannot be NULL, so for some tables convert NAs to empty or zero: toEmpty <- specifications %>% filter( - .data$tableName == env$tableName & - .data$emptyIsNa == "No" & - grepl("varchar", .data$dataType) + tableName == env$tableName & + emptyIsNa == "No" & + grepl("varchar", dataType) ) %>% - select(.data$columnName) %>% + select(columnName) %>% pull() if (length(toEmpty) > 0) { chunk <- chunk %>% @@ -444,11 +444,11 @@ uploadResults <- function(connectionDetails, tozero <- specifications %>% filter( - .data$tableName == env$tableName & - .data$emptyIsNa == "No" & - .data$dataType %in% c("int", "bigint", "float") + tableName == env$tableName & + emptyIsNa == "No" & + dataType %in% c("int", "bigint", "float") ) %>% - select(.data$columnName) %>% + select(columnName) %>% pull() if (length(tozero) > 0) { chunk <- chunk %>% @@ -643,4 +643,4 @@ getDataMigrator <- function(connectionDetails, databaseSchema, tablePrefix = "") tablePrefix = tablePrefix, migrationPath = "migrations", packageName = utils::packageName()) -} \ No newline at end of file +} diff --git a/R/RunDiagnostics.R b/R/RunDiagnostics.R index cd00973f3..c2e2b1236 100644 --- a/R/RunDiagnostics.R +++ b/R/RunDiagnostics.R @@ -211,21 +211,21 @@ executeDiagnostics <- function(cohortDefinitionSet, incremental = FALSE, incrementalFolder = file.path(exportFolder, "incremental")) { # collect arguments that were passed to cohort diagnostics at initiation - argumentsAtDiagnosticsInitiation <- formals(executeDiagnostics) - argumentsAtDiagnosticsInitiationJson <- + callingArgs <- formals(executeDiagnostics) + callingArgsJson <- list( - runInclusionStatistics = argumentsAtDiagnosticsInitiation$runInclusionStatistics, - runIncludedSourceConcepts = argumentsAtDiagnosticsInitiation$runIncludedSourceConcepts, - runOrphanConcepts = argumentsAtDiagnosticsInitiation$runOrphanConcepts, - runTimeSeries = argumentsAtDiagnosticsInitiation$runTimeSeries, - runVisitContext = argumentsAtDiagnosticsInitiation$runVisitContext, - runBreakdownIndexEvents = argumentsAtDiagnosticsInitiation$runBreakdownIndexEvents, - runIncidenceRate = argumentsAtDiagnosticsInitiation$runIncidenceRate, - runTemporalCohortCharacterization = argumentsAtDiagnosticsInitiation$runTemporalCohortCharacterization, - minCellCount = argumentsAtDiagnosticsInitiation$minCellCount, - minCharacterizationMean = argumentsAtDiagnosticsInitiation$minCharacterizationMean, - incremental = argumentsAtDiagnosticsInitiation$incremental, - temporalCovariateSettings = argumentsAtDiagnosticsInitiation$temporalCovariateSettings + runInclusionStatistics = callingArgs$runInclusionStatistics, + runIncludedSourceConcepts = callingArgs$runIncludedSourceConcepts, + runOrphanConcepts = callingArgs$runOrphanConcepts, + runTimeSeries = callingArgs$runTimeSeries, + runVisitContext = callingArgs$runVisitContext, + runBreakdownIndexEvents = callingArgs$runBreakdownIndexEvents, + runIncidenceRate = callingArgs$runIncidenceRate, + runTemporalCohortCharacterization = callingArgs$runTemporalCohortCharacterization, + minCellCount = callingArgs$minCellCount, + minCharacterizationMean = callingArgs$minCharacterizationMean, + incremental = callingArgs$incremental, + temporalCovariateSettings = callingArgs$temporalCovariateSettings ) %>% RJSONIO::toJSON(digits = 23, pretty = TRUE) @@ -356,18 +356,44 @@ executeDiagnostics <- function(cohortDefinitionSet, ) } if (runTemporalCohortCharacterization) { - checkmate::assert_class(x = temporalCovariateSettings, - classes = c("covariateSettings")) + if (class(temporalCovariateSettings) == "covariateSettings") { + temporalCovariateSettings <- list(temporalCovariateSettings) + } + # All temporal covariate settings objects must be covariateSettings + checkmate::assert_true(all(lapply(temporalCovariateSettings, class) == c("covariateSettings")), add = errorMessage) + + requiredCharacterisationSettings <- c("DemographicsGender", "DemographicsAgeGroup", "DemographicsRace", + "DemographicsEthnicity", "DemographicsIndexYear", "DemographicsIndexMonth", + "ConditionEraGroupOverlap", "DrugEraGroupOverlap", "CharlsonIndex", + "Chads2", "Chads2Vasc") + presentSettings <- temporalCovariateSettings[[1]][requiredCharacterisationSettings] + if (!all(unlist(presentSettings))) { + warning( + "For cohort charcterization to display standardized results the following covariates must be present in your temporalCovariateSettings: \n\n", + paste(requiredCharacterisationSettings, collapse = ", ")) + } + + requiredTimeDistributionSettings <- c("DemographicsPriorObservationTime", + "DemographicsPostObservationTime", + "DemographicsTimeInCohort") + + presentSettings <- temporalCovariateSettings[[1]][requiredTimeDistributionSettings] + if (!all(unlist(presentSettings))) { + warning( + "For time distributions diagnostics to display standardized results the following covariates must be present in your temporalCovariateSettings: \n\n", + paste(requiredTimeDistributionSettings, collapse = ", ")) + } + # forcefully set ConditionEraGroupStart and drugEraGroupStart to NULL # because of known bug in FeatureExtraction. https://github.com/OHDSI/FeatureExtraction/issues/144 - temporalCovariateSettings$ConditionEraGroupStart <- NULL - temporalCovariateSettings$DrugEraGroupStart <- NULL + temporalCovariateSettings[[1]]$ConditionEraGroupStart <- NULL + temporalCovariateSettings[[1]]$DrugEraGroupStart <- NULL - checkmate::assert_integerish(x = temporalCovariateSettings$temporalStartDays, + checkmate::assert_integerish(x = temporalCovariateSettings[[1]]$temporalStartDays, any.missing = FALSE, min.len = 1, add = errorMessage) - checkmate::assert_integerish(x = temporalCovariateSettings$temporalEndDays, + checkmate::assert_integerish(x = temporalCovariateSettings[[1]]$temporalEndDays, any.missing = FALSE, min.len = 1, add = errorMessage) @@ -385,10 +411,10 @@ executeDiagnostics <- function(cohortDefinitionSet, c(-9999, 9999)) for (p1 in requiredTemporalPairs) { found <- FALSE - for (i in 1:length(temporalCovariateSettings$temporalStartDays)) { + for (i in 1:length(temporalCovariateSettings[[1]]$temporalStartDays)) { p2 <- c( - temporalCovariateSettings$temporalStartDays[i], - temporalCovariateSettings$temporalEndDays[i] + temporalCovariateSettings[[1]]$temporalStartDays[i], + temporalCovariateSettings[[1]]$temporalEndDays[i] ) if (p2[1] == p1[1] & p2[2] == p1[2]) { @@ -398,39 +424,14 @@ executeDiagnostics <- function(cohortDefinitionSet, } if (!found) { - temporalCovariateSettings$temporalStartDays <- - c(temporalCovariateSettings$temporalStartDays, p1[1]) - temporalCovariateSettings$temporalEndDays <- - c(temporalCovariateSettings$temporalEndDays, p1[2]) + temporalCovariateSettings[[1]]$temporalStartDays <- + c(temporalCovariateSettings[[1]]$temporalStartDays, p1[1]) + temporalCovariateSettings[[1]]$temporalEndDays <- + c(temporalCovariateSettings[[1]]$temporalEndDays, p1[2]) } } } - if (runTemporalCohortCharacterization) { - requiredCharacterisationSettings <- c("DemographicsGender", "DemographicsAgeGroup", "DemographicsRace", - "DemographicsEthnicity", "DemographicsIndexYear", "DemographicsIndexMonth", - "ConditionEraGroupOverlap", "DrugEraGroupOverlap", "CharlsonIndex", - "Chads2", "Chads2Vasc") - - presentSettings <- temporalCovariateSettings[requiredCharacterisationSettings] - if (!all(unlist(presentSettings))) { - warning( - "For cohort charcterization to display standardized results the following covariates must be present in your temporalCovariateSettings: \n\n", - paste(requiredCharacterisationSettings, collapse = ", ")) - } - - requiredTimeDistributionSettings <- c("DemographicsPriorObservationTime", - "DemographicsPostObservationTime", - "DemographicsTimeInCohort") - - presentSettings <- temporalCovariateSettings[requiredTimeDistributionSettings] - if (!all(unlist(presentSettings))) { - warning( - "For time distributions diagnostics to display standardized results the following covariates must be present in your temporalCovariateSettings: \n\n", - paste(requiredTimeDistributionSettings, collapse = ", ")) - } - } - checkmate::reportAssertions(collection = errorMessage) if (!is.null(cohortIds)) { cohortDefinitionSet <- cohortDefinitionSet %>% dplyr::filter(cohortId %in% cohortIds) @@ -443,15 +444,15 @@ executeDiagnostics <- function(cohortDefinitionSet, sort() cohortTableColumnNamesExpected <- getResultsDataModelSpecifications() %>% - dplyr::filter(.data$tableName == "cohort") %>% - dplyr::pull(.data$columnName) %>% + dplyr::filter(tableName == "cohort") %>% + dplyr::pull(columnName) %>% SqlRender::snakeCaseToCamelCase() %>% sort() cohortTableColumnNamesRequired <- getResultsDataModelSpecifications() %>% - dplyr::filter(.data$tableName == "cohort") %>% - dplyr::filter(.data$isRequired == "Yes") %>% - dplyr::pull(.data$columnName) %>% + dplyr::filter(tableName == "cohort") %>% + dplyr::filter(isRequired == "Yes") %>% + dplyr::pull(columnName) %>% SqlRender::snakeCaseToCamelCase() %>% sort() @@ -603,8 +604,8 @@ executeDiagnostics <- function(cohortDefinitionSet, if (nrow(cohortCounts) > 0) { instantiatedCohorts <- cohortCounts %>% - dplyr::filter(.data$cohortEntries > 0) %>% - dplyr::pull(.data$cohortId) + dplyr::filter(cohortEntries > 0) %>% + dplyr::pull(cohortId) ParallelLogger::logInfo( sprintf( "Found %s of %s (%1.2f%%) submitted cohorts instantiated. ", @@ -771,7 +772,7 @@ executeDiagnostics <- function(cohortDefinitionSet, tempEmulationSchema = tempEmulationSchema, cohortTable = cohortTable, cohortDefinitionSet = cohortDefinitionSet, - temporalCovariateSettings = temporalCovariateSettings, + temporalCovariateSettings = temporalCovariateSettings[[1]], minCellCount = minCellCount, recordKeepingFile = recordKeepingFile, incremental = incremental @@ -926,7 +927,7 @@ executeDiagnostics <- function(cohortDefinitionSet, # 3 packageDependencySnapShotJson, # 4 - argumentsAtDiagnosticsInitiationJson, + callingArgsJson, # 5 as.character(R.Version()$version.string), # 6 diff --git a/R/Shiny.R b/R/Shiny.R index cce7b2874..fa4031824 100644 --- a/R/Shiny.R +++ b/R/Shiny.R @@ -136,6 +136,7 @@ launchDiagnosticsExplorer <- function(sqliteDbPath = "MergedCohortDiagnosticsDat "markdownInput", "markdown", "jsonlite", + "ggh4x", "yaml")) appDir <- @@ -254,54 +255,6 @@ createDiagnosticsExplorerZip <- function(outputZipfile = file.path(getwd(), "Dia DatabaseConnector::createZipFile(outputZipfile, file.path(tmpDir, "DiagnosticsExplorer"), rootFolder = tmpDir) } - -#' Launch the CohortExplorer Shiny app -#' -#' @template CohortTable -#' -#' @template CdmDatabaseSchema -#' -#' @param connectionDetails An object of type \code{connectionDetails} as created using the -#' \code{\link[DatabaseConnector]{createConnectionDetails}} function in the -#' DatabaseConnector package. -#' @param cohortId The ID of the cohort. -#' @param sampleSize Number of subjects to sample from the cohort. Ignored if subjectIds is specified. -#' @param subjectIds A vector of subject IDs to view. -#' -#' @details -#' Launches a Shiny app that allows the user to explore a cohort of interest. -#' -#' @export -launchCohortExplorer <- function(connectionDetails, - cdmDatabaseSchema, - cohortDatabaseSchema, - cohortTable, - cohortId, - sampleSize = 100, - subjectIds = NULL) { - ensure_installed(c("shiny", - "DT", - "plotly", - "RColorBrewer", - "ggplot2", - "magrittr")) - - .GlobalEnv$shinySettings <- - list( - connectionDetails = connectionDetails, - cdmDatabaseSchema = cdmDatabaseSchema, - cohortDatabaseSchema = cohortDatabaseSchema, - cohortTable = cohortTable, - cohortDefinitionId = cohortId, - sampleSize = sampleSize, - subjectIds = subjectIds - ) - on.exit(rm("shinySettings", envir = .GlobalEnv)) - appDir <- - system.file("shiny", "CohortExplorer", package = utils::packageName()) - shiny::runApp(appDir) -} - ensure_installed <- function(pkgs) { notInstalled <- pkgs[!(pkgs %in% rownames(installed.packages()))] diff --git a/R/TimeSeries.R b/R/TimeSeries.R index 598f54c80..f35c23e33 100644 --- a/R/TimeSeries.R +++ b/R/TimeSeries.R @@ -98,7 +98,7 @@ runCohortTimeSeriesDiagnostics <- function(connectionDetails = NULL, ) if (resultsInAndromeda$cohortCount %>% dplyr::summarise(n = dplyr::n()) %>% - dplyr::pull(.data$n) == 0) { + dplyr::pull(n) == 0) { warning("Please check if cohorts are instantiated. Exiting cohort time series.") return(NULL) } @@ -124,7 +124,7 @@ runCohortTimeSeriesDiagnostics <- function(connectionDetails = NULL, by = clock::duration_months(3) ) ) %>% - dplyr::mutate(periodEnd = clock::add_months(x = .data$periodBegin, n = 3) - 1) %>% + dplyr::mutate(periodEnd = clock::add_months(x = periodBegin, n = 3) - 1) %>% dplyr::mutate(calendarInterval = "q") calendarMonth <- @@ -135,7 +135,7 @@ runCohortTimeSeriesDiagnostics <- function(connectionDetails = NULL, by = clock::duration_months(1) ) ) %>% - dplyr::mutate(periodEnd = clock::add_months(x = .data$periodBegin, n = 1) - 1) %>% + dplyr::mutate(periodEnd = clock::add_months(x = periodBegin, n = 1) - 1) %>% dplyr::mutate(calendarInterval = "m") calendarYear <- @@ -146,7 +146,7 @@ runCohortTimeSeriesDiagnostics <- function(connectionDetails = NULL, by = clock::duration_years(1) ) ) %>% - dplyr::mutate(periodEnd = clock::add_years(x = .data$periodBegin, n = 1) - 1) %>% + dplyr::mutate(periodEnd = clock::add_years(x = periodBegin, n = 1) - 1) %>% dplyr::mutate(calendarInterval = "y") timeSeriesDateRange <- dplyr::tibble( @@ -163,7 +163,7 @@ runCohortTimeSeriesDiagnostics <- function(connectionDetails = NULL, timeSeriesDateRange ) %>% # calendarWeek dplyr::distinct() %>% - dplyr::arrange(.data$periodBegin, .data$periodEnd, .data$calendarInterval) %>% + dplyr::arrange(periodBegin, periodEnd, calendarInterval) %>% dplyr::mutate(timeId = dplyr::row_number()) ParallelLogger::logTrace(" - Inserting calendar periods") @@ -455,17 +455,17 @@ runCohortTimeSeriesDiagnostics <- function(connectionDetails = NULL, by = c("timeId") ) %>% dplyr::arrange( - .data$cohortId, - .data$periodBegin, - .data$calendarInterval, - .data$seriesType, - .data$periodBegin + cohortId, + periodBegin, + calendarInterval, + seriesType, + periodBegin ) %>% - dplyr::select(-.data$timeId) %>% + dplyr::select(-timeId) %>% dplyr::mutate(ageGroup = dplyr::if_else( - condition = is.na(.data$ageGroup), - true = as.character(.data$ageGroup), - false = paste(10 * .data$ageGroup, 10 * .data$ageGroup + 9, sep = "-") + condition = is.na(ageGroup), + true = as.character(ageGroup), + false = paste(10 * ageGroup, 10 * ageGroup + 9, sep = "-") )) resultsInAndromeda$calendarPeriods <- NULL @@ -530,12 +530,12 @@ executeTimeSeriesDiagnostics <- function(connection, if (runCohortTimeSeries & nrow(cohortDefinitionSet) > 0) { subset <- subsetToRequiredCohorts( cohorts = cohortDefinitionSet %>% - dplyr::filter(.data$cohortId %in% instantiatedCohorts), + dplyr::filter(cohortId %in% instantiatedCohorts), task = "runCohortTimeSeries", incremental = incremental, recordKeepingFile = recordKeepingFile ) %>% - dplyr::arrange(.data$cohortId) + dplyr::arrange(cohortId) if (nrow(subset) > 0) { if (incremental && diff --git a/R/VisitContext.R b/R/VisitContext.R index f9910c9a1..dcd90c0a2 100644 --- a/R/VisitContext.R +++ b/R/VisitContext.R @@ -107,7 +107,7 @@ executeVisitContextDiagnostics <- function(connection, ParallelLogger::logInfo("Retrieving visit context for index dates") subset <- subsetToRequiredCohorts( cohorts = cohorts %>% - dplyr::filter(.data$cohortId %in% instantiatedCohorts), + dplyr::filter(cohortId %in% instantiatedCohorts), task = "runVisitContext", incremental = incremental, recordKeepingFile = recordKeepingFile diff --git a/docs/404.html b/docs/404.html index 4dea5205a..653fa5c34 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/articles/CreatingAStudyPackage.html b/docs/articles/CreatingAStudyPackage.html index 1f751c868..d7205370b 100644 --- a/docs/articles/CreatingAStudyPackage.html +++ b/docs/articles/CreatingAStudyPackage.html @@ -33,7 +33,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 @@ -97,7 +97,7 @@

Creating a study package

Gowtham A. Rao

-

2022-10-12

+

2022-12-06

Source: vignettes/CreatingAStudyPackage.Rmd diff --git a/docs/articles/DatabaseModeInDiagnosticsExplorer.html b/docs/articles/DatabaseModeInDiagnosticsExplorer.html index 0ac30e8d2..c0e4afcb6 100644 --- a/docs/articles/DatabaseModeInDiagnosticsExplorer.html +++ b/docs/articles/DatabaseModeInDiagnosticsExplorer.html @@ -33,7 +33,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 @@ -97,7 +97,7 @@

Database mode in Diagnostics Explorer

Gowtham Rao

-

2022-10-12

+

2022-12-06

Source: vignettes/DatabaseModeInDiagnosticsExplorer.Rmd diff --git a/docs/articles/RunningCohortDiagnostics.html b/docs/articles/RunningCohortDiagnostics.html index 1937caa4f..19b970613 100644 --- a/docs/articles/RunningCohortDiagnostics.html +++ b/docs/articles/RunningCohortDiagnostics.html @@ -33,7 +33,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 @@ -97,7 +97,7 @@

Running Cohort Diagnostics

Gowtham Rao and James P. Gilbert

-

2022-10-12

+

2022-12-06

Source: vignettes/RunningCohortDiagnostics.Rmd diff --git a/docs/articles/ViewingResultsUsingDiagnosticsExplorer.html b/docs/articles/ViewingResultsUsingDiagnosticsExplorer.html index 555a07e39..50bf23ffe 100644 --- a/docs/articles/ViewingResultsUsingDiagnosticsExplorer.html +++ b/docs/articles/ViewingResultsUsingDiagnosticsExplorer.html @@ -33,7 +33,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 @@ -97,7 +97,7 @@

Viewing results using Diagnostics Explorer

Gowtham Rao

-

2022-10-12

+

2022-12-06

Source: vignettes/ViewingResultsUsingDiagnosticsExplorer.Rmd diff --git a/docs/articles/WhatIsCohortDiagnostics.html b/docs/articles/WhatIsCohortDiagnostics.html index a7a73b533..2e10d13f1 100644 --- a/docs/articles/WhatIsCohortDiagnostics.html +++ b/docs/articles/WhatIsCohortDiagnostics.html @@ -33,7 +33,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 @@ -97,7 +97,7 @@

What is Cohort Diagnostics?

Gowtham Rao

-

2022-10-12

+

2022-12-06

Source: vignettes/WhatIsCohortDiagnostics.Rmd diff --git a/docs/articles/index.html b/docs/articles/index.html index 67b99c042..561bf2513 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/authors.html b/docs/authors.html index cc76bc794..7d9c1e724 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/index.html b/docs/index.html index 9c261ac33..2bb5d9bcd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -39,7 +39,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/news/index.html b/docs/news/index.html index cb5562f3b..a6b61a274 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 @@ -72,6 +72,15 @@

Changelog

Source: NEWS.md +
+ +

Changes:

+
  1. Removed CohortExplorer app as it’s now part of a new package.

  2. +
  3. Added support for custom FeatureExtraction features

  4. +

Bug Fixes:

+
  1. Fixed error when checking for cdm_source table

  2. +
  3. Removal of .data$ usage across package to fix tidyselect warning

  4. +

Changes:

@@ -82,6 +91,7 @@
diff --git a/docs/reference/checkInputFileEncoding.html b/docs/reference/checkInputFileEncoding.html index 98e0aeac4..188894a1a 100644 --- a/docs/reference/checkInputFileEncoding.html +++ b/docs/reference/checkInputFileEncoding.html @@ -18,7 +18,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/createDiagnosticsExplorerZip.html b/docs/reference/createDiagnosticsExplorerZip.html index 78b01340a..c86032d9d 100644 --- a/docs/reference/createDiagnosticsExplorerZip.html +++ b/docs/reference/createDiagnosticsExplorerZip.html @@ -20,7 +20,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/createMergedResultsFile.html b/docs/reference/createMergedResultsFile.html index 1743dcec3..986542882 100644 --- a/docs/reference/createMergedResultsFile.html +++ b/docs/reference/createMergedResultsFile.html @@ -19,7 +19,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/createResultsDataModel.html b/docs/reference/createResultsDataModel.html index d5a6c02b4..bd171264b 100644 --- a/docs/reference/createResultsDataModel.html +++ b/docs/reference/createResultsDataModel.html @@ -17,7 +17,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 @@ -79,31 +79,19 @@

Create the results data model tables on a database server.

createResultsDataModel(
-  connection = NULL,
   connectionDetails = NULL,
-  schema,
+  databaseSchema,
   tablePrefix = ""
 )

Arguments

-
connection
-

An object of type connection as created using the -connect function in the -DatabaseConnector package. Can be left NULL if connectionDetails -is provided, in which case a new connection will be opened at the start -of the function, and closed when the function finishes.

+
connectionDetails
+

DatabaseConnector connectionDetails instance @seealso[DatabaseConnector::createConnectionDetails]

-
connectionDetails
-

An object of type connectionDetails as created using the -createConnectionDetails function in the -DatabaseConnector package. Can be left NULL if connection is -provided.

- - -
schema
+
databaseSchema

The schema on the postgres server where the tables will be created.

diff --git a/docs/reference/executeDiagnostics.html b/docs/reference/executeDiagnostics.html index f5a1b3da6..5da955790 100644 --- a/docs/reference/executeDiagnostics.html +++ b/docs/reference/executeDiagnostics.html @@ -22,7 +22,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1
diff --git a/docs/reference/getCdmDataSourceInformation.html b/docs/reference/getCdmDataSourceInformation.html index d8d12aac4..e90a48a1a 100644 --- a/docs/reference/getCdmDataSourceInformation.html +++ b/docs/reference/getCdmDataSourceInformation.html @@ -18,7 +18,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/getCohortCounts.html b/docs/reference/getCohortCounts.html index 6c9799fa8..cae29104e 100644 --- a/docs/reference/getCohortCounts.html +++ b/docs/reference/getCohortCounts.html @@ -17,7 +17,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/getDataMigrator.html b/docs/reference/getDataMigrator.html new file mode 100644 index 000000000..eb9ed6fb4 --- /dev/null +++ b/docs/reference/getDataMigrator.html @@ -0,0 +1,128 @@ + +Get database migrations instance — getDataMigrator • CohortDiagnostics + + +
+
+ + + +
+
+ + +
+

Returns ResultModelManager DataMigrationsManager instance.

+
+ +
+
getDataMigrator(connectionDetails, databaseSchema, tablePrefix = "")
+
+ +
+

Arguments

+
connectionDetails
+

DatabaseConnector connection details object

+ + +
databaseSchema
+

String schema where database schema lives

+ + +
tablePrefix
+

(Optional) Use if a table prefix is used before table names (e.g. "cd_")

+ +
+
+

Value

+ + +

Instance of ResultModelManager::DataMigrationManager that has interface for converting existing data models

+
+ +
+ +
+ + +
+ + + + + + + + diff --git a/docs/reference/getDefaultCovariateSettings.html b/docs/reference/getDefaultCovariateSettings.html new file mode 100644 index 000000000..cb45443c6 --- /dev/null +++ b/docs/reference/getDefaultCovariateSettings.html @@ -0,0 +1,108 @@ + +Get default covariate settings — getDefaultCovariateSettings • CohortDiagnostics + + +
+
+ + + +
+
+ + +
+

Default covariate settings for cohort diagnostics execution

+
+ +
+
getDefaultCovariateSettings()
+
+ + +
+ +
+ + +
+ + + + + + + + diff --git a/docs/reference/getDefaultVocabularyTableNames.html b/docs/reference/getDefaultVocabularyTableNames.html index 5b594806b..8c736f259 100644 --- a/docs/reference/getDefaultVocabularyTableNames.html +++ b/docs/reference/getDefaultVocabularyTableNames.html @@ -17,7 +17,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/getResultsDataModelSpecifications.html b/docs/reference/getResultsDataModelSpecifications.html index f162b56b3..4e0bcae52 100644 --- a/docs/reference/getResultsDataModelSpecifications.html +++ b/docs/reference/getResultsDataModelSpecifications.html @@ -17,7 +17,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/index.html b/docs/reference/index.html index 6602ffffd..d5c87ca1f 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 @@ -103,6 +103,10 @@

All functions getCohortCounts()

Count the cohort(s)

+ +

getDataMigrator()

+ +

Get database migrations instance

getDefaultCovariateSettings()

@@ -115,14 +119,14 @@

All functions getResultsDataModelSpecifications()

Get specifications for Cohort Diagnostics results data model

- -

launchCohortExplorer()

- -

Launch the CohortExplorer Shiny app

launchDiagnosticsExplorer()

Launch the Diagnostics Explorer Shiny app

+ +

migrateDataModel()

+ +

Migrate Data model

runCohortRelationshipDiagnostics()

diff --git a/docs/reference/launchDiagnosticsExplorer.html b/docs/reference/launchDiagnosticsExplorer.html index 54a143094..8db5887fa 100644 --- a/docs/reference/launchDiagnosticsExplorer.html +++ b/docs/reference/launchDiagnosticsExplorer.html @@ -17,7 +17,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/migrateDataModel.html b/docs/reference/migrateDataModel.html new file mode 100644 index 000000000..f662c1c13 --- /dev/null +++ b/docs/reference/migrateDataModel.html @@ -0,0 +1,126 @@ + +Migrate Data model — migrateDataModel • CohortDiagnostics + + +
+
+ + + +
+
+ + +
+

Migrate data from current state to next state

+

It is strongly advised that you have a backup of all data (either sqlite files, a backup database (in the case you +are using a postgres backend) or have kept the csv/zip files from your data generation.

+
+ +
+
migrateDataModel(connectionDetails, databaseSchema, tablePrefix = "")
+
+ +
+

Arguments

+
connectionDetails
+

DatabaseConnector connection details object

+ + +
databaseSchema
+

String schema where database schema lives

+ + +
tablePrefix
+

(Optional) Use if a table prefix is used before table names (e.g. "cd_")

+ +
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.5.

+
+ +
+ + + + + + + + diff --git a/docs/reference/runCohortRelationshipDiagnostics.html b/docs/reference/runCohortRelationshipDiagnostics.html index f4ec5b69b..a6cdb1028 100644 --- a/docs/reference/runCohortRelationshipDiagnostics.html +++ b/docs/reference/runCohortRelationshipDiagnostics.html @@ -18,7 +18,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/runCohortTimeSeriesDiagnostics.html b/docs/reference/runCohortTimeSeriesDiagnostics.html index 3873c1c97..7cb258d32 100644 --- a/docs/reference/runCohortTimeSeriesDiagnostics.html +++ b/docs/reference/runCohortTimeSeriesDiagnostics.html @@ -25,7 +25,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/takepackageDependencySnapshot.html b/docs/reference/takepackageDependencySnapshot.html index bb2aa3a40..332056fe2 100644 --- a/docs/reference/takepackageDependencySnapshot.html +++ b/docs/reference/takepackageDependencySnapshot.html @@ -17,7 +17,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 diff --git a/docs/reference/timeExecution.html b/docs/reference/timeExecution.html new file mode 100644 index 000000000..3453e1e6b --- /dev/null +++ b/docs/reference/timeExecution.html @@ -0,0 +1,116 @@ + +Internal utility function for logging execution of variables — timeExecution • CohortDiagnostics + + +
+
+ + + +
+
+ + +
+

Internal utility function for logging execution of variables

+
+ +
+
timeExecution(
+  exportFolder,
+  taskName,
+  cohortIds = NULL,
+  parent = NULL,
+  start = NA,
+  execTime = NA,
+  expr = NULL
+)
+
+ + +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.5.

+
+ +
+ + + + + + + + diff --git a/docs/reference/uploadResults.html b/docs/reference/uploadResults.html index 134cd409a..cd3b0e2c4 100644 --- a/docs/reference/uploadResults.html +++ b/docs/reference/uploadResults.html @@ -19,7 +19,7 @@ CohortDiagnostics - 3.1.0 + 3.1.1 @@ -83,7 +83,7 @@

Upload results to the database server.

uploadResults(
-  connectionDetails = NULL,
+  connectionDetails,
   schema,
   zipFileName,
   forceOverWriteOfSpecifications = FALSE,
diff --git a/docs/sitemap.xml b/docs/sitemap.xml
index 44b0e25d2..c353684ce 100644
--- a/docs/sitemap.xml
+++ b/docs/sitemap.xml
@@ -144,6 +144,9 @@
   
     /reference/getCovariateValueResult.html
   
+  
+    /reference/getDataMigrator.html
+  
   
     /reference/getDatabaseReference.html
   
@@ -219,6 +222,9 @@
   
     /reference/loadCohortsFromPackage.html
   
+  
+    /reference/migrateDataModel.html
+  
   
     /reference/plotCohortComparisonStandardizedDifference.html
   
diff --git a/extras/CohortDiagnostics.pdf b/extras/CohortDiagnostics.pdf
index b38c83891..289499bd8 100644
Binary files a/extras/CohortDiagnostics.pdf and b/extras/CohortDiagnostics.pdf differ
diff --git a/extras/EditIncrementalLogDiagnostics.R b/extras/EditIncrementalLogDiagnostics.R
index e01e56a74..b8e183126 100644
--- a/extras/EditIncrementalLogDiagnostics.R
+++ b/extras/EditIncrementalLogDiagnostics.R
@@ -31,7 +31,7 @@ for (i in (1:length(listFiles))) {
     col_types = readr::cols(),
     guess_max = min(1e7)
   ) %>%
-    dplyr::filter(!.data$task %in% tasksToRemove) %>%
+    dplyr::filter(!task %in% tasksToRemove) %>%
     readr::write_excel_csv(file = listFiles[[i]])
 }
 
diff --git a/extras/ExampleOfHowToCreateStudyPackageWithHydra.R b/extras/ExampleOfHowToCreateStudyPackageWithHydra.R
index 0e0ff166f..17c770ae0 100644
--- a/extras/ExampleOfHowToCreateStudyPackageWithHydra.R
+++ b/extras/ExampleOfHowToCreateStudyPackageWithHydra.R
@@ -44,7 +44,7 @@ cohortIds <- c(22040,
 ################# end of user input ##############
 webApiCohorts <- ROhdsiWebApi::getCohortDefinitionsMetaData(baseUrl = baseUrl)
 studyCohorts <-  webApiCohorts %>%
-        dplyr::filter(.data$id %in% cohortIds)
+        dplyr::filter(id %in% cohortIds)
 
 # compile them into a data table
 cohortDefinitionsArray <- list()
diff --git a/extras/PackageMaintenance.R b/extras/PackageMaintenance.R
index 207ded068..f35342e12 100644
--- a/extras/PackageMaintenance.R
+++ b/extras/PackageMaintenance.R
@@ -66,7 +66,7 @@ writeLines(text, con = file(filePath))
 
 
 version <- gsub("Version: ", "", version)
-filePath <- file.path("inst", "sql", "sql_server", "migrations", "UpdateVersionNumber.sql")
+filePath <- file.path("inst", "sql", "sql_server", "UpdateVersionNumber.sql")
 text <- readChar(filePath, file.info(filePath)$size)
 patternRep <- "\\{DEFAULT @version_number = '(\\d+\\.\\d+\\.\\d+)'\\}"
 text <- gsub(patternRep, paste0("\\{DEFAULT @version_number = '", version, "'\\}"), text)
diff --git a/extras/TestOtherPlatforms.R b/extras/TestOtherPlatforms.R
index 67e9526a5..d1ec01a14 100644
--- a/extras/TestOtherPlatforms.R
+++ b/extras/TestOtherPlatforms.R
@@ -31,7 +31,7 @@ loadTestCohortDefinitionSet <- function(cohortIds = NULL) {
     cohortFileNameValue = c("cohortId")
   )
   if (!is.null(cohortIds)) {
-    cohortDefinitionSet <- cohortDefinitionSet %>% dplyr::filter(.data$cohortId %in% cohortIds)
+    cohortDefinitionSet <- cohortDefinitionSet %>% dplyr::filter(cohortId %in% cohortIds)
   }
   
   cohortDefinitionSet
diff --git a/inst/doc/RunningCohortDiagnostics.pdf b/inst/doc/RunningCohortDiagnostics.pdf
index 13b582377..1b2c559c4 100644
Binary files a/inst/doc/RunningCohortDiagnostics.pdf and b/inst/doc/RunningCohortDiagnostics.pdf differ
diff --git a/inst/doc/ViewingResultsUsingDiagnosticsExplorer.pdf b/inst/doc/ViewingResultsUsingDiagnosticsExplorer.pdf
index 75d8ae679..73992ab5b 100644
Binary files a/inst/doc/ViewingResultsUsingDiagnosticsExplorer.pdf and b/inst/doc/ViewingResultsUsingDiagnosticsExplorer.pdf differ
diff --git a/inst/doc/WhatIsCohortDiagnostics.pdf b/inst/doc/WhatIsCohortDiagnostics.pdf
index 6249a79e3..6fb627c36 100644
Binary files a/inst/doc/WhatIsCohortDiagnostics.pdf and b/inst/doc/WhatIsCohortDiagnostics.pdf differ
diff --git a/inst/shiny/CohortExplorer/CohortExplorer.Rproj b/inst/shiny/CohortExplorer/CohortExplorer.Rproj
deleted file mode 100644
index 8e3c2ebc9..000000000
--- a/inst/shiny/CohortExplorer/CohortExplorer.Rproj
+++ /dev/null
@@ -1,13 +0,0 @@
-Version: 1.0
-
-RestoreWorkspace: Default
-SaveWorkspace: Default
-AlwaysSaveHistory: Default
-
-EnableCodeIndexing: Yes
-UseSpacesForTab: Yes
-NumSpacesForTab: 2
-Encoding: UTF-8
-
-RnwWeave: Sweave
-LaTeX: pdfLaTeX
diff --git a/inst/shiny/CohortExplorer/R/widgets.R b/inst/shiny/CohortExplorer/R/widgets.R
deleted file mode 100644
index b7a2c0999..000000000
--- a/inst/shiny/CohortExplorer/R/widgets.R
+++ /dev/null
@@ -1,53 +0,0 @@
-menuItemFileInput <-
-  function(inputId,
-           text,
-           icon = shiny::icon("file-text-o")) {
-    script <- "document.getElementById('%id%').click(); return false;"
-    script <- gsub("%id%", inputId, script)
-    list(div(fileInput(inputId, ""), style = "display: none;"),
-         tags$li(class = "treeview", a(
-           href = "#", onclick = script, icon, text
-         )))
-  }
-
-menuItemDownloadLink <-
-  function(inputId, label, icon = shiny::icon("floppy-o")) {
-    tags$li(
-      class = "treeview",
-      tags$a(
-        id = inputId,
-        class = "shiny-download-link",
-        href = "",
-        target = "_blank",
-        download = NA,
-        icon,
-        label
-      )
-    )
-  }
-
-menuItemCopyTextAreaToClipboard <-
-  function(textAreaId,
-           label,
-           icon = shiny::icon("clipboard")) {
-    script <- "
-  element = $('