Add a variable to a drug cohort indicating their presence in an indication cohort in a specified time window. If an individual is not in one of the indication cohorts, they will be considered to have an unknown indication if they are present in one of the specified OMOP CDM clinical tables. If they are neither in an indication cohort or a clinical table they will be considered as having no observed indication.
Arguments
- cohort
A cohort_table object.
- indicationCohortName
Name of indication cohort table
- indicationCohortId
target cohort Id to add indication
- indicationWindow
time window of interests
- unknownIndicationTable
Tables to search unknown indications
- indexDate
Name of a column that indicates the date to start the analysis.
- censorDate
Name of a column that indicates the date to stop the analysis, if NULL end of individuals observation is used.
- mutuallyExclusive
Whether to consider mutually exclusive categories (one column per window) or not (one column per window and indication).
- nameStyle
Name style for the indications. By default: 'indication_{window_name}' (mutuallyExclusive = TRUE), 'indication_{window_name}_{cohort_name}' (mutuallyExclusive = FALSE).
- name
Name of the new computed cohort table, if NULL a temporary table will be created.
Examples
# \donttest{
library(DrugUtilisation)
library(CDMConnector)
library(dplyr)
cdm <- mockDrugUtilisation()
indications <- list("headache" = 378253, "asthma" = 317009)
cdm <- generateConceptCohortSet(
cdm = cdm, conceptSet = indications, name = "indication_cohorts"
)
cdm <- generateIngredientCohortSet(
cdm = cdm, name = "drug_cohort",
ingredient = "acetaminophen"
)
#> ℹ Subsetting drug_exposure table
#> ℹ Checking whether any record needs to be dropped.
#> ℹ Collapsing overlaping records.
#> ℹ Collapsing records with gapEra = 1 days.
cdm$drug_cohort |>
addIndication(
indicationCohortName = "indication_cohorts",
indicationWindow = list(c(0, 0)),
unknownIndicationTable = "condition_occurrence"
) |>
glimpse()
#> ℹ Intersect with indications table (indication_cohorts).
#> ℹ Getting unknown indications from condition_occurrence.
#> ℹ Collapse indications to mutually exclusive categories
#> Rows: ??
#> Columns: 5
#> Database: DuckDB v1.1.3 [unknown@Linux 6.8.0-1017-azure:R 4.4.2/:memory:]
#> $ cohort_definition_id <int> 1, 1, 1, 1, 1
#> $ subject_id <int> 3, 5, 5, 8, 10
#> $ cohort_start_date <date> 2022-05-24, 2013-11-20, 2014-11-14, 2018-09-13, 1…
#> $ cohort_end_date <date> 2022-05-26, 2014-06-08, 2015-10-27, 2019-01-11, 1…
#> $ indication_0_to_0 <chr> "none", "none", "asthma", "none", "none"
# }