hl7
Python library parsing HL7 v2.x messages
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 hl7uv
uv add hl7poetry
poetry add hl7Installing 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
hl7apyHL7apy parses, creates, and validates HL7 v2.x…
permissive · top 15,000 on PyPI
fhir-coreProvides Pydantic V2-based abstract base…
permissive · top 5,000 on PyPI
fhir.resourcesProvides Python classes and validation for all…
permissive · top 5,000 on PyPI
openmedExtracts medical entities and personally…
permissive · top 5,000 on PyPI
pyx12Pyx12 parses, validates, and converts ANSI X12…
permissive · top 15,000 on PyPI
emrvalidatorEMRValidator is a data validation library…
permissive · top 15,000 on PyPI
torchxrayvisionTorchXRayVision provides pre-trained deep…
permissive · top 15,000 on PyPI
highdicomHighdicom provides a high-level Python API for…
permissive · top 15,000 on PyPI
pylibjpeg-libjpegDecodes JPEG and JPEG-LS images to NumPy…
copyleft · top 15,000 on PyPI
query-stringParses URL query strings and fragments into…
permissive · top 15,000 on PyPI