
It creates column to indicate the date overlap information between a table and a concept
Source:R/addConceptIntersect.R
addConceptIntersectDate.RdIt creates column to indicate the date overlap information between a table and a concept
Arguments
- x
Table with individuals in the cdm.
- conceptSet
Concept set list.
- indexDate
Variable in x that contains the date to compute the intersection.
- censorDate
whether to censor overlap events at a date column of x
- window
window to consider events in.
- targetDate
Event date to use for the intersection.
- order
last or first date to use for date/days calculations.
- 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{
library(PatientProfiles)
library(omopgenerics, warn.conflicts = TRUE)
library(dplyr, warn.conflicts = TRUE)
cdm <- mockPatientProfiles(source = "duckdb")
#> Warning: There are observation period end dates after the current date: 2026-04-06
#> ℹ The latest max observation period end date found is 2032-06-20
concept <- tibble(
concept_id = c(1125315),
domain_id = "Drug",
vocabulary_id = NA_character_,
concept_class_id = "Ingredient",
standard_concept = "S",
concept_code = NA_character_,
valid_start_date = as.Date("1900-01-01"),
valid_end_date = as.Date("2099-01-01"),
invalid_reason = NA_character_
) |>
mutate(concept_name = paste0("concept: ", .data$concept_id))
cdm <- insertTable(cdm, "concept", concept)
cdm$cohort1 |>
addConceptIntersectDate(conceptSet = list("acetaminophen" = 1125315))
#> Warning: ! `codelist` casted to integers.
#> # Source: table<og_067_1775495259> [?? x 5]
#> # Database: DuckDB 1.5.1 [unknown@Linux 6.17.0-1008-azure:R 4.5.3/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 7 2011-11-13 2011-12-24
#> 2 1 10 1951-01-15 1955-05-30
#> 3 1 4 1980-05-26 1984-02-26
#> 4 2 2 1966-08-11 1973-07-25
#> 5 3 6 1939-12-17 1940-01-16
#> 6 1 5 1915-11-21 1917-05-19
#> 7 3 9 1983-10-20 2000-08-16
#> 8 3 8 1931-08-21 1940-10-10
#> 9 3 3 1991-05-08 1991-06-15
#> 10 2 1 1956-05-10 1962-10-28
#> # ℹ 1 more variable: acetaminophen_0_to_inf <date>
# }