Type to start searching...

HL7Mapping : Message

Maps message parts to segments and fields in a Health Level Seven (HL7), v2.x file.

Description

HL7 Version 2.x defines a series of electronic messages to support administrative, logistical, financial as well as clinical processes. Since 1987 the standard has been updated regularly, resulting in versions 2.1, 2.2, 2.3, 2.3.1, 2.4, 2.5, 2.5.1 and 2.6. Collectively these versions are known as version 2.x. The v2.x standards are backwards compatible, i.e. a message based on version 2.3 will be understood by an application that supports version 2.6.

HL7 v2.x mostly uses a textual, non-XML encoding syntax based on delimiters. A sample follows:


MSH|^~\|Meg|Xyz|Sub|XyzI|20060529090131-0500||ADT^A01|0105|P|2.5
EVN||200605290901||||200605290900
PID|||567^^^UA^PI||KIM^JOE^Q^JR||19620910|M||2028-9^^HL70005^RA99113^^...
...

Each segment (row) in a message has an identifying tag, such as MSH or PID, followed by some number of fields and sub-fields that are arranged by position.

The root part of the message must be mapped to the name of the message. e.g. To map the example message above, the name of the mapping on the root part should be ADT^A01.

Each message has a special header segment that contains control information. The header's tag is MSH. If the message has no message part mapped to MSH, the header will still be processed and defaults will be used. If there is a part mapped to MSH, the header fields may be accessed or set through the message. A sample MSH message structure is available in the message HL7_base.

See the "name", "seq" and "subtype" properties for more information on mapping.

Grouping: Non-mapped message parts may be used for grouping segments. When representing a complex structure, you may use a non-mapped collection part to represent the group. Set the unmapped part to be a collection (ie. 0..0) to represent repeating groups. Non-mapped parts may be nested to an arbitrary level. e.g. if we have a structure like


             MSG|...
             PID|...
             G1|... (repeating group)
             P1|...
             P1|...
             P1|...
             G1|... (repeating group)
             P1|...
             ...

   We may define a message structure as:
   ADT1       (mapped to ADT^A01)
      PID     (mapped to PID)
      G1Group (collection - not mapped)
         G1   (mapped to G1)
         P1   (collection - mapped to P1)

Message Reuse: HL7 messages support message inheritance and reuse as described in the Message (Root Message) "base" and Message (Message Part) "ref" property. The level of the reusable message depends on its root mapping: no mapping implies group, name and seq implies segment, seq only implies field.

"z" segments and the "lax" property: To ignore unexpected "z" segments set the lax property on any parent message part under which you may encounter them. For information on the "lax" property see the Message (Message Part) "lax" property - (Root Part) as well. For information on "z" segments, see http://www.hl7standards.com/blog/2006/10/05/what-are-z-segments/.

Properties
length : nonNegativeInt

Maximum allowed length for the attribute's value.

Valid values based on“int”.
0 (minInclusive)
name : string

HL7 segment name.

Set the name property to the identifying tag of the segment. Along with the segment name, the number of fields in the segment must be indicated in the "seq" property to create proper outbound messages.

Segments will be output in the order in which they are defined in the message.

Example


MSH
PID
EVN

seq : positiveInt

HL7 field sequential number.

If the segment "name" property is set the number of fields in the segment must be indicated in the "seq" property to create proper outbound messages.

On fields set the "seq" property to the position within it's parent segment or field.

Valid values based on“int”.
1 (minInclusive)
subtype

Value Subtype. On timestamp type values, you may specify a subtype of date, time or datetime.

Valid values based on“string”.
DTM

Time Stamp (Date & Time)

DT

Date

TM

Time

Parents
  • Value - A value (or primitive) message part.
  • Message - A message (or composite) message part.
  • Message
  • Message - A message carries information from a source system to a destination system over an integration channel.