This page is part of the FHIR Specification (v0.11: DSTU 1 Ballot 3). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3 R2
Each resource may include a human readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but SHOULD contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.
The narrative for a resource is allowed to contain additional information that is not in the structured data, including human-edited content. Such additional information must be in the scope of the definition of the resource, though it is common for the narrative to include additional descriptional information extracted from other referenced resources.
While resources SHOULD always contain narrative, so that to support human-consumption as a fall back, in a strictly managed trading systems where all systems share a common data model, and additional text is unnecessary or even a clinical safety risk, the narrative may be omitted. However implementers should consider carefully before doing this, as it will mean that these resources can only be understood in the limited trading environment, and closed trading partner environments are very likely to open up during the lifetime of the resources they define.
Note that Contained Resources SHALL NOT have a narrative of their own.
The narrative is an xhtml fragment that also includes images if appropriate:
<[name] xmlns="http://hl7.org/fhir"> <!-- from Element: extension --> <status value="[code]"/><!-- 1..1 generated | extensions | additional --> <div xmlns="http://www.w3.org/1999/xhtml"< <!-- Limited xhtml content< --> </div> </[name]>
Path | Definition | Type | Reference |
---|---|---|---|
Narrative.status | The status of a resource narrative | Fixed | http://hl7.org/fhir/narrative-status |
The contents of the div element are an XHTML fragment containing only the basic html formatting elements described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, <a> elements (either name or href), images and internally contained style attributes. The XHTML content must not contain a head, a body element, external stylesheet references, scripts, forms, base/link/xlink, frames, iframes, and objects. The div element must have some non-whitespace content.
<narrative> <div xmlns="http://www.w3.org/1999/xhtml">This is a simple example with only plain text</div> </narrative> <narrative> <div xmlns="http://www.w3.org/1999/xhtml"> <p> This is an <i>example</i> with some <b>xhtml</b> formatting. </p> </div> </narrative>
The inner portion of the div content is often used for the innerHTML property in a browser. In order to simplify processing, the narrative SHALL be encoded so that the character content between the first ">" and the last "<" characters is the content of the <div> element.
Note that the XHTML is contained in general XML, and so there is no support for HTML entities like or © etc. Unicode characters should be used instead. Note that   substitutes for .
The narrative content should be in the language of the resource, but there is no reason to expect that HTML type tooling would understand the resource language element. For this reason, a lang attribute on the <div> should also be used (and see the note in the HTML 5 specification about use of language).
The image source references may be a local reference within the resource:
<img src="#a5"/>
This is an internal reference to an id attribute on an element in the same resource, either an element of type "Attachment", or a contained Binary resource.
<Patient xmlns="http://hl7.org/fhir"> <text> <status value="generated"/> <div xmlns="http://www.w3.org/1999/xhtml"> <p>... <img src="#pic1"/>. ....</p> </div> </text> <contained> <Binary id="pic1" contentType="image/gif">MEKH....SD/Z</Binary> </contained>
Since the availability of images that are not contained in the resource is not guaranteed, when the resource is presented to a user, the source for any images that are an essential part of the narrative should always be embedded in an attachment or a contained resource.
The XHTML fragment in the narrative may be styled using CSS in the normal fashion, using a mix of classes, ids and in-line style elements. Specific CSS stylesheets will be applied to the XHTML when it is extracted from the resource to be displayed to a human to create the presentation desired in the context of use. Authors may fix the following styling aspects of the content:
These style properties are specified in-line using the style attribute. If an equivalent html element exists, such as "i", or "pre", it may be used instead, but note that some of these elements are deprecated in HTML 4 and must not be used in Narrative XHTML (including "u", and "font").
Rendering systems are required to respect any of these rendering styles when they are specified in the XHTML, though appropriate interpretation is allowed (e.g. a low-contrast display for dark room contexts or a high-contrast display for the visually impaired may adjust colors accordingly).
Authors are allowed to specify additional styles and style properties as specified in the CSS specification, but these are extensions to this specification and renderers are not required to honor them. Note, however, the additional rules around styling that apply in the context of documents.
Note: styles in resources can make use of the styles defined in the standard FHIR stylesheet, which lives here: http://hl7.org/implement/standards/fhir/fhir.css. Since this stylesheet is not referred to directly, rendering systems may take their own copy if they wish. Authoring systems should not depend on these styles being supported in order to render clinical content correctly without trading partner agreement.