Skip to main content
Patterns for EventFrame and Cohort. Decision guide: Which API?.

Matching codes

Decide which code strings count as a hit.
Match aliases: starts_with, exactly, contain, end with.

Confirmed condition (≥2 days)

“Seen at least twice on different calendar days.”
Same-day duplicates count once. For legacy row counting: occurring(at_least=2, count_distinct_on=None).

Gap-separated index

“Two visits far enough apart; index at the first of that pair.”

Position filter

“Only primary diagnosis rows.”

Cohort with coded washout

“Index patients, age and enrollment filters, drop cancer in the prior year.”

Cohort with another EventFrame

Pass EventFrames to .include / .exclude (with optional window=) when the rule is itself an EventFrame.
window=(before, after) is always days relative to the cohort entry index date. Omit window to require membership with no timing filter.

Cross-domain event union

“Stack diagnosis and procedure hits into one stream.”

Next