Building blocks
Criteria helpers
window=(before, after) is days relative to the cohort entry index date.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Cohort entry, include/exclude criteria, attrition, and specs.
cohort = (
eb.Cohort("t2dm", database=db)
.entry(index, index="first")
.include(db.demographic.age_at_index(18, 89))
.include(db.enrollment.covering_index(days_before=365, days_after=0))
.include(other_frame, window=(-365, 0))
.exclude(db.diagnosis.matching("C", match="starts_with"), window=(-365, 0))
)
print(cohort.attrition())
final = cohort.to_df()
| Method | Meaning |
|---|---|
.entry(frame, index="first") | Starting population + index date (once) |
.include(source, window=…) | Require criterion / EventFrame |
.exclude(source, window=…) | Remove patients who meet criterion |
.attrition() | Remaining / dropped counts per step |
.spec() / eb.from_spec(...) | Serialize / restore |
.to_df() / .to_sql() | Run / inspect |
| Helper | Meaning |
|---|---|
db.demographic.age_at_index(lo, hi) | Age at index |
db.enrollment.covering_index(days_before, days_after) | Continuous enrollment around index |
db.demographic.sex(...) / .race(...) | Demographics |
db.death.recorded(window=…) | Death recorded |
include(frame, window=…) | Any EventFrame as a patient set |
window=(before, after) is days relative to the cohort entry index date.