johnpaulett / python-hl7 (http://blog.7oars.com/)
A simple library for interacting with HL7 v2.x data. HL7 is a protocol and message format for transmitting health care data.
$ hg clone http://bitbucket.org/johnpaulett/python-hl7/
Welcome
Health Level 7 (HL7) is a communication protocol and message format for health care data. It is the de facto standard for transmitting data between clinical information systems and between clinical devices. The version 2.x series, which is often is a pipe delimited format is currently the most widely accepted version of HL7 (version 3.0 is an XML-based format).
python-hl7 currently only parses HL7 version 2.x messages into an easy to access data structure. The current implementation does not completely follow the HL7 specification, but is good enough to parse the most commonly seen HL7 messages. The library could potentially evolve into being fully complainant with the spec. The library could eventually also contain the ability to create HL7 v2.x messages.
HL7 References:
Usage
As an example, let's create a HL7 message:
We call the hl7.parse() command with string message:
We get a n-dimensional list back:
There were 4 segments (MSH, PID, OBR, OBX):
We can extract individual elements of the message:
We can look up segments by the segment identifer:
Download
python-hl7 will work with Python 2.5, 2.6, and 3.0
The easiest way to obtain the package is with easy_install
easy_install hl7
An egg and tar.gz file can be downloaded from PyPi
You can always clone or fork the source:
hg clone http://bitbucket.org/johnpaulett/python-hl7/
See Also
This revision is from 2009-06-13 17:35
