Changelog¶
0.5.0 - December 2026¶
Warning
0.5.0 has a few backwards-incompatible changes:
Python 3.7 - 3.10 are no longer supported.
The deprecated
hl7.versionmodule is removed; usehl7.__version__.hl7.client.MLLPClient.send()now waits for the end of the MLLP response (<EB><CR>). A server that does not send it makessendwait, so set atimeout.
Dropped support for Python 3.7, 3.8, 3.9, and 3.10 (all end-of-life). Python 3.11 - 3.15 are now supported.
Replaced deprecated
datetime.utcnow()withdatetime.now(datetime.UTC)inMessage.create_ackandgenerate_message_control_id, removingDeprecationWarningon Python 3.12+. Generated values are unchanged.Fixed invalid escape sequences (
SyntaxWarning) in documentation examples.Upgraded development dependencies (Sphinx 9, coverage 7, ruff 0.17, tox 4.67, commitizen 4) and GitHub Actions.
Switched development dependencies to be installed using
uvinstead ofpip.Converted packaging to
pyproject.tomlusinghatchlingand removedrequirements.txt.Added
commitizento manage version bumps and changelog entries.Added
make bumptarget and replacedmake envwithmake initfor setting up the development environment.Removed deprecated
hl7.versionmodule; usehl7.__version__instead.Switched the
mllp_sendcommand line parsing fromoptparsetoargparse.Fixed a bug in
mllp_send --quiet– thanks Spencer Vecile!Switched formatting and linting from black/isort and flake8 to
ruff.Fixed timezone formatting when
parse_datetimecreated_UTCOffsetwith a float value.Added an optional
timeouttohl7.client.MLLPClientand a--timeoutoption tomllp_send, so the client no longer waits forever on a server that never replies. python-hl7#18, python-hl7#89. Thanks Tom O’Sullivan!Use
socket.sendallto flush the MLLP buffer. python-hl7#41. Thanks Feenes for reporting and Niklas Meinzer for the fix!hl7.parse()skips empty and whitespace-only segment lines. A doubled\rwas parsed as an empty segment, which made segment lookups likemsg.segment("PID")raiseIndexError. For such input,len(msg)andstr(msg)no longer include those lines. python-hl7#88. Thanks Tom O’Sullivan!hl7.client.MLLPClient.send()reads until the end of the MLLP response (<EB><CR>), so a response sent in several pieces is no longer cut short. If the server closes the connection before the response is complete,hl7.client.MLLPExceptionis raised. A server that never sends <EB><CR> now makessendwait, so set atimeoutto bound it. python-hl7#44. Thanks cezio for the original fix in python-hl7#49!Improved the MLLP server examples in the documentation. Thanks Johannes Heinzl!
Added a security policy (
SECURITY.md) for reporting vulnerabilities privately. Thanks Tom O’Sullivan!Fixed the build status badge in the README. Thanks Benson Muite!
0.4.5 - March 2022¶
Better support for
HL7StreamProtocolin Python 3.7, which lacks _reject_connection
Thanks Joseph Wortmann!
0.4.3 - March 2022¶
Dropped support for Python 3.5 & 3.6. Python 3.7 - 3.10 now supported.
Ensure
hl7.parse_hl7()allows legitimate occurrences of “MSH” inside the message contents
Thanks Andrew Wason!
0.4.2 - February 2021¶
Added support for
hl7.Batchandhl7.File, viahl7.parse_hl7()or the more specifichl7.parse_batch()andparse_file().
Thanks Joseph Wortmann!
0.4.1 - September 2020¶
Experimental asyncio-based HL7 MLLP support. MLLP using asyncio, via
hl7.mllp.open_hl7_connection()andhl7.mllp.start_hl7_server()
Thanks Joseph Wortmann!
0.4.0 - September 2020¶
Message now ends with trailing carriage return, to be consistent with Message Construction Rules (Section 2.6, v2.8). [python-hl7#26 <https://github.com/johnpaulett/python-hl7/issues/26>]
Handle ASCII characters within
hl7.Message.escape()under Python 3.Don’t escape MSH-2 so that the control characters are retrievable. [python-hl7#27 <https://github.com/johnpaulett/python-hl7/issues/27>]
Add MSH-9.1.3 to create_ack.
Dropped support for Python 2.7, 3.3, & 3.4. Python 3.5 - 3.8 now supported.
Converted code style to use black.
Thanks Lucas Kahlert & Joseph Wortmann!
0.3.5 - June 2020¶
Handle ASCII characters within
hl7.Message.escape()under Python 3.
Thanks Lucas Kahlert!
0.3.4 - June 2016¶
Fix bug under Python 3 when writing to stdout from mllp_send
Publish as a Python wheel
0.3.3 - June 2015¶
Expose a Factory that allows control over the container subclasses created to construct a message
Split up single module into more manageable submodules.
Thanks Andrew Wason!
0.3.2 - September 2014¶
New
hl7.parse_datetime()for parsing HL7 DTM into pythondatetime.datetime.
0.3.1 - August 2014¶
Allow HL7 ACK’s to be generated from an existing Message via
hl7.Message.create_ack()
0.3.0 - August 2014¶
Warning
0.3.0 breaks backwards compatibility by correcting the indexing of the MSH segment and the introducing improved parsing down to the repetition and sub-component level.
Changed the numbering of fields in the MSH segment. This breaks older code.
Parse all the elements of the message (i.e. down to sub-component). The inclusion of repetitions will break older code.
Implemented a basic escaping mechanism
New constant ‘NULL’ which maps to ‘””’
New
hl7.isfile()andhl7.split_file()functions to identify file (FHS/FTS) wrapped messagesNew mechanism to address message parts via a symbolic accessor name
Message (and Message.segments), Field, Repetition and Component can be accessed using 1-based indices by using them as a callable.
Added Python 3 support. Python 2.6, 2.7, and 3.3 are officially supported.
hl7.parse()can now decode byte strings, using theencodingparameter.hl7.client.MLLPClientcan now encode unicode input using theencodingparameter. To support Python 3, unicode is now the primary string type used inside the library. bytestrings are only allowed at the edge of the library now, withhl7.parseand sending viahl7.client.MLLPClient. Refer to Python 2 vs Python 3 and Unicode vs Byte strings.Testing via tox and travis CI added. See Contributing.
A massive thanks to Kevin Gill and Emilien Klein for the initial code submissions to add the improved parsing, and to Andrew Wason for rebasing the initial pull request and providing assistance in the transition.
0.2.5 - March 2012¶
Do not senselessly try to convert to unicode in mllp_send. Allows files to contain other encodings.
0.2.4 - February 2012¶
mllp_send --versionprints version numbermllp_send --loosealgorithm modified to allow multiple messages per file. The algorithm now splits messages based upon the presumed start of a message, which must start withMSH|^~\&|
0.2.3 - January 2012¶
mllp_send --looseaccepts & converts Unix newlines in addition to Windows newlines
0.2.2 - December 2011¶
mllp_send now takes the
--looseoptions, which allows sending HL7 messages that may not exactly meet the standard (Windows newlines separating segments instead of carriage returns).
0.2.1 - August 2011¶
Added MLLP client (
hl7.client.MLLPClient) and command line tool, mllp_send.
0.2.0 - June 2011¶
Converted
hl7.segmentandhl7.segmentsinto methods onhl7.Message.Support dict-syntax for getting Segments from a Message (e.g.
message['OBX'])Use unicode throughout python-hl7 since the HL7 spec allows non-ASCII characters. It is up to the caller of
hl7.parse()to convert non-ASCII messages into unicode.Refactored from single hl7.py file into the hl7 module.
Added Sphinx documentation. Moved project to github.
0.1.1 - June 2009¶
Apply Python 3 trove classifier
0.1.0 - March 2009¶
Support message-defined separation characters
Message, Segment, Field classes
0.0.3 - January 2009¶
Initial release