Compute a flag intersect with an omop table.
Usage
addTableIntersectFlag(
x,
tableName,
indexDate = "cohort_start_date",
censorDate = NULL,
window = list(c(0, Inf)),
targetStartDate = startDateColumn(tableName),
targetEndDate = endDateColumn(tableName),
inObservation = TRUE,
nameStyle = "{table_name}_{window_name}",
name = NULL
)
Arguments
- x
Table with individuals in the cdm.
- tableName
Name of the table to intersect with. Options: visit_occurrence, condition_occurrence, drug_exposure, procedure_occurrence, device_exposure, measurement, observation, drug_era, condition_era, specimen, episode.
- indexDate
Variable in x that contains the date to compute the intersection.
- censorDate
whether to censor overlap events at a specific date or a column date of x.
- window
window to consider events in.
- targetStartDate
Column name with start date for comparison.
- targetEndDate
Column name with end date for comparison.
- inObservation
If TRUE only records inside an observation period will be considered.
- nameStyle
naming of the added column or columns, should include required parameters.
- name
Name of the new table, if NULL a temporary table is returned.
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addTableIntersectFlag(tableName = "visit_occurrence")
#> # Source: table<og_141_1750280315> [?? x 5]
#> # Database: DuckDB v1.3.0 [unknown@Linux 6.11.0-1015-azure:R 4.5.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 3 1988-03-20 2008-02-21
#> 2 3 6 1948-02-17 1960-11-01
#> 3 1 5 1927-03-18 1929-02-14
#> 4 2 4 1963-05-12 2000-03-09
#> 5 1 7 1970-11-20 1972-12-09
#> 6 1 1 1929-03-15 1931-03-08
#> 7 3 9 1987-03-24 2006-03-17
#> 8 1 2 1974-07-30 1975-09-03
#> 9 2 8 1979-10-08 1984-05-14
#> 10 3 10 1957-10-12 1957-11-03
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }