HL7 CE Coded Element
HL7 datatype components CE components from HL7 v2.5.1 Hide components
These are the generated components for the version selected at the top of the page. The article stays practical, and this panel follows the chosen HL7 version.
Components
| Pos | Component | Name | Type | Table | Description |
|---|---|---|---|---|---|
| 1 | CE.1 | Identifier | ST | Identifier; Type ST. | |
| 2 | CE.2 | Text | ST | Text; Type ST. | |
| 3 | CE.3 | Name of Coding System | ID | 0396 | Name of Coding System; Type ID; HL7 table 0396. |
| 4 | CE.4 | Alternate Identifier | ST | Alternate Identifier; Type ST. | |
| 5 | CE.5 | Alternate Text | ST | Alternate Text; Type ST. | |
| 6 | CE.6 | Name of Alternate Coding System | ID | 0396 | Name of Alternate Coding System; Type ID; HL7 table 0396. |
CE is the classic HL7 coded element datatype. It carries a primary code, text, coding system, and an alternate code/text/system set. You see it in many v2.5.1 fields, especially demographics, orders, results, insurance, scheduling, diagnosis, observations, and older profile patterns.
CE is simpler than CWE. That simplicity is useful, but it also means there is no original-text component and no coding-system version component. If the receiver needs those details, CE may not be enough unless the field or profile gives another place to carry them.
The biggest CE mistake is the same one that haunts every coded datatype: sending the code without the coding system. A code is only meaningful inside a vocabulary. F might be female in one table, final in another, and a local finance code somewhere else. CE gives you a place to say which vocabulary you meant. Use it.
This example carries a primary HL7-table style code and a local alternate code that means the same thing. In a real message, the field definition and implementation guide decide which code system belongs in CE-3 and whether the alternate components should be populated.
CE-1 to CE-3: Identifier, Text, and Coding System
CE-1 is the identifier, CE-2 is the text, and CE-3 is the name of the coding system. Treat them as a set. CE-1 is for machines, CE-2 is for people, and CE-3 tells everyone which table or vocabulary owns the identifier.
Do not put a display phrase into CE-1 just because it is what the source screen shows. If the value is coded, send the code in CE-1 and the display text in CE-2. If the value is not coded and the field truly allows free text, check the profile carefully; CE may not be the right datatype for that use.
Text still needs HL7 escaping. If CE-2 can contain delimiter characters, use encoded writes or helpers such as HL7Encode(). A coded field can still break the message if the text component contains an unescaped caret.
CE-4 to CE-6: Alternate Identifier, Text, and Coding System
CE-4, CE-5, and CE-6 carry an alternate code, alternate text, and alternate coding system. This is usually where a local code travels beside a standard code, or where a receiver-specific code is carried beside the sender's native code.
The alternate code should mean the same thing as the primary code. It is not a second diagnosis, a second observation, or a convenient place for an unrelated local note. If the field repeats and you need multiple distinct coded concepts, repeat the field rather than jamming them into CE's alternate components.
Where CE Shows Up Most
CE appears in many older and still-common fields: race, language, marital status, religion, citizenship, diagnosis and procedure-style fields, observation identifiers in some versions, units, scheduling resources, insurance values, and plenty of local tables. In patient demographics, for example, PID-10 Race, PID-15 Primary Language, PID-16 Marital Status, and PID-22 Ethnic Group are common CE-style fields in the default data set.
In lab and result interfaces, CE values often sit close to OBX-3, units, abnormal flags, and coded answers depending on the HL7 version and profile. Pharmacy and immunization feeds may use CE or CWE depending on the field and version. When the standard and local profile disagree, the profile wins for the actual interface.
Practical Implementation Advice
Before mapping a CE field, decide the code system first. Is this an HL7 table, LOINC, SNOMED CT, ICD, ISO, CVX, a local table, or something else? Put the answer in CE-3. Then decide whether the local source code should be carried in CE-4 to CE-6.
Be careful with defaults. Using Default() to fill empty text can be reasonable for a display-only fallback if the guide allows it. Using it to create a fake code is not. Unknown, not asked, declined, other, and local exception values often have specific codes. If you do not know the right one, fix the mapping rather than inventing one.
When you inspect a coded field in HL7 Soup Web, the interpretation view can translate table-backed values into readable descriptions and link you back to the exact component in the raw message. That is handy for CE because a code, display text, and coding system can look plausible even when they are in the wrong components.
CE versus CWE
CE is the older, smaller structure. CWE is the more flexible coded-with-exceptions structure, with version IDs and original text in v2.5.1. If you are documenting or building a new interface, do not choose between them by taste. Use the datatype assigned to the field in the HL7 version and implementation guide.
If you are transforming between systems, the difference matters. A CWE original-text value has nowhere natural to go in CE. A coding-system version in CWE may be lost unless the target profile has another place for it. That loss may be harmless in a local display feed and unacceptable in a reporting feed.
Official Description and References
The HL7 v2 Chapter 2 datatype text describes CE as a coded element that transmits codes and associated text. It defines the identifier, text, coding system, alternate identifier, alternate text, and alternate coding system components, and notes that the coding system identifies the coding scheme used by the identifier.
For formal reference, compare the generated component panel above with the HL7 v2.4 Chapter 2 CE datatype text and HL7 table 0396 coding system terminology.
Related Datatypes and Segments
For nearby datatype work, look at CWE for coded values with exceptions, CX for identifiers with coded type detail, and HD for assigning authorities. For common segment uses, start with PID-10, PID-15, PID-16, PID-22, OBX, and OBR.