Skip to contents

Build the drug_era table

Usage

buildDrugEra(cdm, collapseDays = 30L)

Arguments

cdm

A cdm_reference object.

collapseDays

Number of days that two exposures can be separated to be collapsed in a single era.

Value

The lazy drug_era table.

Examples

# \donttest{
library(omock)
library(OmopConstructor)
library(dplyr, warn.conflicts = TRUE)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union

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

cdm$drug_era <- buildDrugEra(cdm = cdm)
cdm$drug_era |>
  glimpse()
#> Rows: ??
#> Columns: 7
#> Database: DuckDB 1.4.3 [unknown@Linux 6.11.0-1018-azure:R 4.5.2//tmp/RtmpQYYp5Z/file1bf46a994c1.duckdb]
#> $ drug_era_id         <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
#> $ person_id           <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
#> $ drug_concept_id     <int> 1125315, 1729720, 1713332, 1759842, 1125315, 11253…
#> $ drug_era_start_date <date> 1980-03-15, 1953-02-06, 2012-02-14, 2012-02-14, 1…
#> $ drug_era_end_date   <date> 1980-03-29, 1953-02-16, 2012-02-28, 2012-02-28, 1…
#> $ drug_exposure_count <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
#> $ gap_days            <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

# }