Cohort Definition Language (CDL) is a declarative, machine-readable syntax for formally expressing the complex inclusion and exclusion criteria that define a specific patient group for observational research or clinical trial recruitment. It translates narrative eligibility rules into an unambiguous, executable logic that can be run against electronic health record data to identify qualifying individuals.
Glossary
Cohort Definition Language

What is Cohort Definition Language?
A standardized, machine-readable syntax for expressing the complex inclusion and exclusion rules that define a patient group for research or trial recruitment purposes.
CDL enables the construction of computable phenotypes by defining temporal constraints, value sets from standard ontologies like SNOMED CT and RxNorm, and logical operators. This structured approach replaces manual chart review with automated, reproducible cohort identification, ensuring consistent patient selection across different sites and studies.
Key Features of Cohort Definition Language
A machine-readable grammar for expressing complex patient group definitions. CDL translates clinical logic into executable queries against electronic health data.
Declarative Rule Structure
CDL uses a declarative syntax where rules describe what constitutes cohort membership, not how to retrieve it. This separates clinical intent from execution logic.
- Inclusion criteria: Conditions that must be true for a patient to qualify
- Exclusion criteria: Conditions that disqualify an otherwise eligible patient
- Rule composition: Atomic criteria combine via logical operators (
AND,OR,NOT)
Example: INCLUDE (Diagnosis.type = "T2DM") AND NOT (Medication.code IN {"insulin"})
Temporal Constraint Operators
CDL natively supports time-window logic to express sequence-dependent eligibility rules that are common in trial protocols.
BEFORE/AFTER: Ordering of clinical events relative to each otherWITHIN [n] DAYS: Proximity constraints between eventsDURATION >= [n]: Minimum length of a condition or treatmentFIRST_OCCURRENCE: References the earliest instance of an event
Example: Diagnosis.date AFTER Procedure.date WITHIN 30 DAYS
Ontology-Backed Value Sets
CDL references standardized terminologies rather than free-text, ensuring unambiguous interpretation across heterogeneous data sources.
- SNOMED CT: Clinical findings and procedures
- RxNorm: Medication concepts
- LOINC: Laboratory tests and results
- ICD-10-CM: Diagnosis and procedure codes
Value sets group related codes: Condition.code IN ValueSet("Cardiovascular_Disease") expands to hundreds of mapped codes automatically.
Nested Grouping Logic
Complex protocols require hierarchical rule nesting to express precedence and scoping correctly.
- Parentheses define evaluation order for compound expressions
- Sub-groups can represent distinct eligibility domains (e.g., lab criteria, medication criteria)
- Each group evaluates independently before combining at the parent level
Example structure:
codeINCLUDE ( (Age >= 18 AND Age <= 65) AND (Diagnosis.code = "T2DM") AND (Lab.HbA1c.value > 7.5) ) EXCLUDE ( (Medication.code IN {"insulin"}) OR (Condition.code IN ValueSet("Renal_Impairment")) )
Quantitative Threshold Expressions
CDL supports numerical comparisons against clinical measurements with unit awareness for precise eligibility filtering.
- Comparison operators:
>,<,>=,<=,=,!= - Unit specification:
Lab.HbA1c.value > 7.5 unit="%" - Range expressions:
Lab.eGFR.value BETWEEN 30 AND 60 unit="mL/min/1.73m2" - Trend operators:
Lab.HbA1c.value DECREASING OVER 6 MONTHS
This enables criteria like "eGFR must be between 30 and 60 mL/min" to be evaluated correctly regardless of source data units.
Modular Rule Reuse
CDL supports named rule definitions that can be referenced across multiple cohort definitions, promoting consistency and reducing duplication.
- Define-once, use-many: Common criteria like "Adult Type 2 Diabetic" become reusable modules
- Parameterized rules: Modules accept arguments for flexible instantiation
- Version control: Rule modules carry version identifiers for audit trails
Example: DEFINE AdultT2DM AS (Age >= 18 AND Diagnosis.code = "T2DM") then INCLUDE AdultT2DM in any cohort.
Frequently Asked Questions
Explore the technical foundations of Cohort Definition Language (CDL), a standardized syntax for expressing complex patient group rules that power automated clinical trial eligibility screening and real-world evidence generation.
Cohort Definition Language (CDL) is a standardized, machine-readable syntax for expressing the complex inclusion and exclusion rules that define a patient group for research or trial recruitment purposes. It works by translating narrative clinical logic—such as 'adult patients with Type 2 Diabetes and an HbA1c > 7.0% within the last 6 months, excluding those on insulin'—into a structured, computable format that can be executed against electronic health record (EHR) databases. CDL typically leverages a JSON or YAML-based schema to define phenotype criteria using logical operators (AND, OR, NOT), temporal constraints, and value comparisons. The language decomposes each criterion into atomic components: a clinical concept (e.g., HbA1c laboratory test), a value constraint (e.g., > 7.0%), a time window (e.g., within 180 days), and a modifier (e.g., most recent). A phenotype execution engine then parses this definition, translates it into database queries such as SQL or FHIR API calls, and returns a cohort of qualifying patient identifiers. This approach ensures reproducibility across institutions, enables protocol amendment handling through version-controlled definitions, and forms the backbone of automated patient pre-screening and site feasibility assessment workflows.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
The Cohort Definition Language (CDL) operates within a broader ecosystem of computational phenotyping and trial recruitment technologies. These related concepts define the inputs, execution environments, and analytical outputs that transform a machine-readable cohort definition into actionable patient lists.
Phenotype Execution Engine
The software component that runs a computable phenotype definition against a clinical data repository. It interprets CDL expressions, resolves temporal constraints, and queries both structured fields and unstructured notes to return a final patient cohort. Key capabilities include:
- Logical resolution: Evaluating nested AND/OR/NOT operators
- Temporal reasoning: Validating event sequences and time windows
- Value set expansion: Resolving ontological codes to their descendants
- Data source federation: Querying across EHR, claims, and lab systems simultaneously
Criteria-to-Query Translation
The process of converting parsed, structured eligibility criteria into executable database queries. This translation layer bridges CDL's declarative syntax with the imperative query languages of target data repositories. A single CDL criterion like 'HbA1c > 7.0% within last 6 months' must be decomposed into:
- A value set lookup for HbA1c LOINC codes
- A temporal filter for encounters within 180 days
- A numeric threshold evaluation (> 7.0)
- A unit normalization step to handle varying lab result formats
Screen Failure Analysis
The systematic review of reasons why pre-screened patients failed to meet trial eligibility, used to optimize recruitment strategies and refine protocol inclusion criteria. When a CDL-defined cohort is executed, the failure signature—which specific criteria excluded each patient—is logged. Analysis of aggregate screen failures reveals:
- Overly restrictive criteria causing unnecessary exclusion
- Ambiguous criteria requiring clarification in the CDL expression
- Data quality gaps where missing lab results cause false exclusions
- Protocol amendment opportunities to improve enrollment rates
Criteria Weighting
The assignment of relative importance scores to individual inclusion and exclusion criteria to prioritize patient matches. While CDL defines binary eligibility (pass/fail), criteria weighting enables ranked matching for scenarios where multiple trials compete for the same patient. Critical safety criteria receive maximum weight, while procedural preferences receive lower weight. The weighted score supports:
- Trial recommendation engines that suggest optimal matches
- Site feasibility assessments estimating enrollment potential
- Patient prioritization when screening capacity is constrained

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us