Difference between revisions of "HL7 Multi-Listener"

From VistApedia
Jump to: navigation, search
m
(Added glossary link to Configuration~)
 
(6 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
This instruction assumes that the reader is familiar with the linux
 
This instruction assumes that the reader is familiar with the linux
 
operating system and  the vi text editor or an equivalent.  It also
 
operating system and  the vi text editor or an equivalent.  It also
assumes that you have a working  installation and configuration of
+
assumes that you have a working  installation and [[configuration~|Configuration]] of
 
VistA.  For this example, I am running Bhaskar's  SemiViva 2.3.1 on
 
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
 
ubuntu linux 7.04.  My machine's address will be 10.1.1.1, my HL7
Line 28: Line 28:
 
default in the ubuntu 7.04 installation.
 
default in the ubuntu 7.04 installation.
  
<apt-get update>
+
<apt-get update>
<apt-get install xinetd>    installs the xinetd package.
+
<apt-get install xinetd>    installs the xinetd package.
  
 
Make sure /etc/xinetd.conf contains "includedir /etc/xinetd.d" as
 
Make sure /etc/xinetd.conf contains "includedir /etc/xinetd.d" as
 
shown:
 
shown:
  
<cat /etc/xinetd.conf>
+
<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
 
*******]
 
  
 +
[*******
 +
# Simple [[configuration~|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
 
Create a VistA routine that will start the HL7 process when a message
 
is received
 
is received
 
(make sure HLPORT is set to the port you want to use)
 
(make sure HLPORT is set to the port you want to use)
  
<vi /usr/local/VistAOfficeEHR_2.3.1/r/VISTAHL7.m>
+
<vi /usr/local/VistAOfficeEHR_2.3.1/r/VISTAHL7.m>
[*******
+
N HLDP,HLPORT,HLPRTS,IO
+
[*******
S HLDP=0,HLPORT=9201
+
  N HLDP,HLPORT,HLPRTS,IO
F  S HLDP=$O(^HLCS(870,"E","M",HLDP)) Q:'HLDP  D  Q:(HLPRTS=HLPORT)
+
  S HLDP=0,HLPORT=9201
.S HLPRTS=$P(^HLCS(870,HLDP,400),"^",2)
+
  F  S HLDP=$O(^HLCS(870,"E","M",HLDP)) Q:'HLDP  D  Q:(HLPRTS=HLPORT)
.Q
+
  .S HLPRTS=$P(^HLCS(870,HLDP,400),"^",2)
I 'HLDP D ^%ZTER Q  K HLPORT,HLPRTS
+
  .Q
S IO=$P U IO:(NOWRAP:NODELIMITER:IOERROR="TRAP")
+
  I 'HLDP D ^%ZTER Q  K HLPORT,HLPRTS
D LISTEN^HLCSTCP
+
  S IO=$P U IO:(NOWRAP:NODELIMITER:IOERROR="TRAP")
Q
+
  D LISTEN^HLCSTCP
*******]
+
  Q
 +
*******]
  
 
Now, create a script in the gtm directory to call that routine:
 
Now, create a script in the gtm directory to call that routine:
  
<vi /vista/gtm_V5.2-000/vistahl7>
+
<vi /vista/gtm_V5.2-000/vistahl7>
[*******
+
#!/bin/bash
+
[*******
export HOME=/home/`whoami`
+
#!/bin/bash
cd `dirname $0`
+
export HOME=/home/`whoami`
source ./env
+
cd `dirname $0`
cd ../tmp
+
source ./env
mumps -run ^VISTAHL7
+
cd ../tmp
*******]
+
mumps -run ^VISTAHL7
 +
*******]
  
 
do a chmod on the vistahl7 script to make it executable:
 
do a chmod on the vistahl7 script to make it executable:
  
<chmod +x /vista/gtm_V5.2-000/vistahl7>
+
<chmod +x /vista/gtm_V5.2-000/vistahl7>
  
Next, create a configuration file in xinetd.d to call that script:
+
Next, create a [[configuration~|Configuration]] file in xinetd.d to call that script:
  
<vi /etc/xinetd.d/vistahl7>
+
<vi /etc/xinetd.d/vistahl7>
  
[*******
+
[*******
service vistahl7
+
service vistahl7
{
+
{
        type = UNLISTED
+
        type = UNLISTED
        port = 9201
+
        port = 9201
        socket_type = stream
+
        socket_type = stream
        protocol = tcp
+
        protocol = tcp
        user = root
+
        user = root
        server = /vista/gtm_V5.2-000/vistahl7
+
        server = /vista/gtm_V5.2-000/vistahl7
        disable = no
+
        disable = no
        wait = no
+
        wait = no
 
+
}
+
}
*******]
+
*******]
  
 
Finally, add the following entry at the end of /etc/services
 
Finally, add the following entry at the end of /etc/services
  
[*******
+
[*******
vistahl7        9201/tcp                        # vista hl7 listener
+
vistahl7        9201/tcp                        # vista hl7 listener
*******]
+
*******]
  
 
Restart the xinetd service with:
 
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
 +
*******]
  
</etc/init.d/xinetd restart>
 
  
When you have a connection to the socket just created, you should be
+
If you have not yet configured the VistA HL7 subsystem, check out this really nice website:
able to check it with this:
+
http://www.geocities.com/kdtop3/
  
<netstat -lan | grep 9201>
+
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.
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
 
*******]
 
  
  
 +
[[Register a patient via HL7]]
  
As for the configuration inside of VistA, I assume you already have a
+
[[User:cmdupre]]
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.
 

Latest revision as of 01:01, 11 October 2012

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
*******]


If you have not yet configured the VistA HL7 subsystem, check out this really nice website: http://www.geocities.com/kdtop3/

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.


Register a patient via HL7

User:cmdupre