Skip to content

Tables

The code lists that give coded fields their meaning, and who maintains them.

A table is a list of the codes that a coded field can contain, together with the meaning of each code. Many HL7v2 fields hold a code rather than text: administrative sex is F or M, a patient class is I for inpatient or O for outpatient, and a result status is F for final or P for preliminary. The definition of each coded field names its table: PID-8, administrative sex, takes its codes from table 0001.

Tables give coded values a shared meaning. The source and the destination agree on the codes and their meanings before any message is exchanged, so a message can carry F instead of a description, and a value outside the table can be recognized as an error.

Table types

The standard distinguishes tables by who defines their content: HL7, each site, or another organization.

HL7 tables

An HL7 table is defined by HL7 as part of the standard, and its values are used without modification. HL7 tables define elements of the standard itself, such as message types, trigger events, and acknowledgment codes, so they do not vary between sites.

TableNameValues such as
0076Message typeADT, ORU
0003Event typeA01, R01
0008Acknowledgment codeAA, AE, AR

User-defined tables

A user-defined table holds values that vary between institutions and jurisdictions. HL7 assigns the table a number and usually suggests values, but each site defines the codes it uses: it can adopt the suggested values, add codes, or replace the table. Most sites adopt the suggested values where they fit, because a different code for the same concept requires translation at every interface.

TableNameSuggested values such as
0001Administrative sexF, M, U
0002Marital statusS, M, D
0004Patient classI, O, E

A site can also define tables of its own, with numbers that HL7 has not assigned, for local fields such as those of Z-segments.

External tables

An external table is defined by another organization. Clinical vocabularies for laboratory tests, diagnoses, procedures, and drugs are too large, and change too often, to be maintained within the standard, so HL7v2 refers to them instead of defining them. A message identifies the vocabulary of each such code through a coding system identifier.

Coding systems

A coding system is a vocabulary from which a code is taken. The standard assigns each coding system a short identifier, listed in table 0396, so that a coded value can name the vocabulary of its code:

IdentifierCoding system
LNLOINC (opens in a new tab), for laboratory tests and observations
HL7nnnnAn HL7 or user-defined table; HL70001 is table 0001
99zzzA local coding system; the site chooses zzz

Table 0396

Table 0396 is itself an HL7 table, but its function differs from that of the others. It does not list the values of a field; it identifies the coding system that a value comes from.

Coded values

A coded field holds its code in one of two forms.

In the code-only form, the field holds the code alone, as in PID-8 with the value F. The message does not identify the table to which F belongs; the definition of the field does.

In the composite form, the field holds the code together with its text and its coding system, in the first three components:

ComponentContentExample
1The code2345-7
2The text of the codeGlucose
3The coding system identifierLN

2345-7^Glucose^LN in OBX-3 therefore represents LOINC code 2345-7, named Glucose, and F^Female^HL70001 represents code F from table 0001, meaning Female. Components 4 to 6 carry an alternate code, the same concept in a second coding system, in the same three-part form. A laboratory that uses its own test codes can send GLU^Glucose^99LAB^2345-7^Glucose^LN, so that a destination that recognizes LOINC but not the laboratory's codes can use the alternate code.

The coded data types, and the fields that use each form, differ between versions of the standard. Data types describes the coded types, and the data type reference lists their components.

Binding

A table is bound to a field in the segment definition: PID-8, for example, takes its codes from table 0001. For most coded fields, this is the only binding, and the table constrains the code in the first component.

Some fields bind tables to individual components instead. MSH-9, the message type field, takes its first component from table 0076 and its second, the trigger event, from table 0003. Composite data types bind tables in the same way, such as the identifier type of a patient identifier in PID-3.

HL7 Terminology

HL7 publishes the HL7v2 tables on HL7 Terminology (opens in a new tab), together with the vocabularies of CDA and FHIR. Table 0001, for example, is published as http://terminology.hl7.org/CodeSystem/v2-0001, and each code has a display name and a status of active, deprecated, or retired.

The tables are maintained there independently of the standard's releases, and their contents are machine-readable. An identifier also has the same meaning in an HL7v2 message, a CDA document, and a FHIR resource, which supports the mapping of HL7v2 messages to FHIR: a value with HL70001 as its coding system maps to a FHIR coding with the v2-0001 system without loss of meaning.

Trade-offs

Tables let a message carry short codes with a shared meaning, at costs that appear where systems meet:

  • Brevity. A source can send F instead of "female", because the source and the destination use the same table.
  • Shared meaning. The composite form carries the coding system with each code, so the meaning of a value does not depend on an agreement made outside the message.
  • Local variation. User-defined tables let each site define its own codes, and many sites do. Interface engines commonly translate one site's values for a table such as 0004 into another's.
  • Several codes. A composite value can carry a primary code and an alternate code, so a destination must check both to find a code that it recognizes.
  • Code-only values. A code-only value has a meaning only together with the field definition: F means female only in PID-8. The composite form addresses this limitation, but most production systems still send only the code.

Further reading