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
ADT^A04 register, A08 update, A40 merge · PID, PD1
Code setsHL7 tables (0001 sex, 0005 race, 0189 ethnicity); local MRN
Document header · recordTarget / patientRole (not a body section)
Code setsHL7 AdministrativeGender; CDC Race & Ethnicity (OMB); BCP 47 language
Patient
Code setsUS Core: OMB race and ethnicity, BCP 47 language
Insurance coverage
Patient & care team
Health plan, member ID, subscriber, group number
ADT, BAR · IN1, IN2
Code setsLocal plan codes; payer IDs
Payers section (48768-6) · Coverage Activity → Policy Activity
Code setsSource of Payment Typology (SOP)
Coverage
Code setsSource of Payment Typology
Care team & providers
Patient & care team
Attending physician, PCP, referring provider, care manager
PV1 attending/referring fields · ROL
Code setsNPI in provider fields
Document header · author, documentationOf / serviceEvent / performer
Code setsNPI; NUCC provider taxonomy
Practitioner, PractitionerRole, CareTeam
Code setsNPI; NUCC provider taxonomy
Encounters & visits
Clinical
Inpatient admission, ED visit, office visit, discharge
ADT^A01 admit, A02 transfer, A03 discharge · PV1, PV2
Code setsHL7 tables (0004 patient class, 0007 admission type)
Encounters section (46240-8) · Encounter Activity
Code setsCPT, SNOMED CT; diagnoses in ICD-10-CM
Encounter
Code setsHL7 ActCode class; CPT, SNOMED CT type
Diagnoses & problems
Clinical
Hypertension (I10), type 2 diabetes (E11.9), active problem list
ADT, ORM, DFT · DG1, PRB
Code setsICD-10-CM, SNOMED CT
Problems section (11450-4) · Problem Concern Act → Problem Observation
Code setsSNOMED CT required; ICD-10-CM as a translation
Condition
Code setsSNOMED CT, ICD-10-CM
Allergies & intolerances
Clinical
Penicillin, peanut, latex; reaction and severity
ADT · AL1, IAM
Code setsHL7 tables (0127 allergen type, 0128 severity); RxNorm or local codes
Allergies section (48765-2) · Allergy Concern Act → Allergy Intolerance Observation
Code setsRxNorm (drugs), UNII and SNOMED CT (foods, environment); reactions in SNOMED CT
AllergyIntolerance
Code setsRxNorm, SNOMED CT, UNII
Medications
Clinical
Prescriptions, inpatient administrations, home medication list
RDE^O11 order, RAS^O17 administration · RXO, RXE, RXA, RXR
Code setsNDC, RxNorm or local formulary codes
Medications section (10160-0) · Medication Activity
Code setsRxNorm (NDC as a translation); route from NCI Thesaurus; UCUM units
MedicationRequest, MedicationStatement
Code setsRxNorm
Lab results
Clinical
CBC, hemoglobin A1c, metabolic panel, cultures
ORU^R01 · OBR, OBX, NTE
Code setsLOINC (local lab codes common); UCUM units; HL7 table 0078 abnormal flags
Results section (30954-2) · Result Organizer → Result Observation
Code setsLOINC; UCUM units; HL7 interpretation codes
Observation, DiagnosticReport
Code setsLOINC, UCUM
Vital signs
Clinical
Blood pressure, heart rate, temperature, weight, BMI
ORU^R01 · OBX
Code setsLOINC (e.g. 8480-6 systolic BP); UCUM units
Vital Signs section (8716-3) · Vital Signs Organizer → Vital Sign Observation
Code setsLOINC; UCUM units
Observation (vital-signs profile)
Code setsLOINC, UCUM
Immunizations
Clinical
Seasonal flu, COVID-19, Tdap; lot number and site
VXU^V04 · RXA, RXR
Code setsCVX vaccine, MVX manufacturer, NDC
Immunizations section (11369-6) · Immunization Activity
Code setsCVX (NDC as a translation)
Immunization
Code setsCVX, NDC
Procedures
Clinical
Colonoscopy, knee replacement, cardiac catheterization
ADT, BAR, DFT · PR1
Code setsCPT, HCPCS, ICD-10-PCS
Procedures section (47519-4) · Procedure Activity
Code setsSNOMED CT, CPT, HCPCS, ICD-10-PCS
Procedure
Code setsSNOMED CT, CPT, ICD-10-PCS
Social history & SDOH
Clinical
Smoking status, housing instability, food insecurity, transportation needs
ORU^R01 · OBX (screening answers)
Code setsLOINC questions, SNOMED CT answers
Social History section (29762-2) · Social History Observation, Smoking Status
Code setsLOINC, SNOMED CT; ICD-10-CM Z codes
Observation, Condition
Code setsLOINC, SNOMED CT, ICD-10-CM Z codes
Orders & care plan
Clinical
Lab orders, imaging orders, referrals, follow-up instructions
ORM^O01, OML^O21, OMG^O19 · ORC, OBR
Code setsLOINC, CPT, local order codes
Plan of Treatment section (18776-5) · Planned Procedure, Planned Observation, Planned Act
Code setsLOINC, SNOMED CT, CPT
ServiceRequest, CarePlan
Code setsLOINC, SNOMED CT, CPT
Clinical notes & documents
Documents & imaging
History & physical, progress note, discharge summary, scanned PDFs
MDM^T02 · TXA, OBX (TX or ED)
Code setsLOINC document codes (often local document types)
Notes section · Note Activity; full notes usually travel as their own C-CDA type (Progress Note, Discharge Summary)
Code setsLOINC document and note codes
DocumentReference, Composition
Code setsLOINC document codes
Imaging & radiology
Documents & imaging
Chest X-ray report, MRI read, the images themselves
ORM/OMI orders, ORU^R01 reports · OBR, OBX
Code setsCPT, LOINC; images in DICOM
Results section (30954-2) · Result Observation; full reads go in a Diagnostic Imaging Report document
Code setsLOINC, SNOMED CT, DICOM codes
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
No v2 equivalent; a CCD file is sometimes embedded in MDM^T02 · OBX (ED)
Code setsLOINC document type
The whole document · template 2.16.840.1.113883.10.20.22.1.2
Code setsLOINC 34133-9 (Summarization of Episode Note)
Composition in a document Bundle, DocumentReference
Code setsLOINC 34133-9
Scheduling
Operational
New, rescheduled and cancelled appointments
SIU^S12 new, S14 modify, S15 cancel · SCH, AIS
Code setsLocal appointment types (HL7 table 0277)
Not a CCD section; future visits may appear in Plan of Treatment as a Planned Encounter
Code setsCPT, SNOMED CT
Appointment, Schedule, Slot
Code setsSNOMED CT service type; local codes
Charges & billing
Operational
Charge capture for a visit or procedure
DFT^P03 · FT1 (claims themselves move in X12 837)
Code setsCPT, HCPCS, ICD-10-CM, revenue codes
Not part of a CCD; only insurance appears, in the Payers section
Code sets—
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.

HL7 v2.x messages
pipe-delimited textThe 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 documentsA 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 APIsThe 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.1PID|1||MRN483920^^^SG_CLINIC^MR||DOE^JANE^A||19740312|FOBR|1|ORD5521|LAB7781|24323-8^Comprehensive metabolic panel^LN|||20261104073000OBX|1|NM|2345-7^Glucose [Mass/volume] in Serum or Plasma^LN||98|mg/dL|70-99|N|||FOBX|2|NM|2160-0^Creatinine [Mass/volume] in Serum or Plasma^LN||1.1|mg/dL|0.6-1.2|N|||F
An inpatient admission. ADT messages keep downstream systems in sync on who the patient is and where they are.
MSH|^~\&|REG|MAIN_HOSP|EHR|SG_CLINIC|20261105063000||ADT^A01^ADT_A01|MSG00017|P|2.5.1EVN|A01|20261105062800PID|1||MRN483920^^^MAIN_HOSP^MR||DOE^JANE^A||19740312|F|||100 MAIN ST^^HOUSTON^TX^77002PV1|1|I|4W^412^A|||||1234567890^SMITH^ROBERT^^^MDAL1|1|DA|7980^Penicillin G^RXNORM|SV|HivesDG1|1||I10^Essential (primary) hypertension^I10C
A progress note sent as a PDF. The file is Base64-encoded inside the OBX segment using the ED (encapsulated data) type.
MSH|^~\&|EHR|MAIN_HOSP|DOCREPO|SG_CLINIC|20261105091000||MDM^T02^MDM_T02|MSG00088|P|2.5.1PID|1||MRN483920^^^MAIN_HOSP^MR||DOE^JANE^A||19740312|FTXA|1|PN|AP|20261105090500|||||||DOC7712||||||AUOBX|1|ED|11506-3^Progress note^LN||^AP^PDF^Base64^JVBERi0xLjcKJeLjz9MK…(truncated)||||||F
The opening of a Continuity of Care Document. Template IDs tell the receiver which C-CDA rules the document follows.
<?xml version="1.0" encoding="UTF-8"?><ClinicalDocument xmlns="urn:hl7-org:v3"><templateId root="2.16.840.1.113883.10.20.22.1.2" extension="2015-08-01"/> <!-- CCD --><code code="34133-9" codeSystem="2.16.840.1.113883.6.1"displayName="Summarization of Episode Note"/><title>Continuity of Care Document</title><recordTarget> … patient demographics … </recordTarget><component><structuredBody><component><section><code code="48765-2" displayName="Allergies and adverse reactions"/>… narrative table + coded entries …</section></component></structuredBody></component></ClinicalDocument>
The same glucose result from the ORU example, expressed as a FHIR R4 Observation resource.
{"resourceType": "Observation","status": "final","category": [{ "coding": [{"system": "http://terminology.hl7.org/CodeSystem/observation-category","code": "laboratory" }] }],"code": { "coding": [{"system": "http://loinc.org","code": "2345-7","display": "Glucose [Mass/volume] in Serum or Plasma" }] },"subject": { "reference": "Patient/example-483920" },"effectiveDateTime": "2026-11-04T07:30:00-06:00","valueQuantity": { "value": 98, "unit": "mg/dL","system": "http://unitsofmeasure.org", "code": "mg/dL" }}
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.
| Extension | What is inside | Standard | How it usually arrives |
|---|---|---|---|
| .hl7 · .txt · .msg | HL7 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 v2 | MLLP over TCP for real-time feeds; SFTP for batches |
| .xml · .ccd · .cda | C-CDA documents: CCD, Discharge Summary, Referral Note, Progress Note, Care Plan.Example: a CCD returned from an HIE query. | HL7 CDA R2 | Direct Secure Messaging, HIE query, portal download |
| .json | A single FHIR resource or a Bundle of resources.Example: a Patient with linked Conditions and Observations. | HL7 FHIR R4 | FHIR REST API over HTTPS |
| .ndjson | Newline-delimited JSON, one FHIR resource per line, one file per resource type.Example: Observation.ndjson for an entire attributed population. | FHIR Bulk Data | Bulk $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 + CDA | Attachment on a Direct Secure Message |
| .pdf · .tif · .jpg | Scanned or rendered documents. Often Base64-embedded in an HL7 v2 OBX (ED type), a CDA nonXMLBody, or a FHIR Binary. | Carried by HL7 | Inside MDM messages, documents or DocumentReference |
| .dcm | Medical images with embedded metadata (CT, MRI, X-ray). HL7 carries the order and the report; DICOM carries the pixels. | DICOM | PACS-to-PACS transfer, DICOMweb |
| .x12 · .edi · .837 · .835 · .834 | Claims (837), remittance (835), enrollment (834), eligibility (270/271). | X12 EDI | Clearinghouse, SFTP; HIPAA-mandated transactions |
| .csv · .txt (flat file) | Custom extracts: rosters, quality measure feeds, registry files. Layout depends entirely on the sender's spec. | Proprietary | SFTP 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.
Receive and acknowledge
The interface engine accepts the message and returns an ACK: AA (accepted), AE (error) or AR (rejected).
Validate structure
Check required segments, data types, HL7 version and C-CDA or FHIR schema conformance.
Parse and normalize
Break messages into fields and convert dates, units and local codes into one consistent format.
Match the patient
Link incoming identifiers to the right person through the master patient index to prevent duplicates and overlays.
Map to standard codes
Translate local lab and medication codes to LOINC, SNOMED CT, RxNorm and ICD-10-CM.
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.
