A few questions regarding an HL7 Listener
Asked Answered
F

3

6

I'm looking to build an HL7 listener in C#. We are already parsing messages that are sent to us as text files and importing them into the database, so I have an understanding of what HL7 messages are and how to parse them.

My main question regarding the listener. Is the listener simply a TCP listener? If so, could I put together a basic TCP listener that gets the message and parses the results, importing them into our database?

My second questions is regarding the ACK. My understanding of this is it's simply a message sent back to the sender after receiving a message. It's simply another HL7 message designated as a response message.

Am I correct in my understanding? Also if anyone has any additional info or pointers I would appreciate any help.

Fiducial answered 20/6, 2012 at 19:36 Comment(3)
Hi, I need to create a HL7 ADT listener, what did you end with? Appreciate so muchMassorete
@Massorete By end do you mean the character that closes the message? If so take a look at the accepted answer, those are the characters you need to add.Fiducial
I create a C# socket listener and Im getting the HL7 message but when I decode it it adds extra chacaters that are generating issues when parsing it. This is my encoding: ASCIIEncoding encoder = new ASCIIEncoding(); var hl7Message = encoder.GetString(message, 0, bytesRead);Massorete
S
8

Yes it's just a simple TCP listener.

To acknowledge a message you have to return an MSH message which should look somehting like this:

<11> this means a byte represented in a decimal value. this is VT from the ascii table.    

<11>MSH|^~\&|KS||LAB||20040915080800||ACK|59793000678|P|2.2|59793000678<13>
MSA|AA|59793000678<13>
<28><13>

You should probably look at: http://nhapi.sourceforge.net/home.php

Selfconsequence answered 20/6, 2012 at 20:35 Comment(2)
What is the structure of the Acknowledge message? THanksMassorete
Thats the message I put there. :)Selfconsequence
B
7

Several items:

  1. The "protocol" run over the socket is the HL7 Minimal Lower-layer Protocol (MLP or sometimes MLLP). This simple protocol wraps HL7 messages with start and end characters. A description HL7 MLP wrapping characters.
  2. As noted by @the_ajp, as a receiver of an HL7 message, you need to build an HL7 Acknowledgment. There are some archaic rules involved but ultimately the part that is key is that you Application Accept ("AA") the message in MSA-1. Some senders are very picky about their Acks and require unique message IDs, acknowledgment of correct message, correct trigger code in MSH-9, etc. Details on the HL7 ACK Message; discussion of original and enhanced HL7 acknowledgments.
  3. Clearly you can grow your own HL7 subsystem that is hard coded. Prior to doing that, however, consider the total costs of building and supporting an HL7 subsystem, look at some free options like Mirth, and consider commercial solutions like Corepoint or Interfaceware.

Disclosure: I'm co-chair of the HL7 Infrastructure and Message (InM) committee, CTO at Corepoint, and Chief Architect of the Cloverleaf integration engine.

Blastopore answered 11/7, 2012 at 22:36 Comment(1)
Wrapping in MLLP was a must for me, once I got that fixed Corepoint Interface accepted my ACK messages. Found this reference. saravanansubramanian.com/hl72xdotnetprogramming/…Ope
B
1

Buy Vs. Build. If you've already "done" your HL7 interface and it works off of the file-system then why on earth would you want to rebuild something that's so readily available. There's the Mirth project which is open source or if you want something that

a) Does exactly what you're looking for out of the box (in that it was designed for exactly the scenario you outline).

b) Has one of the (if not THE) lowest cost in the world for commercial HL7 software of this kind.

c) Installs and configures in minutes.

Investigate a little bit and look at this: http://www.hermetechnz.com/EasyHL7/Prod_Listeners.asp.

Unless you are really looking at doing many hundreds or thousands of deployments a year you just have to ask yourself if it's the best use of your time.

DISCLOSURE: I work in customer support at this company, but we don't employ salespeople at all, it's just a great, cheap, reliable HL7 product in use all over the world.

Beria answered 29/8, 2012 at 17:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.