Healthcare · OMOP

OMOP cohort definitions: the logic behind every real-world evidence study

Ask a team for 'patients with diabetes' and you will get as many answers as there are analysts. OHDSI's cohort definitions make that question precise, reusable and executable across databases. They are also where LLMs could help most, and where they need the most checking.

ExplainerSumanta Mukhopadhyay7 min read4 sources
#healthcare#omop#data#ai
EXPLAINER · HEALTHCARE · OMOP22 Oct 2026 · 04:15 GST

Real-world evidence studies, quality measures and many clinical AI projects begin with the same deceptively simple step: find the right patients. "Patients with type 2 diabetes starting metformin" sounds precise until you ask which codes, which first occurrence, how much prior history, and when someone stops counting. Different answers produce different results from the same data.

A cohort is not a code list

The Book of OHDSI defines a cohort as a set of persons who satisfy one or more inclusion criteria for a duration of time. It is explicit that a cohort is not a code set: it needs logic for how codes are used, such as first occurrence versus any occurrence, and a well-defined cohort specifies how a person enters and how they exit1.

A few properties follow: one person can belong to several cohorts, can belong to the same cohort in different periods, but not twice in the same period, and a cohort can be empty1. Cohorts are also defined independently and reused, so the same outcome cohort can serve many studies1.

The building blocks

Illustration of cohort definition building blocks, with domains such as conditions, drugs, procedures and measurements shown as stackable blocks
Building blocks of cohort definitions: CDM domains combined with concept sets and logic. Source: The Book of OHDSI, Defining Cohorts · CC0 1.0

Rule-based definitions combine four components1:

  • Domain: where the data lives in the CDM, such as drug exposures or procedures.
  • Concept set: a data-agnostic expression of standard concepts for the clinical idea, portable across databases.
  • Domain-specific attributes: days' supply for a drug, a measurement value or range.
  • Temporal logic: when one criterion must occur relative to another, for example within 365 days before the index event.

Assembled, they answer three questions: what event sets the index date, which inclusion criteria apply, and what ends cohort membership1. In OHDSI tools there are no separate exclusion criteria; "exclude prior hypertension" becomes "include people with zero occurrences of prior hypertension"1.

Screenshot of the ATLAS cohort definition editor showing the cohort entry events section
Defining a cohort's entry event in ATLAS, OHDSI's web tool for building definitions. Source: The Book of OHDSI, Defining Cohorts · CC0 1.0

Definitions as code

Definitions built in ATLAS are stored as JSON and compiled to SQL for each database platform, and tools such as CohortGenerator run them in analysis pipelines2. That is what makes OHDSI network studies possible: the same definition, run unchanged at many sites.

For a data platform, I treat cohort definitions as versioned artefacts: stored in a repository, reviewed, tested against data quality checks as in OMOP data quality checks, and linked to every result produced with them.

If a result can't be traced to the exact cohort definition version that produced it, it isn't reproducible, however good the analysis was.

Where LLMs fit

Turning a clinical question into a cohort definition is skilled, slow work, which makes it a natural target for language models. Research is exploring this, including an MCP server that exposes the OHDSI WebAPI's cohort tools so a model can assemble definitions from natural language3. That design is the right shape: the model calls structured tools that produce standard definitions, rather than writing free-form SQL.

The risks are clinical, not technical. A plausible definition with the wrong concept set, a missing washout period or an exit rule that silently drops patients will run perfectly and produce wrong evidence. My rules:

  1. Generate into the standard format, never ad hoc SQL, so definitions can be reviewed in familiar tools.
  2. Require clinical review of concept sets and temporal logic before any use.
  3. Check against data: counts, attrition by criterion and patient profiles, before trusting results.
  4. Prefer reuse. Start from established, validated definitions where they exist, and let the model adapt rather than invent.

The tool-based approach also follows the governance patterns in MCP Apps and tool annotations: read-only tools for exploration, review before anything is saved or run.

How I can help

I design OMOP platforms and research pipelines where cohort definitions are versioned, tested and reproducible, and help teams apply AI to them safely. See healthcare data architecture, or analyse your challenge and bring the result to a call.

References
  1. 1
  2. 2
  3. 3
  4. 4
FAQ

Common questions

What is a cohort in OHDSI?

A set of persons who satisfy one or more inclusion criteria for a duration of time. A well-defined cohort specifies how a person enters it and how they exit, not just which codes are involved.

What are the parts of an OHDSI cohort definition?

An entry event that sets the index date, inclusion criteria applied to that initial cohort, and exit criteria that define when a person no longer qualifies. Each is built from CDM domains, concept sets, domain-specific attributes and temporal logic.

Can LLMs write OHDSI cohort definitions?

Research is exploring it, including using MCP tools that expose the OHDSI WebAPI so a model can assemble definitions from natural language. Any generated definition should be reviewed by a clinical expert and checked against data before use.

Keep reading

Related

Open to advisory, fractional CTO & select builds

Let's talk about what you're building.

The fastest route is a free 30-minute call. Prefer to write? Send a message and I'll reply personally within two business days.

Start a conversation

How would you like to reach me?

Book a 30-min callFastest. Pick any open slot on my calendar.→ Write in GmailOpens a pre-filled draft in your browser.→ Use my email appOutlook, Apple Mail or your default client.→

I reply personally within two business days. US & UAE time zones.