Sage & Grey Advisors · Data reference

Clinical data and how it moves through HL7

Every clinical exchange carries two things: the data itself (a lab value, a diagnosis, a discharge summary) and the package it travels in (an HL7 v2 message, a C-CDA document, a FHIR resource). This guide maps both, so you know what to expect when a partner says they will "send it over HL7."

What the data is

Demographics, encounters, results, medications and the rest of the patient record.

How it is structured

HL7 v2 messages, CDA documents, or FHIR resources, each with its own code sets.

What lands on your server

.hl7, .xml, .json, .ndjson, .zip, .pdf and a few non-HL7 neighbors.

Part 1

Types of clinical data

Each domain below shows real-world examples, then where it lives and how it is coded in three formats: an HL7 v2 message, a CCD (Continuity of Care Document), and FHIR.

Patient demographics

Patient & care team

Name, date of birth, sex, race, ethnicity, language, address, MRN

HL7 v2

ADT^A04 register, A08 update, A40 merge · PID, PD1

Code setsHL7 tables (0001 sex, 0005 race, 0189 ethnicity); local MRN

CCD

Document header · recordTarget / patientRole (not a body section)

Code setsHL7 AdministrativeGender; CDC Race & Ethnicity (OMB); BCP 47 language

FHIR

Patient

Code setsUS Core: OMB race and ethnicity, BCP 47 language

Insurance coverage

Patient & care team

Health plan, member ID, subscriber, group number

HL7 v2

ADT, BAR · IN1, IN2

Code setsLocal plan codes; payer IDs

CCD

Payers section (48768-6) · Coverage Activity → Policy Activity

Code setsSource of Payment Typology (SOP)

FHIR

Coverage

Code setsSource of Payment Typology

Care team & providers

Patient & care team

Attending physician, PCP, referring provider, care manager

HL7 v2

PV1 attending/referring fields · ROL

Code setsNPI in provider fields

CCD

Document header · author, documentationOf / serviceEvent / performer

Code setsNPI; NUCC provider taxonomy

FHIR

Practitioner, PractitionerRole, CareTeam

Code setsNPI; NUCC provider taxonomy

Encounters & visits

Clinical

Inpatient admission, ED visit, office visit, discharge

HL7 v2

ADT^A01 admit, A02 transfer, A03 discharge · PV1, PV2

Code setsHL7 tables (0004 patient class, 0007 admission type)

CCD

Encounters section (46240-8) · Encounter Activity

Code setsCPT, SNOMED CT; diagnoses in ICD-10-CM

FHIR

Encounter

Code setsHL7 ActCode class; CPT, SNOMED CT type

Diagnoses & problems

Clinical

Hypertension (I10), type 2 diabetes (E11.9), active problem list

HL7 v2

ADT, ORM, DFT · DG1, PRB

Code setsICD-10-CM, SNOMED CT

CCD

Problems section (11450-4) · Problem Concern Act → Problem Observation

Code setsSNOMED CT required; ICD-10-CM as a translation

FHIR

Condition

Code setsSNOMED CT, ICD-10-CM

Allergies & intolerances

Clinical

Penicillin, peanut, latex; reaction and severity

HL7 v2

ADT · AL1, IAM

Code setsHL7 tables (0127 allergen type, 0128 severity); RxNorm or local codes

CCD

Allergies section (48765-2) · Allergy Concern Act → Allergy Intolerance Observation

Code setsRxNorm (drugs), UNII and SNOMED CT (foods, environment); reactions in SNOMED CT

FHIR

AllergyIntolerance

Code setsRxNorm, SNOMED CT, UNII

Medications

Clinical

Prescriptions, inpatient administrations, home medication list

HL7 v2

RDE^O11 order, RAS^O17 administration · RXO, RXE, RXA, RXR

Code setsNDC, RxNorm or local formulary codes

CCD

Medications section (10160-0) · Medication Activity

Code setsRxNorm (NDC as a translation); route from NCI Thesaurus; UCUM units

FHIR

MedicationRequest, MedicationStatement

Code setsRxNorm

Lab results

Clinical

CBC, hemoglobin A1c, metabolic panel, cultures

HL7 v2

ORU^R01 · OBR, OBX, NTE

Code setsLOINC (local lab codes common); UCUM units; HL7 table 0078 abnormal flags

CCD

Results section (30954-2) · Result Organizer → Result Observation

Code setsLOINC; UCUM units; HL7 interpretation codes

FHIR

Observation, DiagnosticReport

Code setsLOINC, UCUM

Vital signs

Clinical

Blood pressure, heart rate, temperature, weight, BMI

HL7 v2

ORU^R01 · OBX

Code setsLOINC (e.g. 8480-6 systolic BP); UCUM units

CCD

Vital Signs section (8716-3) · Vital Signs Organizer → Vital Sign Observation

Code setsLOINC; UCUM units

FHIR

Observation (vital-signs profile)

Code setsLOINC, UCUM

Immunizations

Clinical

Seasonal flu, COVID-19, Tdap; lot number and site

HL7 v2

VXU^V04 · RXA, RXR

Code setsCVX vaccine, MVX manufacturer, NDC

CCD

Immunizations section (11369-6) · Immunization Activity

Code setsCVX (NDC as a translation)

FHIR

Immunization

Code setsCVX, NDC

Procedures

Clinical

Colonoscopy, knee replacement, cardiac catheterization

HL7 v2

ADT, BAR, DFT · PR1

Code setsCPT, HCPCS, ICD-10-PCS

CCD

Procedures section (47519-4) · Procedure Activity

Code setsSNOMED CT, CPT, HCPCS, ICD-10-PCS

FHIR

Procedure

Code setsSNOMED CT, CPT, ICD-10-PCS

Social history & SDOH

Clinical

Smoking status, housing instability, food insecurity, transportation needs

HL7 v2

ORU^R01 · OBX (screening answers)

Code setsLOINC questions, SNOMED CT answers

CCD

Social History section (29762-2) · Social History Observation, Smoking Status

Code setsLOINC, SNOMED CT; ICD-10-CM Z codes

FHIR

Observation, Condition

Code setsLOINC, SNOMED CT, ICD-10-CM Z codes

Orders & care plan

Clinical

Lab orders, imaging orders, referrals, follow-up instructions

HL7 v2

ORM^O01, OML^O21, OMG^O19 · ORC, OBR

Code setsLOINC, CPT, local order codes

CCD

Plan of Treatment section (18776-5) · Planned Procedure, Planned Observation, Planned Act

Code setsLOINC, SNOMED CT, CPT

FHIR

ServiceRequest, CarePlan

Code setsLOINC, SNOMED CT, CPT

Clinical notes & documents

Documents & imaging

History & physical, progress note, discharge summary, scanned PDFs

HL7 v2

MDM^T02 · TXA, OBX (TX or ED)

Code setsLOINC document codes (often local document types)

CCD

Notes section · Note Activity; full notes usually travel as their own C-CDA type (Progress Note, Discharge Summary)

Code setsLOINC document and note codes

FHIR

DocumentReference, Composition

Code setsLOINC document codes

Imaging & radiology

Documents & imaging

Chest X-ray report, MRI read, the images themselves

HL7 v2

ORM/OMI orders, ORU^R01 reports · OBR, OBX

Code setsCPT, LOINC; images in DICOM

CCD

Results section (30954-2) · Result Observation; full reads go in a Diagnostic Imaging Report document

Code setsLOINC, SNOMED CT, DICOM codes

FHIR

ImagingStudy, DiagnosticReport

Code setsLOINC, DICOM modality codes

Summary of care (CCD)

Documents & imaging

A snapshot of all the clinical domains above, sent at referrals, discharges and HIE queries

HL7 v2

No v2 equivalent; a CCD file is sometimes embedded in MDM^T02 · OBX (ED)

Code setsLOINC document type

CCD

The whole document · template 2.16.840.1.113883.10.20.22.1.2

Code setsLOINC 34133-9 (Summarization of Episode Note)

FHIR

Composition in a document Bundle, DocumentReference

Code setsLOINC 34133-9

Scheduling

Operational

New, rescheduled and cancelled appointments

HL7 v2

SIU^S12 new, S14 modify, S15 cancel · SCH, AIS

Code setsLocal appointment types (HL7 table 0277)

CCD

Not a CCD section; future visits may appear in Plan of Treatment as a Planned Encounter

Code setsCPT, SNOMED CT

FHIR

Appointment, Schedule, Slot

Code setsSNOMED CT service type; local codes

Charges & billing

Operational

Charge capture for a visit or procedure

HL7 v2

DFT^P03 · FT1 (claims themselves move in X12 837)

Code setsCPT, HCPCS, ICD-10-CM, revenue codes

CCD

Not part of a CCD; only insurance appears, in the Payers section

Code sets—

FHIR

ChargeItem, Claim

Code setsCPT, HCPCS, ICD-10-CM

Part 2

The three HL7 formats

"HL7" is a family of standards. The same lab result can arrive in any of these shapes depending on the sender's system and the purpose of the exchange.

Infographic comparing HL7 Version 2 (pipe-delimited text, meaning from position) with HL7 Version 3 (XML with named tags), plus three common misconceptions.

HL7 v2.x messages

pipe-delimited text

The workhorse of hospital interfaces since the 1980s. Event-driven: something happens (an admit, a resulted lab) and a message fires.

  • Segments (MSH, PID, OBX) on separate lines
  • Fields split by |, components by ^
  • Versions 2.3 to 2.5.1 most common

CDA / C-CDA documents

XML documents

A complete, signed clinical document: a summary of care, a discharge summary, a referral note. Human-readable and machine-readable in one file.

  • Header (who, when, where) plus coded sections
  • Required for certified EHR exchange (ONC)
  • CCD (Continuity of Care Document) is the most common: a patient summary of problems, medications, allergies and results

FHIR

JSON / XML over APIs

The modern, web-based standard. Data is broken into small resources (Patient, Observation) that apps request through REST APIs.

  • R4 is the version in production use
  • US Core profiles define the US baseline
  • Bulk FHIR exports whole populations

A metabolic panel result. Each OBX line is one result, coded in LOINC with units and a reference range.

MSH|^~\&|LAB_SYS|NORTH_LAB|EHR|SG_CLINIC|20261105081500||ORU^R01^ORU_R01|MSG00042|P|2.5.1
PID|1||MRN483920^^^SG_CLINIC^MR||DOE^JANE^A||19740312|F
OBR|1|ORD5521|LAB7781|24323-8^Comprehensive metabolic panel^LN|||20261104073000
OBX|1|NM|2345-7^Glucose [Mass/volume] in Serum or Plasma^LN||98|mg/dL|70-99|N|||F
OBX|2|NM|2160-0^Creatinine [Mass/volume] in Serum or Plasma^LN||1.1|mg/dL|0.6-1.2|N|||F

All sample messages use fictional patients, providers and identifiers.

Part 3

File types you will receive

The file extension tells you which standard to expect and how the receiving system should parse it. Several common formats sit next to HL7 in the same pipelines without being HL7.

ExtensionWhat is insideStandardHow it usually arrives
.hl7 · .txt · .msgHL7 v2 messages, one segment per line. Batch files wrap many messages between FHS/BHS headers and BTS/FTS trailers.Example: a nightly file of 4,000 ORU lab results.HL7 v2MLLP over TCP for real-time feeds; SFTP for batches
.xml · .ccd · .cdaC-CDA documents: CCD, Discharge Summary, Referral Note, Progress Note, Care Plan.Example: a CCD returned from an HIE query.HL7 CDA R2Direct Secure Messaging, HIE query, portal download
.jsonA single FHIR resource or a Bundle of resources.Example: a Patient with linked Conditions and Observations.HL7 FHIR R4FHIR REST API over HTTPS
.ndjsonNewline-delimited JSON, one FHIR resource per line, one file per resource type.Example: Observation.ndjson for an entire attributed population.FHIR Bulk DataBulk $export for payers, ACOs and analytics
.zip (XDM)An IHE XDM package: an IHE_XDM/SUBSET01/ folder holding CDA files and METADATA.XML, plus INDEX.HTM and README.TXT.IHE XDM + CDAAttachment on a Direct Secure Message
.pdf · .tif · .jpgScanned or rendered documents. Often Base64-embedded in an HL7 v2 OBX (ED type), a CDA nonXMLBody, or a FHIR Binary.Carried by HL7Inside MDM messages, documents or DocumentReference
.dcmMedical images with embedded metadata (CT, MRI, X-ray). HL7 carries the order and the report; DICOM carries the pixels.DICOMPACS-to-PACS transfer, DICOMweb
.x12 · .edi · .837 · .835 · .834Claims (837), remittance (835), enrollment (834), eligibility (270/271).X12 EDIClearinghouse, SFTP; HIPAA-mandated transactions
.csv · .txt (flat file)Custom extracts: rosters, quality measure feeds, registry files. Layout depends entirely on the sender's spec.ProprietarySFTP with a data dictionary

MLLP

Minimal Lower Layer Protocol. The standard TCP wrapper for real-time HL7 v2 feeds through an interface engine.

SFTP

Scheduled batch drops of v2 batch files, flat files and X12.

Direct Secure Messaging

Encrypted, email-like exchange between providers, usually carrying C-CDA or XDM packages.

FHIR APIs

REST calls for single patients, and Bulk FHIR for populations. Required of certified EHRs.

HIE networks

Query-based exchange through regional HIEs and national networks such as Carequality, CommonWell and TEFCA.

Part 4

What happens after a file arrives

Receiving the file is the easy part. Usable data depends on each of these steps, in this order.

  1. Receive and acknowledge

    The interface engine accepts the message and returns an ACK: AA (accepted), AE (error) or AR (rejected).

  2. Validate structure

    Check required segments, data types, HL7 version and C-CDA or FHIR schema conformance.

  3. Parse and normalize

    Break messages into fields and convert dates, units and local codes into one consistent format.

  4. Match the patient

    Link incoming identifiers to the right person through the master patient index to prevent duplicates and overlays.

  5. Map to standard codes

    Translate local lab and medication codes to LOINC, SNOMED CT, RxNorm and ICD-10-CM.

  6. Load and reconcile

    Write to the EHR or data platform, then reconcile counts against the source to catch dropped records.

Working with Sage & Grey

Turning incoming feeds into data you can trust

Sage & Grey Advisors brings three decades of payer and provider experience to clinical data exchange. We help organizations:

  • Write interface specifications and onboard new HL7 and FHIR trading partners
  • Map and validate clinical data from v2, C-CDA and FHIR sources
  • Profile data quality and reconcile loads before they reach reporting
  • Model clinical data for analytics platforms, including Databricks

HL7, CDA and FHIR are registered trademarks of Health Level Seven International. Code sets referenced: LOINC, SNOMED CT, RxNorm, NDC, ICD-10-CM, ICD-10-PCS, CPT, HCPCS, CVX, UCUM.