skillfed

hl7

Python library parsing HL7 v2.x messages

hl7 v0.4.5 648.3K downloads/30d#5,586 on PyPI319
Permissive license BSD AGING released

What it is and what it does

python-hl7 is a parser for HL7 version 2.x messages, the standard format for exchanging healthcare data between medical systems. It converts raw HL7 message strings into Python objects, making it possible to programmatically extract and work with healthcare data fields and segments. The library has no runtime dependencies and supports Python 3.9 through 3.13.

The package is designed for developers integrating with healthcare systems or processing medical records. It is stable but aging—last released in 2022 with a commit in June 2025—so it is suitable for maintenance work on existing systems but may not receive updates for emerging standards or Python features.

Use it for:

  • Extract patient demographics and identifiers from incoming HL7 admission or registration messages
  • Parse lab results or clinical observations from HL7 messages for storage in a database
  • Build a middleware layer to transform HL7 messages between different healthcare applications
  • Validate and log HL7 message structure for compliance auditing in healthcare workflows

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses HL7 version 2.x medical messages into Python objects for programmatic access to healthcare data fields and segments.

Yes, if you are working with HL7 2.x messages in a Python healthcare application. The library has no dependencies, is permissive licensed, and has no known vulnerabilities. The aging maintenance status is not a blocker for parsing—HL7 2.x is a stable standard—but do not expect active development or rapid bug fixes.

Install

hl7 on PyPI

pip

pip install hl7

uv

uv add hl7

poetry

poetry add hl7

Installing hl7

Before you install

Low friction installation with no runtime dependencies. Maintenance is aging—last release was in 2022 with a commit in June 2025, suggesting stability but not active development.

License in practice

BSD license is permissive, allowing commercial and private use with minimal restrictions.

Quickstart

pip install hl7

import hl7
message = hl7.parse('MSH|^~\\&|...')
patient_id = message[0][3]

Verify before relying

  • Whether the package handles all HL7 2.x variants or only a subset of the standard
  • Support for MLLP transport mentioned in keywords but not detailed in the excerpt
  • Scope of backwards compatibility break introduced in v0.3.0

Package facts

License BSD (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 1,597 days since the last release
Last repo commit
First released
Downloads 648,262/month — #5,586 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: hl7-0.4.5-py2.py3-none-any.whl

Keywords: HL7, Health Level 7, healthcare, health care, medical record, mllp

Development Status :: 3 - AlphaIntended Audience :: DevelopersIntended Audience :: Healthcare IndustryLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: CommunicationsTopic :: Scientific/Engineering :: Medical Science Apps.Topic :: Software Development :: Libraries :: Python Modules

Tags

hl7 message parsinghealth level 7 parsermedical record parsinghl7 v2 pythonhealthcare data extractionhl7 segment parsing
healthcarehl7-parsingmedical-data

More Python Modules packages