diff --git a/DESCRIPTION b/DESCRIPTION index 58c9658..1a39c47 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,6 +21,7 @@ Suggests: DBI, gt, omock, + OmopSketch, testthat (>= 3.0.0), knitr, RPostgres, diff --git a/NAMESPACE b/NAMESPACE index 227a177..69108db 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,6 +4,7 @@ export("%>%") export(codelistDiagnostics) export(cohortDiagnostics) export(cohortToPopulationDiagnostics) +export(databaseDiagnostics) export(reportDiagnostics) export(shinyDiagnostics) importFrom(magrittr,"%>%") diff --git a/R/databaseDiagnostics.R b/R/databaseDiagnostics.R new file mode 100644 index 0000000..6cb9b70 --- /dev/null +++ b/R/databaseDiagnostics.R @@ -0,0 +1,15 @@ + + +#' Database diagnostics +#' +#' @param cdm CDM reference +#' +#' @return +#' @export +#' +#' @examples +databaseDiagnostics <- function(cdm){ + +OmopSketch::summariseOmopSnapshot(cdm) + +} diff --git a/man/databaseDiagnostics.Rd b/man/databaseDiagnostics.Rd new file mode 100644 index 0000000..5d16986 --- /dev/null +++ b/man/databaseDiagnostics.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/databaseDiagnostics.R +\name{databaseDiagnostics} +\alias{databaseDiagnostics} +\title{Database diagnostics} +\usage{ +databaseDiagnostics(cdm) +} +\arguments{ +\item{cdm}{CDM reference} +} +\description{ +Database diagnostics +} diff --git a/tests/testthat/test-databaseDiagnostics.R b/tests/testthat/test-databaseDiagnostics.R new file mode 100644 index 0000000..8d091d6 --- /dev/null +++ b/tests/testthat/test-databaseDiagnostics.R @@ -0,0 +1,20 @@ +test_that("multiplication works", { + cdm_local <- omock::mockCdmReference() |> + omock::mockPerson(nPerson = 100) |> + omock::mockObservationPeriod() |> + omock::mockConditionOccurrence() |> + omock::mockDrugExposure() |> + omock::mockObservation() |> + omock::mockMeasurement() |> + omock::mockCohort(name = "my_cohort", numberCohorts = 2) + + db <- DBI::dbConnect(duckdb::duckdb()) + cdm <- CDMConnector::copyCdmTo(con = db, cdm = cdm_local, + schema ="main", overwrite = TRUE) + + db_diag <- databaseDiagnostics(cdm) + expect_no_error(OmopSketch::tableOmopSnapshot(db_diag)) + + CDMConnector::cdmDisconnect(cdm = cdm) + +})