Difference between revisions of "MESA HL7 V2 Utilities"

From IHE Wiki
Jump to navigation Jump to search
(Created page with "=Overview= The MESA HL7 V2 utilities are based on the HL7ImEx software first developed by Igor Chernizer at Columbia University and later extended by Allen Rueter of the Malli...")
 
(No difference)

Latest revision as of 23:53, 9 March 2019

Overview

The MESA HL7 V2 utilities are based on the HL7ImEx software first developed by Igor Chernizer at Columbia University and later extended by Allen Rueter of the Mallinckrodt Institute. The HL7ImEx library is used to construct and parse HL7 V2 messages. The applications to send/receive messages and perl scripts that perform other functions were created as part of the MESA project.

The rest of this page assumes the context of running command line applications and scripts. There is no GUI and no connections to a database.

Configuration Details

MESA configuration for this purpose is simple. When running command line applications, the environment variable MESA_TARGET needs to point to the installation directory for the MESA software.

The MESA_TARGET folder contains a folder named runtime. This folder contains the configuration files for the HL7 utilities. The default configuration files are

  • msgRules.ihe
  • segDefs.ihe

These contain rules for constructing HL7 2.3.1 messages. segDefs.ihe defines the fields for each kind of segment known to the toolkit. msgRules.ihe defines the construction of messages (A01, ORM, ...) using those segment definitions.

A second set of configuration files are included for HL7 2.5 messages defined for IHE IT Infrastructure. These are

  • msgRules.ihe-iti
  • segDefs.ihe-iti

The command line applications use the two default files listed above. If you want to use different configuration files, the -d EXT switch is recognized by the applications. EXT is the extension for your different configuration files. You can use ihe-iti is that suits you. If you need to write your own definitions, you must use the same naming convention (msgRules.EXT, segDefs.EXT) or the V2 utilities will not work properly.

Creating a V2 Message

The command line application txt_to_hl7 converts a text file to a V2 file that is recognized by the other MESA tools.

  • Note: there is no standard for a V2 file. The output of this application is the familiar V2 | delimited string with other appropriate delimiters that one would see on the wire. Open it with a text editor.

The input file has a simple format

MSH
 1 |
 2 ^~\&
 3 MESA_ADT
 4 XYZ_ADMITTING
 5 MESA_OP
 6 XYZ_HOSPITAL
 7 
 8 
 9 ADT^A04
 10 110102
 11 P
 12 2.3.1
 13 
 14 
 15 
 16 
 17 
 18 
EVN
 1 
 2 200204251300
 3 
 4 
 5 
 6 200204251300
PID
 1
 2 
 3 583090^^^ADT1
 4 
 5 GOLD^LISA
 6 
 7 19610804
 8 F
.....

To create a V2 message:

 $MESA_TARGET/bin/txt_to_hl7 -d EXT < input.txt > output.hl7

Further Hints

The MESA distribution contains a set of messages used for testing IHE Integration Profiles. Look in mesa_tests/rad/msgs. You will see folders named adt, order, and sched. These correspond to IHE Radiology images. There are more folders inside those with numerical names. These correspond to IHE test cases. You will find complete text files for example messages in those folders.

If you look in detail, you will also find a templates folder inside the adt, order and sched folders. Templates have the basic structure for a message type with placeholders (variables) for values stored at runtime. There are .var files found in the actual test message folders. These are the variables that are combined with the templates to make a message.

If your goal was to make one message, send it and call it a day, you would copy an existing .txt file from a message folder, modify it and generate your V2 message. If you wanted a process to be able to generate new messages repeatedly, you want to use the template approach or write your own software that creates the format expected by txt_to_hl7.

Sending a V2 Message

The command line program send_hl7 reads an HL7 V2 file and transmits that message using the HL7 MLLP. It supports transmission of notifications such as ADT's, orders and reports. It also supports sending a query and receiving results.

$MESA_TARGET/bin/send_hl7 -b BASE -d EXT -c -l LEVEL -q host port file [file...]

-b  BASE  Change base folder from $MESA_TARGET/runtime to BASE
-d  EXT   Change default extension (ihe) to EXT
-c        Capture the ACK message returned by the server
-l  LEVEL Change log level (1-4), default is
-q        Enable query mode
host      Name or IP address of server
port      TCP/IP port number
file      HL7 V2 file(s)