skillfed

pyx12

HIPAA X12 validator, parser and converter

pyx12 v4.0.0 260.4K downloads/30d#8,397 on PyPI188
Permissive license BSD Active released

What it is and what it does

Pyx12 is a HIPAA-focused X12 EDI parser and validator that reads ANSI X12 data files and validates them against X12 Implementation Guidelines. It generates standard 997 (for 4010) and 999 (for 5010) functional acknowledgments, detects and can fix common structural errors (loop/segment counting, line breaks), and converts between X12 and XML representations. The package ships with implementation-guide maps for multiple transaction types and versions; its design is transaction-agnostic, so new X12 transaction types can be added by registering new XML maps.

The library exposes a Python API for iterating over X12 loops and segments, reading and modifying values, and checking segment existence. It also provides command-line tools (x12valid, x12norm) for validation and normalization workflows. The single runtime dependency is defusedxml, used for safe XML parsing. Maintenance is active, with support for modern Python versions (3.11–3.14) and no known vulnerabilities.

Use it for:

  • Validate incoming healthcare EDI claims (837) or eligibility requests (270) against HIPAA X12 standards before processing
  • Convert X12 EDI files to XML for integration with systems that consume structured XML data
  • Generate 997/999 functional acknowledgments to confirm receipt and validation status of X12 documents
  • Normalize malformed X12 files by fixing segment/loop counts and line-break issues before downstream processing
  • Build healthcare data pipelines that parse and extract specific claim or eligibility data from X12 loops and segments

Worth the install?

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

Pyx12 parses, validates, and converts ANSI X12 EDI documents against X12 Implementation Guidelines, generating 997/999 acknowledgments and translating to/from XML representations.

Yes. Pyx12 is a stable, actively maintained library with low install friction, no security vulnerabilities, and a permissive license. It is the standard choice for X12 EDI parsing and validation in Python, especially for healthcare workflows. Install it if you need to work with ANSI X12 documents or HIPAA EDI compliance.

Install

pyx12 on PyPI

pip

pip install pyx12

uv

uv add pyx12

poetry

poetry add pyx12

Installing pyx12

Before you install

Low friction: pure Python wheel with a single runtime dependency (defusedxml). Active maintenance with a recent release (101 days ago) and steady repository activity. Supports current Python versions (3.11–3.14).

License in practice

BSD permissive license allows commercial and private use with minimal restrictions, making it suitable for proprietary healthcare applications.

Quickstart

import pyx12.x12context

src = pyx12.x12context.X12ContextReader(param, errh, fd_in)
for datatree in src.iter_segments('2300'):
    for loop2400 in datatree.select('2400'):
        value = loop2400.get_value('SV101')
        loop2400.set_value('SV102', 'xx')

Requires Python 3.11 or later. X12 Implementation Guide maps must be present in pyx12/map/ for the transaction type and version being parsed.

Verify before relying

  • Whether the package handles all common X12 transaction types (270, 271, 276, 277, 278, 834, 837, 841) or only a subset
  • Performance characteristics when processing large EDI files or high-volume streams
  • Whether custom validation rules or code lists can be extended beyond the bundled maps

Package facts

License BSD (permissive)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 1 — defusedxml
Maintenance actively maintained — 101 days since the last release
Last repo commit
First released
Downloads 260,401/month — #8,397 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pyx12-4.0.0-py3-none-any.whl

Keywords: x12, hipaa, healthcare, edi

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Healthcare IndustryLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Office/BusinessTopic :: Software Development :: Libraries :: Python Modules

Tags

x12 edi parser validatorhipaa x12 document processingedi message validationx12 to xml converterhealthcare edi translatoransi x12 compliance checkeredi acknowledgment generator
edi-healthcarex12-hipaadata-validation

More Python Modules packages