Assembles the four components of an OHDSI cohort definition into a single Cohort object that can be serialized to Circe-compatible JSON via toCohortJson or written to disk with writeCohort.

cohort(entry, attrition = NULL, exit = NULL, era = NULL)

Arguments

entry

A CohortEntry from entry().

attrition

Optional CohortAttrition from attrition().

exit

Optional CohortExit from exit(). Defaults to observation exit.

era

Optional CohortEra from era(). Defaults to no era collapse.

Value

A Cohort S4 object.

Examples

giBleed <- cs(descendants(192671L), name = "GI Bleed")
ch <- cohort(
  entry = entry(conditionOccurrence(giBleed), primaryCriteriaLimit = "First"),
  exit  = exit(endStrategy = observationExit())
)