FHIR Narrative Generator
Auto-generate FHIR narrative text from structured resources. Produce human-readable summaries instantly.
- Generate human-readable XHTML narrative text for FHIR resources automatically.
How to generate a FHIR narrative
- Paste a FHIR resource or drop a
.jsonfile. - The generator builds a human-readable summary and shows it as a rendered preview, as the XHTML for
text.div, and as the complete resource withtextadded. - Copy just the HTML, or download the resource with its narrative.
It runs in your browser.
What a narrative is for
Every DomainResource can carry a text element: an XHTML summary a person can read without understanding the data model. EHR viewers, PDF renderers and document workflows show it directly, and when the structured data is incomplete it's sometimes the only way information gets through. The specification recommends one on every resource; invariant dom-6 produces a warning when it's missing.
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Amy V. Shaw</b>, female, born 1987-02-20</p></div>"
}
status: generatedmeans the text was produced entirely from the structured data. Useextensionsif it also covers extensions, andadditionalif it contains information that isn't in the structured data.divmust be XHTML with thehttp://www.w3.org/1999/xhtmlnamespace, and only a safe subset of HTML is allowed: no scripts, forms, styles from outside, or event handlers.
Supported resources
Purpose-built layouts for Patient, Observation, Condition, MedicationRequest and Encounter. Any other resource type gets a generic summary of its main elements.
Safety
Values from the resource are HTML-escaped before they're placed into the narrative, so a name like <script> appears as text rather than running as code.
Limitations
- Generic summaries for other resource types are basic. Review them before using them in a document.
- The generator writes a new narrative. It doesn't merge with or preserve an existing
text. - Status is always
generated. If you edit the HTML to add information, change the status toadditional. - Narratives often repeat identifiers and demographics. If you'll share the resource, remember that the
textcontains the same personal data as the structured elements. The Anonymizer removestext.
FAQ
Should I store generated narratives or create them on display?
If you send resources to other systems, include the narrative: receivers may not be able to render your structured data. Inside your own system, generating on display keeps the text in sync with the data.
Does the narrative affect validation?
A missing narrative is a warning (dom-6), not an error. A malformed div (missing namespace, disallowed tags) is an error.
Is my resource uploaded?
No. The narrative is generated in this page.
Which FHIR versions does it support?
Narrative (text.status and text.div) is the same in R4, R4B and R5. The generator reads common elements such as names, codes, values and dates, which are in the same place in all three for the supported resource types.
FHIR Toolbox is a free collection of HL7 FHIR tools by Omindra Labs. The tools process your data in your browser; it is not uploaded for normal tool operations.