HL7 CDA Explained: Formatting Medical Records in XML

The Health Level Seven (HL7) Clinical Document Architecture (CDA) is an international standard for the electronic exchange and management of clinical documents. By utilizing Extensible Markup Language (XML), CDA establishes a standardized structure that allows electronic health record (EHR) systems to share patient information seamlessly. This guide explains what the HL7 CDA standard is, how it utilizes XML to balance human-readable narratives with machine-readable data, and the specific structural components that make up a standard CDA document.

What Is HL7 CDA?

HL7 Clinical Document Architecture (CDA) is a document markup standard defined by Health Level Seven International. Developed as part of HL7 Version 3, CDA governs the syntax and semantics of “clinical documents” such as discharge summaries, progress notes, referral letters, and physical examination reports.

Every CDA document must satisfy six core characteristics: * Persistence: The document remains unchanged over time. * Stewardship: The document is maintained by an organization or person entrusted with its care. * Authentication: The document includes a legal authentication of the clinical content. * Context: The document establishes its own default clinical context (patient, provider, encounter). * Wholeness: The document can be authenticated as a complete, standalone unit. * Human Readability: A human must be able to read the definitive clinical content using standard web browsers or generic XML stylesheets without specialized clinical software.

The Dual-Layer XML Structure of CDA

HL7 CDA formats clinical data into an XML schema divided into two primary parts: the Header and the Body.

1. The CDA Header

The Header contains metadata that identifies the document and sets the clinical context. It is strictly structured using predefined XML tags to identify: * The Patient: Demographics, identifiers, and contact details within <recordTarget>. * The Author: The healthcare provider or device that created the document within <author>. * The Custodian: The organization responsible for maintaining the document within <custodian>. * The Document Type: Defined by standardized coding systems (such as LOINC) within <code\>. * The Encounter: Details about the specific clinical visit within <componentOf>.

2. The CDA Body

The Body contains the actual clinical information, enclosed within the <structuredBody> tag. The body is organized into distinct clinical sections, such as Allergies, Medications, Problem Lists, and Vital Signs. Each section contains two essential layers: * Narrative Block (<text>): This layer contains human-readable content rendered using basic formatting tags (tables, lists, paragraphs). This ensures any provider can read the medical record even if their software cannot parse advanced data entries. * Coded Entries (<entry>): This layer wraps the clinical data into structured XML tags with standardized medical terminologies. It enables machine-processing for decision-support tools, analytics, and automated EHR import.

The Three Levels of CDA Implementation

To accommodate various technical capabilities, CDA allows for three levels of XML formatting:

Example of CDA XML Data Representation

In a Level 3 CDA document, an active medication like Aspirin is represented with both human-readable and machine-processable data within the <substanceAdministration> XML element:

<section>
  <templateId root="2.16.840.1.113883.10.20.22.2.1.1"/>
  <code code="10160-0" codeSystem="2.16.840.1.113883.6.1" displayName="History of Medication Use"/>
  <title>Medications</title>
  <text>
    <table>
      <thead>
        <tr><th>Medication</th><th>Instructions</th></tr>
      </thead>
      <tbody>
        <tr><td>Aspirin 81 MG Oral Tablet</td><td>Take 1 tablet daily</td></tr>
      </tbody>
    </table>
  </text>
  <entry>
    <substanceAdministration classCode="SBADM" moodCode="EVN">
      <consumable>
        <manufacturedProduct classCode="MANU">
          <manufacturedMaterial>
            <code code="243670" codeSystem="2.16.840.1.113883.6.88" displayName="Aspirin 81 MG Oral Tablet"/>
          </manufacturedMaterial>
        </manufacturedProduct>
      </consumable>
    </substanceAdministration>
  </entry>
</section>

Through this standard XML framework, HL7 CDA guarantees that critical health information remains portable, verifiable, and usable across different clinical information systems.