Tim BensonTim Benson

HL7 Version 3 is a lingua franca used by healthcare computers to talk to other computers. HL7 V3 has been adopted by NHS Connecting for Health for all national applications, to help provide information when and where needed. The name HL7 comes from ‘Healthcare’ and the top level (Level 7) of the Open Systems Interconnection (OSI) model, which carries the meaning of information exchanged between computer applications.

Two versions of HL7 are in use – Version 2 and Version 3. This article relates to HL7 Version 3. Version 2 is mainly used within individual hospitals; this article relates to HL7 Version 3.

Why is HL7 needed?

A specialised healthcare language is required to avoid the sort of ambiguity that is common in everyday medical English. Computers cannot deal with synonyms (saying the same thing using different words) or homonyms (where the same term or phrase means different things depending on context). Furthermore, healthcare data is uniquely complex in scope and structural complexity. Joined-up healthcare is difficult when patients have multiple problems and are being treated by several specialists in different locations.

HL7 and XML

HL7 messages are XML documents, which look somewhat similar to HTML. Each message is a string of text with information enclosed by tags, wrapped in angle brackets. Start tags look like <tag> and end tags look like </tag>. Tags can be qualified by attributes such as <tag attribute="value">. The HL7 tags and attributes are derived from the HL7 Reference Information Model (RIM) and the HL7 Data Types. The structure of each HL7 message is set out in an XML schema, which specifies the tags and attributes needed or allowed in the message, their order and the number of times each may occur, together with annotations describing how each tag shall be used. HL7 message schemas are lengthy, detailed and verbose text documents. 

The HL7 RIM – Reference Information Model

Every language, including HL7, has a grammar. The HL7 RIM specifies the grammar of HL7 messages and, specifically, the basic building blocks of the language and their permitted relationships. The RIM is not a model of healthcare, although it is healthcare specific, nor is it a model of any message, although it is used in messages. At first site the RIM is quite simple. The RIM backbone has just five core classes and a number of permitted relationships between them.

In HL7, every happening is an Act, which is analogous to a verb in English. Each Act may have any number of Participations, in Roles, played by Entities. These are analogous to nouns. Each Act may also be related to other Acts, via Act-Relationships.

Act, Role and Entity classes also have a number of specialisations. For example, Entity has a specialisation called Living Subject, which itself has a specialisation called Person. Person inherits the attributes of both Entity and Living Subject.

Structural Attributes

Structural attributes are used to specify more precisely what each RIM class means when used in a message. For example, Act has a class code and a mood code. The class code states what sort of Act this is, such as an observation, an encounter, or the administration of a drug. Mood is analogous to the tense of a verb. Mood code indicates whether an Act has happened (an event), or is a request for something to happen, or a goal or even a criterion. For example, "weight = 100kg" is an observation event; "measure weight daily" is a request; "reduce weight to 80Kg" is a goal and "if weight is greater than 80Kg" is a criterion.

Attributes and Data Types

The RIM defines a set pre-defined Attributes for each class and these are the only ones allowed in HL7 messages. Each attribute has a specified Data Type. These Attributes and Data Types become tags in HL7 XML messages.


Message specifications, to do a particular task, use a sub-set of the available RIM Attributes, listing each element used and how many repeats are allowed. This is known as refinement. Each Data Type is constrained to the simplest structure that meets the requirements of the task.

Identifiers and Codes

One common data type is the Instance Identifier, which is used to give unique identity to people, persons, organisations, things and information objects.

HL7 uses two main types of code. The first type covers the specialised codes used for structural attributes and are defined by HL7 itself. The second type covers externally defined terms and codes such as SNOMED CT (Clinical Terms).

RMIM – Refined Message Information Model

HL7 has developed a notation, called Refined Message Information Model (RMIM), which displays the structure of a message as a colour-coded diagram. Most RMIMs can be shown on a single sheet of paper or PowerPoint slide and these RMIM diagrams are used to design messages and to explain what each HL7 message consists of.

Scope and Extensibility

HL7 covers the whole scope of healthcare communications in an unambiguous way, using a relatively small set of constructs, which need to be learnt. Healthcare communications are complex and any language needs to accommodate this complexity and also handle future needs.

Further information can be found on the HL7 UK web site.

Tim Benson


Abies (HL7 training)