This prompt is designed for clinical data engineers and healthcare NLP teams who need to convert unstructured discharge summaries into typed, queryable records. It extracts four core payloads: diagnoses, procedures, medications, and follow-up instructions. Each finding includes source text spans, SNOMED CT or ICD-10-CM codes where mappable, negation status, and a confidence indicator. The prompt is built for production pipelines where missing fields, provisional diagnoses, and negated findings must be handled explicitly rather than silently dropped.
Prompt
Clinical Finding Extraction Prompt for Discharge Summaries

When to Use This Prompt
Defines the ideal use case, required context, and boundaries for the clinical finding extraction prompt.
Use this prompt when you have raw discharge summary text and need structured JSON that can be ingested into a clinical data warehouse, EHR analytics system, or research database. The prompt expects a complete discharge summary as input, not isolated sentences or partial notes. It works best with standard narrative sections—Hospital Course, Discharge Diagnoses, Discharge Medications, and Follow-Up Instructions—but can handle variations in section naming. Do not use this prompt for real-time clinical decision support, for extracting findings from imaging reports or lab results, or for generating billing codes without human review. The prompt is not a substitute for certified medical coding software and should not be used as the sole source of truth for regulatory submissions.
The prompt requires several inputs to function correctly: the full discharge summary text, a target output schema defining the four payload types, a terminology code system preference (SNOMED CT, ICD-10-CM, or both), and a confidence threshold for flagging uncertain extractions. You must also provide clear instructions for handling negated findings—such as 'no evidence of pneumonia'—and provisional diagnoses like 'suspected sepsis.' Without these constraints, the model may extract negated conditions as active problems or treat provisional diagnoses as confirmed. The prompt includes explicit handling for these edge cases, but you should validate outputs against your organization's clinical documentation improvement (CDI) guidelines.
Before deploying this prompt, prepare a golden dataset of 20–50 annotated discharge summaries with known diagnoses, procedures, medications, and follow-up items. Use this dataset to measure extraction recall, precision, and negation accuracy. Pay special attention to false positives from negated findings and false negatives from provisional or uncertain language. If your use case involves billing or quality reporting, add a human review step for all extractions with confidence below 0.85 or for any diagnosis mapped to a CMS quality measure. The prompt is a component in a larger pipeline, not a standalone solution—plan for validation, human review, and continuous monitoring of extraction quality over time.
Use Case Fit
Where the Clinical Finding Extraction Prompt works, where it breaks, and the operational preconditions required before putting it into a production pipeline.
Good Fit: Structured Discharge Summaries
Use when: input is a complete hospital discharge summary with standard sections (Diagnoses, Procedures, Medications, Follow-up). The prompt reliably extracts typed records with SNOMED/ICD-10 mapping when the source document follows predictable clinical narrative structure. Guardrail: validate that input contains a discharge summary header and at least two expected sections before invoking extraction.
Bad Fit: Real-Time ED Notes or Streaming Dictation
Avoid when: input is a partial emergency department note, real-time dictation transcript, or incomplete clinical jottings. The prompt expects a complete clinical picture and will hallucinate missing sections or over-confidently extract provisional findings as final. Guardrail: gate extraction behind a document completeness check; route incomplete notes to a draft-saving workflow instead.
Required Inputs: Document, Terminology Service, and Schema Contract
Risk: invoking the prompt without access to a terminology server for SNOMED/ICD-10 mapping produces unmapped or hallucinated codes. Guardrail: the extraction harness must provide a terminology lookup tool or validated code list as part of the prompt context. The output schema must be versioned and validated before downstream ingestion.
Operational Risk: Negation and Uncertainty Handling
Risk: the prompt may extract a mentioned diagnosis as an active finding without detecting negation ('no evidence of pneumonia') or uncertainty ('possible MI'). This creates false-positive records in downstream analytics and billing. Guardrail: require explicit negation and uncertainty fields in the output schema. Run a post-extraction validator that flags any finding without a negation status.
Operational Risk: Provisional Diagnosis Leakage
Risk: discharge summaries often list admission diagnoses, differential diagnoses, and final diagnoses. The prompt may conflate these, producing a single list that mixes ruled-out conditions with confirmed findings. Guardrail: the output schema must include a diagnosis_type field (Admission, Differential, Final, Comorbidity). Post-extraction, reconcile counts against the discharge summary section headers.
Not a Replacement for Clinical Review
Risk: downstream consumers may treat extracted findings as clinically validated truth. The prompt produces structured data from text, not clinical judgment. Guardrail: every extracted record must carry a provenance pointer to the source span and a human-review flag for high-risk findings (allergies, critical lab values, new malignancies). The extraction pipeline must route flagged records to a clinical review queue before ingestion.
Copy-Ready Prompt Template
A reusable prompt for extracting structured clinical findings from discharge summaries, ready for adaptation with your own schemas, code sets, and constraints.
This prompt template is designed to extract diagnoses, procedures, medications, and follow-up instructions from a hospital discharge summary. It enforces structured JSON output, maps findings to SNOMED CT and ICD-10-CM where possible, and explicitly handles negation, uncertainty, and provisional diagnoses. Replace each square-bracket placeholder with your specific data, schema definitions, and operational constraints before sending it to the model. The template is self-contained and can be used directly in an API call, a prompt management system, or a local evaluation harness.
textYou are a clinical data extraction assistant. Your task is to read a hospital discharge summary and extract structured clinical findings. ## INPUT Discharge Summary Text: [DISCHARGE_SUMMARY_TEXT] ## OUTPUT SCHEMA Return a single JSON object with the following structure: { "patient_encounter": { "admission_date": "string or null (ISO 8601)", "discharge_date": "string or null (ISO 8601)", "encounter_type": "string (e.g., inpatient, observation, emergency)" }, "diagnoses": [ { "description": "string (the diagnosis as stated in the text)", "icd10cm_code": "string or null (best-match ICD-10-CM code)", "snomed_ct_code": "string or null (best-match SNOMED CT concept ID)", "status": "string (active, resolved, chronic, provisional, ruled-out)", "is_primary": boolean, "is_present_on_admission": boolean or null, "certainty": "string (confirmed, probable, possible, negated)", "evidence_span": "string (exact text supporting this extraction)" } ], "procedures": [ { "description": "string", "cpt_code": "string or null", "snomed_ct_code": "string or null", "performed_date": "string or null (ISO 8601)", "status": "string (performed, planned, cancelled, contraindicated)", "evidence_span": "string" } ], "medications": [ { "name": "string (generic name preferred)", "rxnorm_code": "string or null", "dose": "string or null", "route": "string or null", "frequency": "string or null", "status": "string (active, discontinued, prescribed, held, refused)", "is_discharge_medication": boolean, "evidence_span": "string" } ], "follow_up_instructions": [ { "instruction": "string", "specialty": "string or null", "timeframe": "string or null (e.g., 1 week, 2 weeks, as needed)", "evidence_span": "string" } ], "extraction_metadata": { "negation_flags_detected": ["string (list of negated concepts found)"], "uncertainty_notes": ["string (list of ambiguous or conflicting statements)"], "missing_sections": ["string (expected sections not found in the text)"], "confidence_overall": "string (high, medium, low)" } } ## CONSTRAINTS - Use the exact JSON schema above. Do not add or remove fields. - For every extracted finding, include the exact evidence_span from the text. - If a finding is explicitly negated (e.g., "no evidence of pneumonia"), set certainty to "negated" and include it in the diagnoses list with status "ruled-out". - If a diagnosis is described as provisional, possible, or suspected, set certainty to "probable" or "possible" and status to "provisional". - Map to SNOMED CT and ICD-10-CM codes only when you have high confidence. Use null when uncertain. - For medications, prefer generic names and map to RxNorm when possible. - If a section of the discharge summary is missing (e.g., no follow-up instructions), list it in missing_sections. - Do not fabricate findings. If the text does not support a field, use null or an empty array as appropriate. - Set confidence_overall to "low" if the text is ambiguous, incomplete, or contains conflicting information. ## EXAMPLES [FEW_SHOT_EXAMPLES] ## RISK LEVEL [HIGH_RISK_WARNING: This extraction is for clinical decision support and must be reviewed by a qualified clinician before use in patient care. Do not rely on automated extraction for billing, treatment decisions, or regulatory reporting without human validation.]
After copying the template, replace [DISCHARGE_SUMMARY_TEXT] with the raw text of the discharge summary you are processing. Replace [FEW_SHOT_EXAMPLES] with 2–4 annotated examples that demonstrate correct handling of negation, provisional diagnoses, and missing sections. Replace [HIGH_RISK_WARNING] with your organization's specific risk language and escalation policy. If you are using a model that supports structured output or function calling, you can replace the JSON schema block with a tool definition or response format parameter. Always validate the output against your schema before ingestion, and route extractions with confidence_overall: "low" or certainty: "possible" to a human review queue.
Prompt Variables
Required inputs for the Clinical Finding Extraction Prompt. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to check that the input is well-formed and safe.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[DISCHARGE_SUMMARY_TEXT] | Full text of the discharge summary to extract findings from | Patient is a 72-year-old male admitted for CHF exacerbation... | Non-empty string; max 32k chars; strip PHI if sending to external model endpoint |
[TARGET_FINDING_TYPES] | Comma-separated list of finding categories to extract | diagnoses, procedures, medications, follow-up_instructions | Must be a subset of allowed enum: diagnoses, procedures, medications, follow-up_instructions, lab_results, allergies |
[CODING_SYSTEMS] | Target terminology systems for code mapping | SNOMED-CT, ICD-10-CM | Must be a comma-separated list from allowed values: SNOMED-CT, ICD-10-CM, LOINC, RxNorm, CPT; at least one required |
[OUTPUT_SCHEMA] | JSON Schema describing the expected output shape | {"type": "object", "properties": {"findings": {"type": "array"... | Must be valid JSON Schema draft-07; parse check before prompt assembly; reject if schema contains circular refs |
[NEGATION_TERMS] | Custom list of negation triggers for the target domain | denies, no evidence of, ruled out, without | Optional; if provided, must be a JSON array of strings; if null, use default clinical negation set |
[UNCERTAINTY_THRESHOLD] | Confidence score below which findings are flagged for human review | 0.7 | Float between 0.0 and 1.0; null allowed to disable threshold-based escalation |
[INSTITUTIONAL_STYLE_GUIDE] | Local documentation conventions for abbreviation expansion and formatting | Expand all abbreviations on first use; use generic drug names only | Optional; if provided, must be a string under 500 chars; null allowed |
[MAX_FINDINGS_PER_TYPE] | Upper limit on extracted findings per category to prevent unbounded output | 50 | Integer between 1 and 200; null allowed to use default of 100 |
Implementation Harness Notes
How to wire the Clinical Finding Extraction prompt into a production healthcare data pipeline with validation, retries, and human review.
This prompt is designed to be called as a single step within a larger clinical data ingestion pipeline, not as a standalone chat interface. The discharge summary text should be pre-processed to remove any PHI that is not required for clinical extraction (per your organization's de-identification protocol) before being passed into the [DISCHARGE_SUMMARY_TEXT] placeholder. The [TARGET_SCHEMA] placeholder should be populated with a strict JSON Schema definition that matches your downstream data warehouse or FHIR store contract. The [TERMINOLOGY_BINDINGS] placeholder should contain a mapping of extracted concept types to their required coding systems (e.g., diagnosis: SNOMED CT, ICD-10-CM).
Wire the prompt into an application function that enforces a strict retry-and-review loop. On each invocation, parse the model's JSON output and validate it against the provided [TARGET_SCHEMA]. If validation fails, catch the specific schema errors and feed them back into the [PREVIOUS_OUTPUT] and [VALIDATION_ERRORS] placeholders of a retry prompt. Implement a maximum of two automatic retries. If the output still fails schema validation after two retries, or if the model's confidence field for any critical finding falls below a configurable threshold (e.g., 0.85), route the entire record to a human review queue. Log every attempt, the raw model output, validation errors, and the final disposition (auto-accepted, auto-rejected after retries, or escalated) for auditability.
For model choice, use a model with strong JSON mode and a large context window to accommodate lengthy discharge summaries and detailed schemas. Enable structured output mode (JSON mode) at the API level as a first line of defense against malformed responses, but do not rely on it alone—always apply the post-hoc schema validation. Do not use this prompt for real-time clinical decision support; it is designed for retrospective batch processing of finalized discharge summaries. The extracted data should be treated as a preliminary coding suggestion and must be reviewed by a qualified clinical coder before being used for billing, quality reporting, or downstream clinical analytics.
Expected Output Contract
Defines the exact shape, types, and validation rules for the JSON payload produced by the Clinical Finding Extraction Prompt. Use this contract to build downstream ingestion, write automated tests, and configure retry or repair logic.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
findings | Array of objects | Must be present and parseable as a JSON array. An empty array is valid only if no findings are detected. | |
findings[].type | Enum: DIAGNOSIS | PROCEDURE | MEDICATION | FOLLOW_UP | Must match one of the allowed enum values exactly. Case-sensitive. | |
findings[].description | String | Must be a non-empty string. Length must be between 1 and 500 characters. | |
findings[].code | Object | If present, must contain a valid coding object. Null is allowed when no code is assigned. | |
findings[].code.system | String (URI) | true if code present | Must be a valid URI string, e.g., http://snomed.info/sct or http://hl7.org/fhir/sid/icd-10-cm. |
findings[].code.value | String | true if code present | Must be a non-empty string matching the format of the specified coding system. |
findings[].negation_status | Enum: AFFIRMED | NEGATED | UNCERTAIN | Must be one of the allowed enum values. Defaults to AFFIRMED if not explicitly stated. | |
findings[].confidence | Number | If present, must be a float between 0.0 and 1.0 inclusive. Null is allowed when confidence is not assessed. | |
findings[].source_span | String | Must be a non-empty string containing the exact text excerpt from the discharge summary that supports this finding. |
Common Failure Modes
Production extraction pipelines fail in predictable ways. These are the most common failure modes for clinical finding extraction from discharge summaries, with concrete guardrails to catch them before they reach downstream systems.
Negation Scope Leakage
What to watch: The model extracts a finding but misses the negation context. 'Patient denies chest pain' becomes an extracted chest pain finding. 'No evidence of pneumonia' becomes a pneumonia diagnosis. Negation words like 'no,' 'denies,' 'without,' 'ruled out,' and 'negative for' are missed or their scope is incorrectly bounded across sentence boundaries. Guardrail: Include explicit negation detection instructions in the prompt with examples of negated vs. affirmed findings. Add a negation_status field to every extracted finding. Run a post-extraction validator that flags any finding whose source span contains a negation cue without the corresponding negation flag set.
Provisional Diagnosis Misclassification
What to watch: The model treats provisional, suspected, or differential diagnoses as confirmed findings. Language like 'suspected sepsis,' 'possible MI,' 'cannot rule out PE,' or 'differential includes' gets extracted as established diagnoses without uncertainty flags. This contaminates downstream analytics and clinical decision support with unconfirmed conditions. Guardrail: Require a certainty field with controlled values (confirmed, provisional, ruled-out, differential). Include few-shot examples showing how 'suspected X' maps to provisional certainty. Add a post-extraction rule that rejects any finding with provisional certainty from automated ingestion into confirmed diagnosis registries without human review.
Temporal Context Collapse
What to watch: The model extracts findings but strips away when they occurred or whether they are current, historical, or resolved. A past condition from the 'Past Medical History' section gets extracted alongside active problems from the 'Hospital Course' section with no temporal distinction. 'History of CVA 2019' and 'acute CVA on admission' both become undifferentiated stroke findings. Guardrail: Include a temporal_context field with values like current-admission, past-resolved, past-ongoing, and unknown. Instruct the model to use section headers as temporal signals. Add a validator that checks whether findings from the Past Medical History section carry appropriate temporal labels and flags mismatches for review.
Medication Reconciliation Drift
What to watch: The model confuses admission medications, hospital-administered medications, and discharge medications into a single undifferentiated list. A medication stopped on day 2 appears alongside a new discharge prescription with no indication of status. 'Continue metformin' and 'start metformin' both produce a metformin entry without the action distinction. Guardrail: Require a medication_status field (admission, continued, new, discontinued, held, discharge). Include explicit instructions to extract medication changes from the discharge medication reconciliation section. Add a cross-field validator that checks for logical consistency—a medication cannot be both 'discontinued' and 'discharge' simultaneously.
SNOMED/ICD-10 Mapping Hallucination
What to watch: The model generates plausible-sounding but incorrect or fabricated SNOMED CT or ICD-10-CM codes when the clinical text is ambiguous or the model lacks the specific code. 'Mild renal impairment' might map to a fabricated code or an overly specific code like 'Chronic kidney disease stage 3' when the text doesn't support that specificity. Guardrail: Do not rely on the model's parametric knowledge for code mapping. Use a retrieval step that looks up candidate codes from a validated terminology server or code database, then have the model select the best match from retrieved candidates. Add a validator that checks every returned code against a known terminology release and flags any code not present in the expected version.
Family History Contamination
What to watch: The model extracts family history findings as patient findings. 'Father with colon cancer at 52' becomes a patient colon cancer diagnosis. 'Mother has diabetes' becomes a patient diabetes finding. This is especially dangerous when family history is embedded in narrative sections rather than clearly separated in a dedicated Family History section. Guardrail: Include a subject field on every finding with values patient, family-member, or unknown. Add few-shot examples showing family history extraction with subject=family-member. Implement a section-aware validator that flags any finding extracted from a Family History section that lacks the family-member subject label. For narrative sections, add a post-extraction review rule requiring human confirmation for any finding where the subject is ambiguous.
Evaluation Rubric
Criteria for testing the quality and safety of extracted clinical findings before integrating the prompt into a production pipeline. Each row defines a pass standard, a failure signal, and a concrete test method.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Schema Compliance | Output is valid JSON matching the [OUTPUT_SCHEMA] exactly; no extra or missing required fields. | JSON parse error, missing required field, or unexpected field present. | Automated schema validator run against 100 golden discharge summaries. |
Negation Detection | Negated findings (e.g., 'no evidence of MI') are correctly flagged with | Negated finding appears in the active | Assertion model check on a curated set of 50 sentences with explicit negation cues. |
Uncertainty Handling | Provisional or suspected diagnoses (e.g., 'rule out PE') are captured with | Provisional diagnosis is recorded as a confirmed finding with | Review output for 20 summaries containing hedge words ('possible', 'suspected', 'cannot exclude'). |
Code Mapping Accuracy | Extracted findings map to a valid SNOMED CT or ICD-10 code in the | Code does not exist in the target terminology server or is semantically mismatched (e.g., diabetes code for hypertension). | Terminology server lookup validation on extracted codes from 50 outputs. |
Source Grounding | Every extracted finding includes a non-empty |
| Automated substring match test between |
Medication Normalization | Medication names are normalized to RxNorm ingredients; dose, route, and frequency are parsed into discrete fields. | Brand name used without ingredient mapping, or free-text dose string ('two tablets') not parsed into structured value/unit. | RxNorm API validation and structured field presence check on 30 medication lists. |
Null vs. Missing Distinction | Fields with no information in the source are explicitly | Empty string or absent key used where | Schema check for null type and presence of |
Hallucination Rate | Zero invented clinical facts not supported by the [DISCHARGE_SUMMARY] text. | A diagnosis, procedure, or medication appears in the output with no corresponding evidence in the source document. | Manual clinical review of 100 outputs, flagging any unsupported assertion for root cause analysis. |
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
Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet) and minimal post-processing. Focus on getting the extraction schema right before adding validation layers. Start with a small set of 10-20 discharge summaries that represent your typical document mix.
codeExtract clinical findings from the discharge summary below. Return JSON matching [OUTPUT_SCHEMA]. Discharge Summary: [DISCHARGE_SUMMARY_TEXT]
Watch for
- Schema drift when the model invents field names not in your contract
- Missing negation handling for "no evidence of," "ruled out," "denies"
- Provisional diagnoses rendered as confirmed without uncertainty flags
- ICD-10 codes hallucinated for findings that lack sufficient specificity

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