
Adds the cohort_codelist attribute to a cohort
addCodelistAttribute.Rd
`addCodelistAttribute()` allows the users to add a codelist to a cohort in OMOP CDM.
This is particularly important for the use of `codelistDiagnostics()`, as the underlying assumption is that the cohort that is fed into `codelistDiagnostics()` has a cohort_codelist attribute attached to it.
Usage
addCodelistAttribute(cohort, codelist, cohortName = names(codelist))
Examples
# \donttest{
library(PhenotypeR)
cdm <- mockPhenotypeR()
cohort <- addCodelistAttribute(cohort = cdm$my_cohort, codelist = list("cohort_1" = 1L))
attr(cohort, "cohort_codelist")
#> # Source: table<my_cohort_codelist> [?? x 4]
#> # Database: DuckDB v1.3.1 [unknown@Linux 6.11.0-1015-azure:R 4.5.1/:memory:]
#> cohort_definition_id codelist_name concept_id codelist_type
#> <int> <chr> <int> <chr>
#> 1 1 cohort_1 1 index event
CDMConnector::cdmDisconnect(cdm)
# }