A few questions regarding an HL7 Listener

Jhorra picture Jhorra · Jun 20, 2012 · Viewed 7.2k times · Source

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.

Answer

albertjan picture albertjan · Jun 20, 2012

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