HL7 Multi-Listener

From VistApedia
Revision as of 23:05, 19 May 2007 by JohnLeoZ (talk | contribs)
Jump to: navigation, search

Configure HL7 multi-listener and set-up HL7 link parameters.

This instruction assumes that the reader is familiar with the linux operating system and the vi text editor or an equivalent. It also assumes that you have a working installation and configuration of VistA. For this example, I am running Bhaskar's SemiViva 2.3.1 on ubuntu linux 7.04. My machine's address will be 10.1.1.1, my HL7 listner will use port 9201, and my user will be root.

All commands should be issued as root and will be expressed as so:

<type this>.   

Any output or text to enter will be listed between brackets and astricks, i.e.:

[*******
text to enter
*******]

Background on my installation and paths:

I unzipped the SemiViva package to /usr/local/ which created directory VistAOfficeEHR_2.3.1. So, my routines are stored in /usr/local/ VistAOfficeEHR_2.3.1/r. Also, I ran install so that I created a child environment in /vista. So, my path to gtm is /vista/gtm_V5.2-000/.

First, I installed xinetd because this package was not included by default in the ubuntu 7.04 installation.

<apt-get update>
<apt-get install xinetd>    installs the xinetd package.

Make sure /etc/xinetd.conf contains "includedir /etc/xinetd.d" as shown:

<cat /etc/xinetd.conf>
[*******
# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/

defaults
{

# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info

}

includedir /etc/xinetd.d
*******]

Create a VistA routine that will start the HL7 process when a message is received (make sure HLPORT is set to the port you want to use)

<vi /usr/local/VistAOfficeEHR_2.3.1/r/VISTAHL7.m>

[*******
 N HLDP,HLPORT,HLPRTS,IO
 S HLDP=0,HLPORT=9201
 F  S HLDP=$O(^HLCS(870,"E","M",HLDP)) Q:'HLDP  D  Q:(HLPRTS=HLPORT)
 .S HLPRTS=$P(^HLCS(870,HLDP,400),"^",2)
 .Q
 I 'HLDP D ^%ZTER Q  K HLPORT,HLPRTS
 S IO=$P U IO:(NOWRAP:NODELIMITER:IOERROR="TRAP")
 D LISTEN^HLCSTCP
 Q
*******]

Now, create a script in the gtm directory to call that routine:

<vi /vista/gtm_V5.2-000/vistahl7>

[*******
#!/bin/bash
export HOME=/home/`whoami`
cd `dirname $0`
source ./env
cd ../tmp
mumps -run ^VISTAHL7
*******]

do a chmod on the vistahl7 script to make it executable:

<chmod +x /vista/gtm_V5.2-000/vistahl7>

Next, create a configuration file in xinetd.d to call that script:

<vi /etc/xinetd.d/vistahl7>
[*******
service vistahl7
{
        type = UNLISTED
        port = 9201
        socket_type = stream
        protocol = tcp
        user = root
        server = /vista/gtm_V5.2-000/vistahl7
        disable = no
        wait = no

}
*******]

Finally, add the following entry at the end of /etc/services

[*******
vistahl7        9201/tcp                        # vista hl7 listener
*******]

Restart the xinetd service with:

</etc/init.d/xinetd restart>

When you have a connection to the socket just created, you should be able to check it with this:

<netstat -lan | grep 9201>

[*******
tcp        0      0 0.0.0.0:9201            0.0.0.0:*
LISTEN
tcp        0      0 10.1.1.1:9201         x.x.x.x:59972
ESTABLISHED
*******]


As for the configuration inside of VistA, I assume you already have a single listener configured. If anyone is interested in a full configuration guide for this, I can write one up. All you have to do to start using the new multi-listener is change your link type to MULTI LISTENER on the link edit screen, then stop and start the link manager. What you do with the message received is now up to you. I wrote a routine to file patient and insurance information into the VistA database when demographics are received via HL7 from our billing system.