--- id: pyx12 version: "4.0.0" license: BSD license_treatment: permissive maintenance: active --- # pyx12 — HIPAA X12 validator, parser and converter License: permissive · Maintenance: active · Downloads: 260.4K/mo ## 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 above — 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 pip install pyx12 uv add pyx12 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_current - Install friction: low - Maintenance: active - Downloads: 260.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags x12 edi parser validator, hipaa x12 document processing, edi message validation, x12 to xml converter, healthcare edi translator, ansi x12 compliance checker, edi acknowledgment generator, edi-healthcare, x12-hipaa, data-validation [View on SkillFed](https://skillfed.io/packages/pyx12) · [View on PyPI](https://pypi.org/project/pyx12/)