Merge: HL7 Toolkit V. 5.4.0
Merge: HL7 Toolkit V. 5.4.0
V. 5.4.0
SEGMENT MAP USER INTERFACE (UI)
SAMPLE APPLICATION GUIDE
Merge Healthcare
900 Walnut Ridge Drive
Hartland WI 53029
USA
877.44.MERGE
Copyright 2017 Merge Healthcare Incorporated, an IBM Company.
The content of this document is confidential information of Merge Healthcare Incorporated and its use and
disclosure is subject to the terms of the agreement pursuant to which you obtained the software that
accompanies the documentation.
Merge Healthcare is a registered trademark of Merge Healthcare Inc.
The Merge Healthcare logo is a trademark of Merge Healthcare Inc.
All other names are trademarks or registered trademarks of their respective companies.
DICOM is a registered trademark of National Electrical Manufacturers Association (NEMA). Merge DICOM
Toolkit is a trademark of Merge Healthcare. The names of other products mentioned in this document may
be the trademarks or registered trademarks of their respective companies.
U.S. GOVERNMENT RESTRICTED RIGHTS:
This product is a Commercial Item offered with Restricted Rights. The Governments rights to use,
modify, reproduce, release, perform, display or disclose this documentation are subject to the restrictions
set forth in Federal Acquisition Regulation (FAR) 12.211 and 12.212 for civilian agencies and in DFARS
227.7202-3 for military agencies. Contractor is Merge Healthcare.
International, call Merge Healthcare (in Canada) +1-905-672-7990, then select option 2
Email [email protected]
Contents
INTRODUCTION ................................................................................................... 4
Files .................................................................................................................... 4
Message File................................................................................................... 4
Script File ........................................................................................................ 4
Conventions ........................................................................................................ 5
THE MAP WINDOW .............................................................................................. 5
Message Display Window .................................................................................. 6
Properties Window ............................................................................................. 9
Script Editing Window....................................................................................... 10
Script Display Window ...................................................................................... 11
SEGMENT MAPS ................................................................................................ 12
Hl7 Parsing Script ............................................................................................. 13
Macro Definition ............................................................................................ 13
ADDSEG ....................................................................................................... 13
DELSEG ....................................................................................................... 14
FIELD ............................................................................................................ 15
EQUAL .......................................................................................................... 15
FIRST............................................................................................................ 16
LAST ............................................................................................................. 16
PREPEND ..................................................................................................... 17
APPEND ....................................................................................................... 17
REPLACE ..................................................................................................... 18
REMOVE ...................................................................................................... 18
STRIPL ......................................................................................................... 19
STRIPT ......................................................................................................... 19
SUBSTR ....................................................................................................... 20
STRTOK ....................................................................................................... 20
VALUEMAP .................................................................................................. 21
Adding a Segment Map .................................................................................... 22
Adding a segment map in the script editing window ..................................... 22
Shortcuts of adding segment maps .............................................................. 22
Editing a Segment Map .................................................................................... 23
Deleting a Segment Map .................................................................................. 23
Input Hint and Error Checking .......................................................................... 24
3
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Introduction
The Segment Map User Interface (UI) Sample Application is a graphical tool that
allows users to quickly create mapping specifications between HL7 messages.
The mapping specification can be created as scripts following a specific grammar
and saved to a text file. The main toolkit provides interfaces to load this script file
and perform actual mapping from an input HL7 message instance to an output
HL7 message instance.
This guide provides the information required to understand the functionality of this
tool. It is intended to be used by service engineers who want to:
Files
This tool supports loading HL7 messages and segment map scripts from files.
Both operations are optional. If no file is loaded, a segment map script can still be
created; however, if there is a message instance loaded from the file, the
operations are not abstract any more. Immediate mapping effects will be
displayed and provide a more clear view for the user.
Message File
Input Files
This tool supports loading one and only one HL7 encoded message from a file. If
there are multiple messages stored in the file, only the first one can be read
successfully.
The start of the message is determined by the presence of an MSH segment, and
the end of a message is reached if it meets either of the following conditions:
The end of a line with presence of an MSH segment in the next line.
A line is defined as a sequence of characters followed by a carriage return ("\r"), a
line feed ("\n") or a carriage return immediately followed by a line feed ("\r\n").
Note: Be careful when editing message files using text editors because they
may secretly add some control characters that will interfere with the
parsing of the message.
Script File
This tool supports loading pre-exist segment maps from a script file following a
certain format. Usually, each line of the file represents a mapping specification
4
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Conventions
Throughout this guide, the following conventions and visual cues are used:
Words shown in large, boldface text, such as Exit, indicate application functions
that you can click with the mouse (e.g., buttons, menu items).
Words shown in upper case, such as FIRST, indicate segment map statement
keywords.
Sample Margin Note Margin notes (in the left margin) are used to highlight important points or sections
of the document.
Note: Notes are used to indicate information which may be helpful or of special
interest to the reader.
Properties window
5
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Of the views above, the message display window together with properties window
makes up the message detail window and the properties window is closable; the
script editing window together with the script display window make up the script
detail window.
The spaces of the above views can be redistributed by moving the splitter cursor
between them. Some views can also be relocated under a limit of range. For
example, the message detail and script detail can be swapped by click the
button between them, so does the script display pane and the script editing
pane by clicking the button.
These views are fully described in the following section.
6
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Message Display
Window
The red x icon indicates that the segment this message element belongs
to is deleted.
The green plus icon indicates that the segment this message element
belongs to is added.
The yellow lock icon indicates that all the sub-elements of this message
element remain unchanged during the mapping.
7
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
The blue refresh icon indicates that the value of this message element is
changed during the mapping.
A Message element is uniquely identified by its location in the message following
a certain format:
SegmentId.X.Y.Z.
Of which, the SegmentId could be the segment name if this message contains
only one of this segment type or a segment name with index if this is a repeated
segment in the message; X, Y, Z indicates the sequence number of the element
in each layer of container element. For example, the only MSH segment in a
message is identified as MSH; the family name component of the patient name
field of the only PID segment is PID.5.1; the set ID field of the second OBR
segment in the message is OBR[1].1.
If the script editing view is empty, the script display window will be synchronized
with the message display view. As showed below, when browsing the PID.19
message element, related segment map will be highlighted and scrolled into view.
8
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Script Display
Window
Properties Window
When browsing the message, the properties of each selected element will be
displayed in the properties window if its set to be visible. This window shares
spaces with the message display window and set to be just under it. It can be
closed clicking the button on the top right. To make it visible, right click on a
message element and select Properties from the context menu.
Properties
Window
9
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
This segment map contains two atomic statements which are identified as Node1
and Node2.
Node2 manipulates the component PID.5.2 and appends a string FATIMA.A.S
to the end of it.
Node1 manipulates Node and assign the first 12 characters of it to the
subcomponent PID.5.1.1.
Script Editing
Window
10
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
script display window by clicking the button; and if its a node ID which must
be equal to the ID of this statement, this statement is a nested one and can only
be used as parameters by the other statements. The button is used to remove
a statement from this window.
This UI provides a dynamic view for the user. The values of the input field and the
whole statement change immediately in accordance with the context which
consists of the message loaded, the script loaded, and the parameters.
Edit for displaying this segment map graphically in the script editing
window. Any change in that window can be saved to update this map
specification.
Delete used to remove the selected segment map from the script.
Comment State Switch for changing the comment state of this segment
map by removing the comment tag from the beginning of this line if it has one
or adding a comment tag to the beginning of this line if it doesnt.
11
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Script Display
Window
This window also contains three buttons. Load Script is used to load a script file;
Clear Script will remove all the segment maps from the window; Save Script can
be used to save all the contents in this window to a file.
Segment Maps
The segment map specifications supported can be divided into three categories:
Macro definition
12
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
wizard and supply several parameters and click a button to generate an error-free
segment map.
Note: Parameter of type Stmt could be any of the field manipulation statements
below or a string. Parameters within square brackets are optional.
Macro Definition
Syntax:
@@MACRONAME = MACROVALUE
Graphical Representation:
ADDSEG
Syntax:
ADDSEG(segmentType,messsageIndex)
Description:
This command allows you to add a new segment at the specified place.
Adding segments is confined to be PRESCRIPT which indicates that this
command happens before any field manipulation. The index number of the
PRESCRIPT specifies the execution order of it. The smaller is the number, the
more advanced that script is applied.
Because adding segments will change the index numbers of the segments that
follow the added segment, you should add segments in reverse order (i.e.
Highest-numbered segments first).
13
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Example:
PRESCRIPT1 = ADDSEG("PV2", 4)
Graphical Representation:
DELSEG
Syntax:
DELSEG(segmentId)
DELSEG(messsageIndex)
DELSEG(messsageIndex1,messsageIndex2)
Description:
This command allows you to delete (a) segment(s) in any of the following four
modes.
1. Specify a segment type. This will delete all instances of the specified
segment type. For example, DELSEG(EVN)
2. Specify a segment type and an index number. This will delete the
specified instance of the specified segment type. For example, DELSEG
(OBX [0]) will delete the first OBX segment in the message.
3. Specify a 0-based index number. This will delete the specified segment.
For example, DELSEG(1) will delete the second segment in the
message.
4. Specify a range of index numbers. This will delete all segments inclusive
of the index numbers. For example, DELSEG(2,4) will delete the 3rd, 4th,
5th segments in the message.
DELSEG can be used as a PRESCRIPT or a POSTSCRIPT which indicates that
this command happens after all the field manipulation. The index number of the
PRESCRIPT or POSTSCRIPT specifies the execution order of it. The smaller is
the number, the more advanced that script is applied.
Because deleting segments will change the index numbers of the segments that
follow the deleted segment, you should delete segments in reverse order (i.e.
Highest-numbered segments first).
Example:
14
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
POSTSCRIPT1=DELSEG ("EVN")
Graphical Representation:
FIELD
Syntax:
FIELD (String fieldLocation)
Description:
Copy the value of a specified field.
Example:
PID.3.1 = FIELD ("PID.2.1")
Graphical Representation:
EQUAL
Syntax:
EQUAL(Stmt() a, Stmt() b, Stmt() c [,Stmt() d])
Description:
This function compares the results of statement a and statement b. If the
comparison is true, then the result of statement c is returned. If the comparison
is false, then the result of statement d is returned, unless the optional statement
d does not exist. In this case, the original field will remain unchanged.
15
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Example:
OBX.2=EQUAL(FIELD("OBX.3"), "", "TX")
Graphical Representation:
FIRST
Syntax:
FIRST([Stmt() value,] Integer length, [String padding])
Description:
This function returns the first number (indicated by length) of characters of the
target field, unless the optional value is included. If value is provided, then the
first number of characters from value is returned. Padding is also an optional
parameter. If the length of the target field or value (if it is included) is less than
the integer length, it is padded with the string padding.
Example:
OBR.7=FIRST(8)
Graphical Representation:
LAST
Syntax:
LAST([Stmt() value,] Integer length, [String padding])
Description:
16
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
This function returns the last number (indicated by length) of characters of the
target field, unless the optional value is included. If value is provided, then the
last number of characters from value is returned. Padding is also an optional
parameter. If the length of the target field or value (if it is included) is less than
the integer length, it is padded with the string padding.
Example:
ORC.9 = LAST(6,"0")
Graphical Representation:
PREPEND
Syntax:
PREPEND([Stmt () value,] Stmt() prefix)
Description:
This function returns the concatenation of prefix and the target field. If value
is provided, then the function returns the concatenation of prefix and value
instead.
Example:
OBR.3.1=PREPEND(00)
Graphical Representation:
APPEND
Syntax:
APPEND([Stmt () value,] Stmt() suffix)
17
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Description:
This function returns the concatenation of the target field and suffix. If value
is provided, then the function returns the concatenation of value and suffix
instead.
Example:
OBR.3.1=APPEND(00)
Graphical Representation:
REPLACE
Syntax:
REPLACE([Stmt () value,] Stmt () original, Stmt () new)
Description:
This function replaces all occurrences of original with new in the target field or
value, if it is provided. The original string is a regular expression, which means
that you should avoid using any of the following special characters: [\^$.|?*+()
Example:
MSH.4 = REPLACE("-",".")
Graphical Representation:
REMOVE
Syntax:
REMOVE([Stmt () value,] Stmt () toRemove)
18
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Description:
This function removes all occurrences of toRemove from the target field or from
value if provided.
Example:
PID.19 = REMOVE("-")
Graphical Representation:
STRIPL
Syntax:
STRIPL([Stmt () value,] Stmt () lead)
Description:
This function removes the leading occurrences of lead from the target field or
value if provided.
Example:
ORC.2.1 = STRIPL("0")
Graphical Representation:
STRIPT
Syntax:
STRIPT([Stmt () value,] Stmt () trail)
Description:
19
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
This function removes the trailing occurrences of trail from the target field or
value if provided.
Example:
ORC.2.1 = STRIPT("0")
Graphical Representation:
SUBSTR
Syntax:
SUBSTR([Stmt () value,] Integer offset, Integer length [,Stmt ()
pad])
Description:
This function returns length characters, starting at offset, of the target field or
value, appending the pad string to the string, so that the returned string is
always length characters long
Example:
OBR.6.1=SUBSTR(8,6,"0")
Graphical Representation:
STRTOK
Syntax:
STRTOK([Stmt () value,] Integer index [,String sep])
Description:
20
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
This function takes the target string or value, which is separated into indexed
sections by the defined sep (separator) character, and returns the value for the
section indicated by the index value. The index starts at 0.
Example:
OBR.3.1=STRTOK(1,"_")
Graphical Representation:
VALUEMAP
Syntax:
VALUEMAP(String acceptableValues, String defaultValue [,String
valueMappings])
Description:
This function maps coded field values to application defined values.
acceptableValues is the comma separated list of mapped output values.
defaultValue is the value to be used in case a mapping cannot be found.
valueMappings is a comma separated list of raw/mapped value pairs in the
form rawValue:mappedValue.
Example:
PID.16 = VALUEMAP( "U,A,D,M,S,W", "U",
"MARRIED:M,SINGLE:S,DIVORCED:D,WIDOWED:W,SEPERATED:A" )
Graphical Representation:
21
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
6. Select the Save Edit Area menu item or click the button in the root
statement to save it as a script in the script display window.
22
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
4. Click the button at the right top of the root statement to save the
changes to the script display window.
23
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Regarding the second operation, this segment map is still shown in the script
display window with additional comment tag # at the beginning of it.
Use the following procedure to delete a Segment Map
1. Right-click on the segment map you want to delete in the script display
window
2. Select Delete to remove it completely or Comment State Switch to
comment it out.
If the user input -1 for this parameter, the text box will be in error state and the
message changes to be The length must be a non-negative integer.
Trying to save a node with invalid input will cause an error message box popped
up.
24
Merge HL7 ToolkitTM V. 5.4.0 Segment Map User Interface (UI) Sample Application Guide
Some errors are not checked until you try to save the script as shown in the
image below. There is no statement identified by Node2, and trying to save this
statement will cause an error Unresolved Node ID: Node2.
To create a correct statement, make sure to follow the hints for each input
parameter or the error messages displayed.
25