Skip to content

Commit

Permalink
Merge pull request #69 from OHDSI/populationDiagnostics_paceholder
Browse files Browse the repository at this point in the history
placeholder for pop diagnostics
  • Loading branch information
edward-burn authored Oct 3, 2024
2 parents 7b5f4a6 + 3faf6f7 commit ffcc319
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 2 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export(exportSummarisedResult)
export(importSummarisedResult)
export(matchedDiagnostics)
export(phenotypeDiagnostics)
export(populationDiagnostics)
export(settings)
export(shinyDiagnostics)
export(summariseAchillesCodeUse)
Expand Down
13 changes: 12 additions & 1 deletion R/phenotypeDiagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#' @param databaseDiagnostics If TRUE, database diagnostics will be run.
#' @param codelistDiagnostics If TRUE, codelist diagnostics will be run.
#' @param cohortDiagnostics If TRUE, cohort diagnostics will be run.
#' @param populationDiagnostics If TRUE, population diagnostics will be run.
#' @param populationSample N of people from the cdm to sample. If NULL no
#' sampling will be performed
#' @param matchedDiagnostics If TRUE, cohort to population
#' diagnostics will be run.
#' @param nSample The number of people to take a random sample for matching to
Expand All @@ -19,8 +22,11 @@ phenotypeDiagnostics <- function(cohort,
databaseDiagnostics = TRUE,
codelistDiagnostics = TRUE,
cohortDiagnostics = TRUE,
populationDiagnostics = TRUE,
populationSample = 1000000,
matchedDiagnostics = TRUE,
nSample = 1000) {

cdm <- omopgenerics::cdmReference(cohort)

results <- list()
Expand All @@ -36,9 +42,14 @@ phenotypeDiagnostics <- function(cohort,
cli::cli("Running cohort diagnostics")
results[["cohort_diag"]] <- cohortDiagnostics(cohort)
}
if (isTRUE(populationDiagnostics)) {
cli::cli("Running population diagnostics")
results[["pop_diag"]] <- populationDiagnostics(cohort,
populationSample = populationSample)
}
if (isTRUE(matchedDiagnostics)) {
cli::cli("Running matched diagnostics")
results[["cohort_to_pop_diag"]] <- matchedDiagnostics(cohort,
results[["matched_diag"]] <- matchedDiagnostics(cohort,
nSample = nSample
)
}
Expand Down
19 changes: 19 additions & 0 deletions R/populationDiagnostics.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@


#' Population-level diagnostics
#'
#' @param cohort Cohort
#' @param populationSample N of people from the cdm to sample. If NULL no
#' sampling will be performed
#'
#' @return
#' @export
#'
#' @examples
populationDiagnostics <- function(cohort,
populationSample = 1000000) {

cli::cli_inform("populationDiagnostics not yet implemented")
omopgenerics::emptySummarisedResult()

}
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ reference:
- matches("phenotypeDiagnostics")
- subtitle: Run individual diagnostics
- contents:
- matches("databaseDiagnostics|codelistDiagnostics|cohortDiagnostics|matchedDiagnostics")
- matches("databaseDiagnostics|codelistDiagnostics|cohortDiagnostics|populationDiagnostics|matchedDiagnostics")
- subtitle: Visualise results
- contents:
- matches("shinyDiagnostics")
7 changes: 7 additions & 0 deletions man/phenotypeDiagnostics.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions man/populationDiagnostics.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/testthat/test-populationDiagnostics.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test_that("multiplication works", {
expect_equal(2 * 2, 4)
})

0 comments on commit ffcc319

Please sign in to comment.