Skip to contents

It creates a mock database for testing drugutilisation package

Usage

mockDrugUtilisation(
  connectionDetails = list(con = DBI::dbConnect(duckdb::duckdb(), ":memory:"),
    writeSchema = "main"),
  numberIndividuals = 10,
  seed = 1,
  concept = NULL,
  concept_ancestor = NULL,
  drug_strength = NULL,
  person = NULL,
  observation_period = NULL,
  drug_exposure = NULL,
  condition_occurrence = NULL,
  observation = NULL,
  concept_relationship = NULL,
  extraTables = list(),
  ...
)

Arguments

connectionDetails

Details of the connection

numberIndividuals

Number of individuals in the mock cdm

seed

Seed for the random numbers

concept

A concept tibble, if NULL a mock one is created

concept_ancestor

A concept_ancestor tibble, if NULL a mock one is created

drug_strength

A drug_strength tibble, if NULL a mock one is created

person

A person tibble, if NULL a mock one is created

observation_period

A observation_period tibble, if NULL a mock one is created

drug_exposure

A drug_exposure tibble, if NULL a mock one is created

condition_occurrence

A condition_occurrence tibble, if NULL a mock one is created

observation

A observation tibble, if NULL a mock one is created

concept_relationship

A concept_relationship tibble, if NULL a mock one is created.

extraTables

Extra tibbles to be instantiated that are not cohorts or cdm tables

...

Cohorts can be added to the cdm reference, cohort1 and cohort2 will be created if not provided

Value

A cdm reference with the mock tables

Examples

# \donttest{
library(DrugUtilisation)

cdm <- mockDrugUtilisation()

cdm
#> 
#> ── # OMOP CDM reference (duckdb) of DUS MOCK ───────────────────────────────────
#>omop tables: person, observation_period, concept, concept_ancestor,
#> drug_strength, drug_exposure, condition_occurrence, visit_occurrence,
#> observation, concept_relationship
#>cohort tables: cohort1, cohort2
#>achilles tables: -
#>other tables: -
# }