The Path
Module 2 · Reading an HL7 v2 message·10 min
Code tables
F, I, H, A: letters that mean something. HL7 tables and local tables.
F, O, H, P: an HL7 v2 message is full of single letters. Each one points to a code table, a closed list where every code has a precise meaning. Know the common tables and you can read a message without opening the standard.
Click OBX-8 in this sleep lab report, then OBX-11.
A sleep study report. The lab sends the hospital record an AHI of 28.5/h, flagged “high”: moderate sleep apnea.
OBX-8 is H: the value is above normal. OBX-11 is F: the result is final. Two letters, two different tables.
A table is a number and a list of codes
Every table has a four-digit number. For each coded field, the standard says which table to use. A few examples:
PID-8, administrative sex, uses table 0001;PV1-2, patient class, uses table 0004;OBX-8, the abnormal flag, uses table 0078.
The same letter changes meaning with the field. F in PID-8 means “female”. F in OBX-11 means “final”. So you never read a code on its own: you read a code in a field.
Three families of tables
HL7 v2.5.1 sorts tables into three families.
- HL7 tables. HL7 defines and publishes the values. They change what the message means, so a site cannot redefine them. It can only add values. Example: 0085, result status.
- User-defined tables. The values depend on the site. HL7 often publishes suggested values as a starter set, which each hospital adapts. Example: 0004, patient class.
- External tables. Another organization publishes the codes: LOINC for lab tests, ICD-10 for diagnoses. HL7 just carries them.
A handy clue: in 2.5.1, a field of type ID usually points to an HL7 table, a field of type IS to a user-defined table.
The tables you will meet every day
| Table | Field | Family (v2.5.1) | Common codes |
|---|---|---|---|
| 0001 Administrative sex | PID-8 |
user | F female, M male, O other, U unknown, A ambiguous, N not applicable |
| 0004 Patient class | PV1-2 |
user | I inpatient, O outpatient, E emergency, P preadmit, R recurring |
| 0078 Abnormal flags | OBX-8 |
user | N normal, L low, H high, LL and HH beyond panic limits, A abnormal |
| 0085 Result status | OBX-11 |
HL7 | F final, P preliminary, C correction, R not verified, X cannot be obtained |
| 0103 Processing ID | MSH-11 |
HL7 | P production, T training, D debugging |
| 0008 Acknowledgment code | MSA-1 |
HL7 | AA accept, AE error, AR reject |
| 0125 Value type | OBX-2 |
HL7 | NM numeric, ST short string, TX long text, CE coded, SN structured numeric |
Two details that matter:
- Table 0078 is “user-defined” in 2.5.1, but nearly everyone uses the suggested values. In recent versions (v2+), it became an HL7 table.
OBX-2drives how you readOBX-5. WithNM, the value is a number. WithST, it is text.
Try it: the message below is editable. Change the L in OBX-8 to LL, then click the field.
The sleep lab sends the lowest oxygen saturation recorded during Marie Dubois’s night.
Local codes and the little ^L
Most software has its own codes. The lab codes hemoglobin HB, another system calls it HGB. HL7 plans for this.
In a coded field (type CE), the third component names the coding system. Values come from table 0396: LN for LOINC, I10 for ICD-10, and L for a local code defined by the site. You saw it above: SPO2MIN^Lowest SpO2^L. Even the study itself can be coded both ways: this message codes the polysomnography locally, PSG^Overnight polysomnography^L, while the lab’s shared report uses the LOINC code 90568-7^Polysomnographie^LN. Both are legitimate, as long as the receiver knows which one to expect.
And the units, % or /h in OBX-6? They can come from a coding system too, UCUM, built for units of measure. You will meet it again in the terminologies lesson.
The CE type even has room for two codes for the same concept: components 4 to 6 carry an alternate code. So a lab can send its in-house code and the LOINC code side by side:
OBX|1|NM|HB^Hemoglobin^L^718-7^Hemoglobin [Mass/volume] in Blood^LN||11.2|g/dL|12.0-16.0|L|||F
Why code mapping matters
The receiver only understands its own codes. If the lab sends HB and the patient record expects 718-7, the result lands in the wrong box, or nowhere. User-defined tables hide the same trap: the standard itself says patient class has no consistent industry-wide definition.
That is why an interface almost always starts with a mapping table: source code, target code, table by table. The interface engine applies it to every message.
Where to find the tables
The official site terminology.hl7.org publishes every v2 table as CodeSystem-v2-0001, CodeSystem-v2-0085, and so on. Bookmark it. One caveat: it shows the latest version, sometimes with codes added after 2.5.1.
And in FHIR?
FHIR keeps the idea of tables, under the names code systems and value sets. Some words change: sex F becomes female in Patient.gender. Others stay: Observation.interpretation uses the same letters H, L and N as OBX-8. The source differs, though: those codes come from the v3-ObservationInterpretation code system, not from table 0078. Same letters, different code system.
Check your understanding
1 of 5You receive a result with OBX-8 = H. What does it mean?
+50 XPPass the quiz (4 correct answers) to complete the lesson.
Reviewed and checked on 27 September 2026