This prompt is built for clinical research teams, trial matching system engineers, and data pipeline builders who need to convert unstructured clinical trial protocol text into structured, typed eligibility criteria. The core job-to-be-done is transforming narrative inclusion and exclusion text—often dense with nested logic, temporal constraints, and implicit rules—into machine-readable records that downstream systems can query. Typical users are integrating this extraction step into patient-to-trial matching engines, protocol feasibility analysis tools, or regulatory document indexing pipelines. The prompt assumes the input is a section of a trial protocol or registry entry describing who may or may not participate, not a full medical record or a patient-specific document.
Prompt
Clinical Trial Inclusion Criteria Extraction Prompt

When to Use This Prompt
Defines the job-to-be-done, ideal user, required context, and boundaries for the clinical trial inclusion criteria extraction prompt.
Use this prompt when you need to extract criteria with their logical operators (AND/OR/NOT), value ranges, units, temporal constraints, and explicit inclusion/exclusion typing. It handles complex nested criteria and can surface implicit exclusion logic where the protocol states what is required without explicitly listing what is disallowed. The output is designed to feed directly into structured databases, search indexes, or matching algorithms. Do not use this prompt for extracting patient-specific data from medical records, for summarizing trial results, or for making clinical decisions. It is not a substitute for clinical judgment and should never be the sole basis for determining patient eligibility without human review.
Before using this prompt, ensure your input text is a clean, text-extracted version of the eligibility criteria section. PDFs with complex tables or multi-column layouts should be pre-processed into linear text. If your protocol uses non-standard terminology or institution-specific abbreviations, consider adding a terminology mapping step before extraction. For regulated environments, always pair this prompt with a validation layer that checks output schema compliance, logical consistency, and source grounding. Human review is required for any criteria that directly affect patient safety or trial enrollment decisions.
Use Case Fit
Where this prompt works and where it does not. Use these cards to decide if the Clinical Trial Inclusion Criteria Extraction Prompt fits your workflow before you invest in integration.
Good Fit: Structured Protocol Ingestion
Use when: you have clinical trial protocols or registry entries with explicit eligibility sections and need typed criteria records for trial matching systems. Guardrail: the prompt expects section-delimited text; pre-process PDFs to extract the eligibility section before prompting.
Bad Fit: Unstructured Clinician Notes
Avoid when: the source is free-text clinician notes, referral letters, or conversational summaries without explicit inclusion/exclusion structure. Guardrail: use a clinical finding extraction prompt instead; this prompt relies on protocol-style language and explicit criteria framing.
Required Inputs
What you must provide: the full eligibility criteria text block from a protocol or registry record, plus a target output schema specifying condition, value, unit, temporal constraints, and logical operators. Guardrail: missing schema definitions cause the model to invent field names; always supply a typed JSON schema or field specification.
Operational Risk: Nested Logic
What to watch: complex nested criteria with AND/OR groupings, parenthetical sub-conditions, or stepwise eligibility gates can produce flattened or incorrect logical structures. Guardrail: test with at least three protocols containing multi-level nesting and compare extracted operator trees against manual annotation before production use.
Operational Risk: Implicit Exclusion
What to watch: protocols often express exclusion criteria implicitly through inclusion phrasing (e.g., 'patients must not have' vs. 'exclude patients with'). Guardrail: add a post-extraction validation step that checks for negation patterns and flags criteria where the inclusion/exclusion polarity is ambiguous for human review.
Not a Replacement for Clinical Review
What to watch: extracted criteria may miss protocol amendments, institutional review board modifications, or site-specific eligibility variations. Guardrail: always route extracted criteria through a clinical reviewer or trial coordinator before using them for patient matching or enrollment decisions.
Copy-Ready Prompt Template
A production-ready prompt template for extracting structured clinical trial eligibility criteria from protocol text, with placeholders for schema, ontology, and risk controls.
This prompt template is designed to be dropped directly into your extraction pipeline. It enforces strict output formatting, explicit handling of ambiguous criteria, and normalization of clinical units. The template uses square-bracket placeholders that your application must resolve before sending the request to the model. The most critical placeholder is [OUTPUT_SCHEMA], which should contain the exact JSON Schema you expect the model to conform to—this is your primary defense against malformed outputs in production.
textExtract structured eligibility criteria from the provided clinical trial protocol text. Adhere strictly to the output schema. Do not infer criteria not explicitly stated. If a criterion is ambiguous, set the confidence to 'low' and include the ambiguous source text in the evidence field. For implicit exclusions (e.g., 'patients must not have'), create a criterion with the operator 'EXCLUDES'. Normalize all units to the standard provided in the [UNIT_ONTOLOGY] variable. Return only the JSON object, enclosed in a ```json code block. [OUTPUT_SCHEMA] [UNIT_ONTOLOGY] Protocol Text: [PROTOCOL_TEXT]
To adapt this template for your own use, replace [OUTPUT_SCHEMA] with a concrete JSON Schema that defines the structure of each criterion object—fields like condition, operator, value, unit, temporal_constraint, confidence, and evidence. Replace [UNIT_ONTOLOGY] with a mapping of acceptable units (e.g., {"weight": "kg", "height": "cm"}) to enforce normalization. The [PROTOCOL_TEXT] placeholder should receive the raw, unstructured text of the clinical trial protocol. Before deploying, validate that your chosen model reliably produces output that passes schema validation; if it does not, add a repair step or consider a model with stronger instruction-following for structured generation. Always log the raw model response and the validation result for auditability, especially in GxP-adjacent workflows.
Prompt Variables
Inputs required for the Clinical Trial Inclusion Criteria Extraction Prompt. Each variable must be populated before the prompt is sent. Validation notes describe how to check the input before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[PROTOCOL_TEXT] | Unstructured clinical trial protocol text containing eligibility criteria | Inclusion Criteria: Patients must be 18-75 years old with histologically confirmed NSCLC... | Check length > 0 and < model context window. Verify text contains eligibility section keywords (Inclusion, Exclusion, Eligible). |
[CONDITION_SCHEMA] | JSON schema defining the output structure for each extracted criterion | {"type":"object","properties":{"condition":{"type":"string"},"value":{"type":"string"},"unit":{"type":"string"},"operator":{"enum":[">=","<=","=","!=",">","<"]},"temporal_constraint":{"type":"string"},"logical_operator":{"enum":["AND","OR","NOT"]},"group_id":{"type":"integer"}},"required":["condition","operator"]} | Validate JSON parse succeeds. Check required fields match downstream ingestion contract. Confirm enum values cover expected clinical value ranges. |
[OUTPUT_FORMAT] | Target serialization format for the extracted criteria list | JSON | Must be one of: JSON, XML, CSV. Validate against parser expectations. JSON recommended for nested logical groups. |
[NORMALIZATION_RULES] | Rules for standardizing units, lab values, and medical terminology | Convert all weight values to kg. Map lab test names to LOINC codes where possible. Normalize age to years. | Check that rules are non-empty and expressed as imperative instructions. Verify rules do not conflict (e.g., two different target units for the same measure). |
[TEMPORAL_REFERENCE_DATE] | Reference date for resolving relative temporal constraints | 2025-01-15 | Validate ISO 8601 format (YYYY-MM-DD). Required when protocol uses relative terms like 'within 6 months' or 'prior to enrollment'. Set to null if protocol uses only absolute ranges. |
[MAX_CRITERIA_COUNT] | Upper bound on the number of criteria the model should extract | 50 | Validate integer > 0. Set based on protocol complexity. Used to prevent runaway extraction on malformed or extremely long protocols. Trigger retry with higher limit if extraction count hits this bound. |
[IMPLICIT_EXCLUSION_HANDLING] | Instruction for how to treat criteria not explicitly labeled as exclusion | Infer exclusion when criterion uses negative phrasing (e.g., 'patients without', 'absence of', 'not permitted'). Flag inferred exclusions with explicit confidence note. | Validate value is one of: 'strict' (only explicit exclusion sections), 'infer' (detect negative phrasing), 'none' (treat all as inclusion). Choice affects downstream trial matching logic. |
[CONFIDENCE_THRESHOLD] | Minimum confidence score for automated extraction without human review | 0.85 | Validate float between 0.0 and 1.0. Criteria below this threshold should route to human review queue. Set lower for high-recall use cases, higher for precision-critical downstream matching. |
Implementation Harness Notes
How to wire the clinical trial inclusion criteria extraction prompt into a reliable application pipeline.
This prompt is designed to be called as a single-turn extraction step within a larger document processing pipeline, not as a standalone chat interaction. The primary integration point is a structured API call where the trial protocol text is passed as the [INPUT] and the extraction schema is provided as the [OUTPUT_SCHEMA]. Because clinical trial eligibility criteria directly affect patient safety and trial integrity, the implementation harness must enforce strict validation, audit logging, and human review gates before any extracted criteria are used for downstream trial matching or site selection.
Validation and retry logic should be the first layer of defense. After the model returns a JSON payload, validate it against the expected schema using a library like jsonschema or pydantic. Check that all required fields (criterion_id, condition, logical_operator) are present, that enumerated fields match allowed values, and that numeric ranges have consistent units. If validation fails, implement a single retry with the error message injected into the prompt as additional [CONSTRAINTS]. Do not retry more than twice—escalate to a human review queue instead. Confidence scoring is critical: if the model's self-reported confidence for any criterion falls below a configurable threshold (start at 0.85), flag the entire extraction for human review. Log every extraction attempt, including the raw model response, validation errors, and retry count, to a structured logging system for audit and prompt debugging.
Model choice matters for this domain. Use a model with strong instruction-following and structured output capabilities, such as GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro. Avoid smaller or older models that may hallucinate criteria or mishandle nested logical operators. If you are processing high volumes of protocols, consider batching documents but never batch more than one protocol per prompt call—cross-document contamination is a real failure mode. Tool use and RAG are generally not required for this extraction task because the prompt operates on a single, self-contained document. However, if your pipeline needs to normalize medical terms against a controlled vocabulary like SNOMED CT or MedDRA, implement a post-extraction normalization step using a separate API call or lookup table rather than embedding the entire ontology in the prompt.
Human review integration is non-negotiable for production use. Build a review queue that surfaces extractions with low confidence, validation failures, or complex nested criteria (more than three levels of logical nesting). The review interface should display the original protocol text side-by-side with the extracted criteria, allowing a clinical reviewer to accept, edit, or reject each criterion. Store all reviewer actions with timestamps and user identifiers for compliance. Finally, never use extracted criteria for automated trial matching without human approval—the risk of misclassifying a patient's eligibility due to an extraction error is too high. Wire the approval status into your downstream systems so that only reviewed and approved criteria propagate to patient-facing applications.
Expected Output Contract
Define the exact shape of the structured JSON payload your application expects. Use this contract to build a post-processing validator before any extracted data enters a downstream system.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
trial_id | string | Must match the provided [TRIAL_ID] input exactly; reject if missing or altered | |
criteria | array of objects | Must be a non-empty array; reject if extraction produces zero criteria | |
criteria[].criterion_id | string | Must be a unique slug like 'inc-001' or 'exc-001'; reject duplicates | |
criteria[].type | enum: inclusion | exclusion | Must be exactly 'inclusion' or 'exclusion'; reject any other value | |
criteria[].condition | string | Must be a non-empty string describing the clinical condition or characteristic | |
criteria[].value | string or null | If present, must be a string with numeric value and unit; null allowed when criterion is categorical | |
criteria[].unit | string or null | If [VALUE] is present, [UNIT] must be a non-empty string; null allowed when [VALUE] is null | |
criteria[].temporal_constraint | string or null | If present, must describe timing relative to trial (e.g., 'within 30 days of screening'); null allowed | |
criteria[].logical_operator | enum: AND | OR | NOT | null | Must be one of the specified enums or null for standalone criteria; reject nested operators without child criteria | |
criteria[].child_criteria | array of criteria objects or null | If [LOGICAL_OPERATOR] is not null, must be a non-empty array of nested criteria objects; null allowed otherwise | |
extraction_confidence | number | Must be a float between 0.0 and 1.0; reject values outside range | |
ambiguous_spans | array of objects or null | If present, each object must have 'text' (string) and 'reason' (string); null allowed when no ambiguity detected | |
source_citation | object | Must contain 'section' (string) and 'paragraph_index' (integer >= 0); reject if either is missing |
Common Failure Modes
Clinical trial criteria extraction is brittle. Complex logic, implicit exclusion, and domain-specific language break naive prompts. Here are the most common failures and how to prevent them before they reach production.
Implicit Exclusion Logic Missed
What to watch: The prompt extracts explicit criteria but misses implicit exclusions, such as 'patients must have failed prior therapy' implying exclusion of treatment-naive patients. The model treats criteria as a flat list instead of a logical graph. Guardrail: Require the prompt to output logical operators (AND, OR, NOT) and flag any criterion that implies exclusion without stating it directly. Add a post-extraction check that every extracted criterion has an explicit operator.
Temporal Constraints Stripped
What to watch: The model extracts 'HbA1c < 8.0%' but drops 'within 30 days of enrollment.' The temporal constraint is critical for trial eligibility but gets lost during normalization. Guardrail: Add a dedicated temporal_constraint field to the output schema and test with examples where the constraint is embedded mid-sentence. If the field is null, flag for human review before ingestion.
Unit and Value Decoupling
What to watch: The model extracts 'platelet count ≥ 100,000' but normalizes the value to 100 without the unit (cells/µL), or converts units incorrectly. Downstream systems interpret 100 platelets/µL instead of 100,000. Guardrail: Require value, unit, and original_text as separate fields. Validate that every numeric value has a non-null unit. Add a unit-normalization step that maps common clinical units to a canonical form before storage.
Nested Criteria Flattened Incorrectly
What to watch: A criterion like '(HbA1c ≤ 8.0% AND fasting glucose ≤ 126 mg/dL) OR (on stable metformin dose)' gets flattened into three independent criteria, losing the grouping logic. Guardrail: Output criteria as a tree structure with group_id and parent_group_id fields. Test with at least three examples of parenthesized, multi-level criteria. If the output is flat when the input is nested, fail validation.
Negation Scope Confusion
What to watch: 'Patients without evidence of active infection for at least 2 weeks' is extracted as 'active infection' with no negation flag, or the temporal scope is applied to the wrong clause. Guardrail: Add a negated boolean field and a scope field that captures what the negation applies to. Test with criteria where negation spans multiple conditions. If negation is detected in the source but the output has negated: false, escalate.
Ambiguous Lab Reference Ranges
What to watch: 'AST within normal limits' is extracted without specifying the lab's reference range, making the criterion non-computable. The model doesn't flag the ambiguity. Guardrail: Add a requires_reference_range boolean and a notes field for ambiguous criteria. If a criterion references 'normal limits' or 'institutional standards' without a concrete value, set requires_reference_range: true and route to a human reviewer or reference-range lookup tool.
Evaluation Rubric
Criteria for evaluating the quality of extracted clinical trial inclusion criteria before integrating the output into a trial matching system or downstream application.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Schema Compliance | Output is valid JSON matching the [OUTPUT_SCHEMA] exactly; all required fields are present. | JSON parsing fails, required fields are missing, or extra fields are hallucinated. | Automated schema validation against the target JSON Schema definition. |
Condition Extraction Completeness | Every distinct medical condition mentioned in [INPUT_TEXT] is captured as a separate record in the output array. | A condition explicitly stated in the text is absent from the output array. | Manual review of a golden dataset; automated count comparison between extracted conditions and a pre-annotated list. |
Value and Unit Normalization | All quantitative values and units are extracted and normalized to the standard specified in [NORMALIZATION_RULES]. | A numeric value is missing its unit, or a unit is not converted to the canonical form (e.g., 'mg/dL' vs 'mg/dl'). | Regex check for value-unit pairing; dictionary lookup to confirm canonical unit forms. |
Temporal Constraint Accuracy | Temporal qualifiers (e.g., 'within 6 months', 'at screening') are correctly mapped to the | A temporal constraint is ignored, or a duration is incorrectly parsed (e.g., '6 weeks' extracted as '6 months'). | Assertion-based unit test comparing extracted temporal constraint object to a pre-defined expected value for specific text spans. |
Logical Operator Correctness | Complex criteria using 'AND', 'OR', 'NOT' are decomposed into a correct nested logical structure in the | A nested 'OR' is flattened into a simple list, or a 'NOT' operator is applied to the wrong condition group. | Structural comparison of the extracted logic tree against a manually constructed reference tree for a set of complex criteria. |
Implicit Exclusion Handling | Statements implying exclusion (e.g., 'patients without X are eligible') are correctly flagged with | An implicit exclusion is extracted as a positive inclusion criterion, or is completely missed. | Targeted test cases containing only implicit exclusion language, verified by checking the |
Confidence Score Calibration | A | A high confidence score is assigned to a criterion extracted from a nonsensical or contradictory sentence. | Statistical analysis of confidence score distribution against human-rated ambiguity labels on a test set. |
Source Grounding | Each extracted criterion includes a | The | Automated substring search to verify the presence of each |
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.
Adapt This Prompt
How to adapt
Start with the base prompt and a single trial protocol PDF. Use a frontier model with a simple JSON schema that captures condition, value, unit, and operator. Skip nested logic parsing initially—flatten complex criteria into a single description field. Run 10–20 protocols and manually spot-check outputs.
codeExtract inclusion criteria from [TRIAL_PROTOCOL_TEXT]. Return JSON array with fields: criterion_id, condition, value, value_unit, operator (one of: greater_than, less_than, equal_to, range, contains, not_contains), and raw_text.
Watch for
- Implicit exclusion criteria being misclassified as inclusion
- Value-unit mismatches (e.g., "≥ 18 years" parsed as value=18, unit="months")
- Temporal constraints silently dropped (e.g., "within 4 weeks" ignored)
- Nested AND/OR logic flattened without preserving precedence

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