Skip to contents

Get indication for a target cohort

Usage

addIndication(
  x,
  cdm = lifecycle::deprecated(),
  indicationCohortName,
  indicationGap = 0,
  unknownIndicationTable = NULL,
  indicationDate = "cohort_start_date"
)

Arguments

x

Table in the cdm

cdm

A cdm reference created using CDMConnector

indicationCohortName

Name of indication cohort table

indicationGap

Gap between the event and the indication

unknownIndicationTable

Tables to search unknown indications

indicationDate

Date of the indication

Value

Same cohort adding the indications

Examples

# \donttest{
library(DrugUtilisation)
library(CodelistGenerator)

cdm <- mockDrugUtilisation()

indications <- list("headache" = 378253, "asthma" = 317009)
cdm <- generateConceptCohortSet(
  cdm, indications, "indication_cohorts"
)

acetaminophen <- getDrugIngredientCodes(cdm, "acetaminophen")
cdm <- generateDrugUtilisationCohortSet(cdm, "drug_cohort", acetaminophen)

cdm[["drug_cohort"]] %>%
  addIndication(
    indicationCohortName = "indication_cohorts",
    indicationGap = c(0, 30, 365)
  )
#> # Source:   table<og_045_1715701118> [?? x 13]
#> # Database: DuckDB v0.10.2 [unknown@Linux 6.5.0-1018-azure:R 4.4.0/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date
#>                   <int>      <int> <date>            <date>         
#>  1                    1          7 2018-05-21        2018-07-20     
#>  2                    1          1 2021-02-25        2021-03-11     
#>  3                    1          5 2014-07-28        2019-11-20     
#>  4                    1          9 2022-09-11        2022-11-09     
#>  5                    1          2 2022-06-06        2022-06-07     
#>  6                    1          4 2021-05-05        2021-12-15     
#>  7                    1          2 2022-05-24        2022-06-02     
#>  8                    1          3 2009-04-18        2009-11-07     
#>  9                    1          6 1991-01-28        1991-09-17     
#> 10                    1          7 2016-02-01        2017-10-04     
#> # ℹ more rows
#> # ℹ 9 more variables: indication_gap_0_headache <dbl>,
#> #   indication_gap_0_asthma <dbl>, indication_gap_0_none <dbl>,
#> #   indication_gap_30_asthma <dbl>, indication_gap_30_headache <dbl>,
#> #   indication_gap_30_none <dbl>, indication_gap_365_asthma <dbl>,
#> #   indication_gap_365_headache <dbl>, indication_gap_365_none <dbl>
# }