Creating outcome cohorts


The functions estimatePointPrevalence(), estimatePeriodPrevalence(), and estimateIncidence() will calculate incidence and prevalence rates of a set of outcome cohorts for a set of denominator cohorts. While the denominator cohorts can be created using the generateDenominatorCohortSet() from this package, the set of outcome cohorts used will be defined externally. Below we provide some general instructions for defining outcome cohorts and adding them to a cdm reference.

Adding an outcome cohort based on a JSON definition

OMOP CDM cohort definitions can be represented as JSON. These JSON definition could be created using tools such as ATLAS ( or capR ( How we define outcome cohorts will depend on our research question, and we will need to consider several aspects such as event persistence and restrictions in the number of events occurring per person.

In general outcome definitions should include all occurrences of an outcome in an individual´s history without restriction, as requirements such as prior history can be incorporated when using generateDenominatorCohortSet() as can other criteria such as diagnoses of conditions or medication use (using the strata cohort option). In addition, it should be kept in mind that the approach to defining cohort exit can impact results for both incidence and prevalence rates. For incidence rates, we can decide whether we want to restrict our analysis to first events or if we want to include all the events that occur per person. If we want to consider multiple events per person, the duration of these events will be of importance, as we are not going to capture subsequent events if prior events have not yet been concluded. In addition, outcome washouts will be implemented relative to cohort exit from any previous event. Event persistence will also influence results generated by estimatePointPrevalence() and estimatePeriodPrevalence() as the number of individuals included in the numerator for a given moment or period of time will differ depending on how the outcome cohort exit strategy was defined.

Once we have a set of cohort definitions expressed as JSONs (saved in a folder called “outcome_cohorts”), we can add the cohorts to an existing cdm reference in a table called “outcome_table” like so:

outcome_cohorts <- CDMConnector::readCohortSet(here::here("outcome_cohorts"))
cdm <- CDMConnector::generateCohortSet(
  cdm = cdm,
  cohortSet = outcome_cohorts,
  name = outcome_table

Creating outcome cohorts with bespoke code

As long as the table created is in the format of an OMOP CDM cohort table, an outcome cohort could also be defined via bespoke code. It is beyond the scope of this vignette to describe all the ways a custom code could be written to define an outcome, but suffice it to say that as with defining a JSON cohort expression the outcome cohort created should reflect the study question at hand. Similar considerations as above would apply on defining outcome entry events, appropriate cohort exit criteria, and so on.