Skip to contents

Only concepts recorded during observation period are counted.

Usage

summariseConceptIdCounts(
  cdm,
  omopTableName,
  countBy = "record",
  interval = "overall",
  sex = FALSE,
  ageGroup = NULL,
  inObservation = FALSE,
  sample = NULL,
  dateRange = NULL,
  year = lifecycle::deprecated()
)

Arguments

cdm

A cdm_reference object. Use CDMConnector to create a reference to a database or omock to create a reference to synthetic data.

omopTableName

A character vector of the names of the tables to summarise in the cdm object. Run clinicalTables() to check the available options.

countBy

Either "record" for record-level counts or "person" for person-level counts.

interval

Time interval to stratify by. It can either be "years", "quarters", "months" or "overall".

sex

Logical; whether to stratify results by sex (TRUE) or not (FALSE).

ageGroup

A list of age groups to stratify the results by. Each element represents a specific age range. You can give them specific names, e.g. ageGroup = list(children = c(0, 17), adult = c(18, Inf)).

inObservation

Logical. If TRUE, the results are stratified to indicate whether each record occurs within an observation period.

sample

Either an integer or a character string.

  • If an integer (n > 0), the function will first sample n distinct person_ids from the person table and then subset the input tables to those subjects.

  • If a character string, it must be the name of a cohort in the cdm; in this case, the input tables are subset to subjects (subject_id) belonging to that cohort.

  • Use NULL to disable subsetting (default value).

dateRange

A vector of two dates defining the desired study period. Only the start_date column of the OMOP table is checked to ensure it falls within this range. If dateRange is NULL, no restriction is applied.

year

deprecated.

Value

A summarised_result object with the results.

Examples

# \donttest{
library(OmopSketch)
library(omock)

cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb")
#>  Reading GiBleed tables.
#>  Adding drug_strength table.
#>  Creating local <cdm_reference> object.
#>  Inserting <cdm_reference> into duckdb.

result <- summariseConceptIdCounts(
  cdm = cdm,
  omopTableName = "condition_occurrence",
  countBy = c("record", "person"),
  sex = TRUE
)

tableConceptIdCounts(result = result)
cdmDisconnect(cdm = cdm) # }