Skip to contents

It creates a mock database for testing DrugUtilisation package

Usage

mockDrugUtilisation(
  con = NULL,
  writeSchema = NULL,
  numberIndividuals = 10,
  seed = NULL,
  ...
)

Arguments

con

A DBIConnection object to a database. If NULL a new duckdb connection will be used.

writeSchema

A schema with writing permissions to copy there the cdm tables.

numberIndividuals

Number of individuals in the mock cdm.

seed

Seed for the random numbers. If NULL no seed is used.

...

Tables to use as basis to create the mock. If some tables are provided they will be used to construct the cdm object.

Value

A cdm reference with the mock tables

Examples

# \donttest{
library(DrugUtilisation)

cdm <- mockDrugUtilisation()
#> Warning: ! 7 column in condition_occurrence do not match expected column type:
#>  `stop_reason` is logical but expected character
#>  `provider_id` is logical but expected integer
#>  `visit_occurrence_id` is logical but expected integer
#>  `visit_detail_id` is logical but expected integer
#>  `condition_source_value` is logical but expected character
#>  `condition_source_concept_id` is logical but expected integer
#>  `condition_status_source_value` is logical but expected character
#> Warning: ! 3 column in concept do not match expected column type:
#>  `valid_start_date` is character but expected date
#>  `valid_end_date` is character but expected date
#>  `invalid_reason` is logical but expected character
#> Warning: ! 4 column in drug_strength do not match expected column type:
#>  `box_size` is logical but expected integer
#>  `valid_start_date` is character but expected date
#>  `valid_end_date` is character but expected date
#>  `invalid_reason` is logical but expected character

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