HL7 servers in Python?

Tim Churches tchur at optushome.com.au
Fri Mar 2 14:00:36 EST 2007


Richard Low, MD wrote:
> Richard,
> 
> I was most impressed by your answer below (in '03)
> 
> Do you know whether there is a third party application/library that can
> interface our software to the HL7 sockets systems so we do not have to
> develop them?
> 
> If you do, which one would you recommend?
>
> Richard M. Low MD
> CEO
> ____________________________________
> Infor-Med Corporation
> 6271 Variel Avenue, Suite A
> Woodland Hills, California 91367-2512, USA
> Phone:  818-592-2900
> Direct fax: (818)743-7759
> Email: <mailto:richlow at infor-med.com>richlow at infor-med.com
> URL:  <http://www.infor-med.com/>http://www.infor-med.com

I posed the original question back in 2003 which prompted Richard
Sharp's reply, and as far as I am aware, there is still no general
purpose HL7 2.x "server" written in Python. If that is still your
requirement, then you'll have to write one, but it is highly feasible.
We ended up writing our own, back in 2003, which met our specific need
of listening for incoming HL7 2.x messages of just a few specific types
using MLLP (HL7 minimum lower-level protocol), parsing and validating
them, writing the data as a transaction to a special purpose PostgreSQL
database and sending back an ACK. It is part of a public health
surveillance system described here:
http://www.biomedcentral.com/1471-2458/5/141

The code for our listener is available at
http://sourceforge.net/project/showfiles.php?group_id=123700&package_id=139062

Please note and observe the the open source license under which that
code is made available (it is a Mozilla license, so should not cause you
too many difficulties should you chose to make use of it, but do read
the license). At the very least examination of our code may give you
some ideas, although it is written for POSIX platforms and I note that
your company's products seem to be MS-Windows-based. The Python-based
solution has been relentlessly reliable in production use over the last
3 and a half years.

If you are looking for more general HL7 servers which use Python in some
respect but aren't necessarily written entirely in Python, then have a
look at Mirth - see http://www.mirthproject.org/ - which is an open
source HL7 messaging server which can use Python (or Jython) to script
rules and actions for incoming and outgoing messages, and Interfaceware,
whose  closed-source products also embed Python for scripting purposes -
see for example http://www.interfaceware.com/manual/ch-7-7-4.html

There may be others.

Hope this helps,

Tim C

> HL7 servers in Python?
> 
> Richard Sharp
> <mailto:python-list%40python.org?Subject=HL7%20servers%20in%20Python%3F&In-Reply-To=>rbsharp
> at gmx.de
> Mon Jun 16 17:29:22 CEST 2003
> 
>    * Previous message:
> <http://mail.python.org/pipermail/python-list/2003-June/210414.html>"Structure
> and Interpretation of Computer Programs" in Python?
>    * Next message:
> <http://mail.python.org/pipermail/python-list/2003-June/210188.html>HL7
> servers in Python?
>    * Messages sorted by:
> <http://mail.python.org/pipermail/python-list/2003-June/date.html#210163>[
> date ]
> <http://mail.python.org/pipermail/python-list/2003-June/thread.html#210163>[
> thread ]
> <http://mail.python.org/pipermail/python-list/2003-June/subject.html#210163>[
> subject ]
> <http://mail.python.org/pipermail/python-list/2003-June/author.html#210163>[
> author ]
> 
> ----------
> 
> On Fri, 13 Jun 2003 07:10:26 +1000, Tim Churches wrote:
> 
>> Does anyone know of a Python HL7 socket server/daemon - that is, a
>> daemon which accepts socket connections on a TCP port from an HL7
>> source, receives an HL7 message via the connection, hands off the
>> message for processing, and then sends back an ACK or NACK H7 message -
>> usually synchronously, via a blocking connection (thus the server needs
>> to be multi-threaded)?
>>
>> HL7 stands for Health Level 7 (where 7 represents the 7th layer of the
>> OSI network stack) and is a widely-used standard for communication of
>> medical information. I'm not looking for HL7 message assembly or parsing
>> libraries, just the socket server bit. Perhaps the SocketServer module
>> in the Python library makes this so trivial that no-one has felt the
>> need to write a specific HL7 server in Python? Anyway, I've looked on
>> Google but can't spot anything obvious.
> 
> It is extremely doubtful, given the specialised nature of the question,
> whether most people understand what you want. Given that HL7 is really
> only sending and receiving some information in a curious format, and that
> you either receive data and then send the other side an ACK or a NAK, or
> wait until they do that in reply to your message, it is really not all
> that complicated.
> 
> The short answer to you question ist Twisted -
> <http://www.twistedmatrix.com>http://www.twistedmatrix.com
> 
> What may confuse you is that it does not use blocking sockets and
> therefore does not need to be multithreaded, although I think it can be,
> but it does work.
> 
> My bread and butter Python work is software that interfaces between a
> Pathology System running any number of versions of Unix and some
> overarching Hospital System that provides me with patient data and to
> which I deliver reports and accounting data, mostly, but not always, in
> HL7.
> 
> I have one Pathology Unit that does work for two hospitals and
> communicates with two hospital systems. With Twisted I basically subclass
> protocol.Factory and implement the necessary submethods.
> 
> It is a little daunting at first and there was at the time (about 2 years
> ago) when no usable documentation worth speaking of was available. I am
> also stuck at the moment with Twisted 0.18.0, because it runs with Python
> 1.5.2, and I had trouble getting Python >= 2.0 running on the all the
> Unixes I had to get it running on. In the meantime, I think I've got that
> under control.
> 
> If you're interested in looking at the programms I will have to ask the
> company I developed the software for, but the complete program is only ca.
> 800 Lines and covers 4 Low Level Protocols.
> 
> I hope I have been of some help. Once people realise that what you want is
> some sort of select-loop-server, then they will probably gush forth with
> helpful suggestions.
> 
> Greetings,
> 
> Richard Sharp
> 
> 
> 
> ----------
>    * Previous message:
> <http://mail.python.org/pipermail/python-list/2003-June/210414.html>"Structure
> and Interpretation of Computer Programs" in Python?
>    * Next message:
> <http://mail.python.org/pipermail/python-list/2003-June/210188.html>HL7
> servers in Python?
>    * Messages sorted by:
> <http://mail.python.org/pipermail/python-list/2003-June/date.html#210163>[
> date ]
> <http://mail.python.org/pipermail/python-list/2003-June/thread.html#210163>[
> thread ]
> <http://mail.python.org/pipermail/python-list/2003-June/subject.html#210163>[
> subject ]
> <http://mail.python.org/pipermail/python-list/2003-June/author.html#210163>[
> author ]
> 
> ----------
> <http://mail.python.org/mailman/listinfo/python-list>More information
> about the Python-list mailing list
> 




More information about the Python-list mailing list