Skip to contents

Summarise the observation period table getting some overall statistics in a summarised_result object

Usage

summariseObservationPeriod(
  cdm,
  estimates = c("mean", "sd", "min", "q05", "q25", "median", "q75", "q95", "max",
    "density"),
  missingData = TRUE,
  quality = TRUE,
  byOrdinal = TRUE,
  ageGroup = NULL,
  sex = FALSE,
  dateRange = NULL,
  observationPeriod = 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.

estimates

Estimates to summarise the variables of interest ( Records per person, Duration in days and Days to next observation period).

missingData

Logical. If TRUE, includes a summary of missing data for relevant fields.

quality

Logical. If TRUE, performs basic data quality checks, including:

  • Number of subjects not included in person table.

  • Number of records with end date before start date.

  • Number of records with start date before the person's birth date.

byOrdinal

Boolean variable. Whether to stratify by the ordinal observation period (e.g., 1st, 2nd, etc.) (TRUE) or simply analyze overall data (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)).

sex

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

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.

observationPeriod

deprecated.

Value

A summarised_result object with the results.

Examples

# \donttest{
library(OmopSketch)
library(dplyr, warn.conflicts = FALSE)
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 <- summariseObservationPeriod(cdm = cdm)
#> Warning: ! There are 2649 individuals not included in the person table.

tableObservationPeriod(result = result)
Summary of observation_period table
Observation period ordinal Variable name Variable level Estimate name
CDM name
GiBleed
all Number records N 5,343
Number subjects N 5,343
Subjects not in person table N (%) 2,649 (49.58%)
Records per person Mean (SD) 1.00 (0.00)
Median [Q25 - Q75] 1 [1 - 1]
Range [min to max] [1 to 1]
Duration in days Mean (SD) 14,402.00 (8,725.34)
Median [Q25 - Q75] 13,868 [7,102 - 20,956]
Range [min to max] [1 to 40,349]
Type concept id Period covering healthcare encounters N (%) 5,343 (100.00%)
Start date before birth date N (%) 0 (0.00%)
End date before start date N (%) 0 (0.00%)
Column name Observation period end date N missing data (%) 0 (0.00%)
Observation period id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Observation period start date N missing data (%) 0 (0.00%)
Period type concept id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Person id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
1st Number subjects N 5,343
Duration in days Mean (SD) 14,402.00 (8,725.34)
Median [Q25 - Q75] 13,868 [7,102 - 20,956]
Range [min to max] [1 to 40,349]
plotObservationPeriod( result = result, variableName = "Duration in days", plotType = "boxplot" ) cdmDisconnect(cdm = cdm) # }