{"id":13592338,"url":"https://github.com/azoner/pyx12","last_synced_at":"2026-05-04T05:04:26.565Z","repository":{"id":2514657,"uuid":"3490313","full_name":"azoner/pyx12","owner":"azoner","description":"HIPAA X12 document validator and converter","archived":false,"fork":false,"pushed_at":"2024-03-25T01:15:53.000Z","size":5573,"stargazers_count":161,"open_issues_count":23,"forks_count":96,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-02T02:26:24.620Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azoner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-02-20T02:52:48.000Z","updated_at":"2024-09-28T05:17:51.000Z","dependencies_parsed_at":"2024-06-19T00:18:23.785Z","dependency_job_id":"8a47e8bb-774c-4680-b0de-01368e2fde04","html_url":"https://github.com/azoner/pyx12","commit_stats":{"total_commits":1613,"total_committers":11,"mean_commits":"146.63636363636363","dds":"0.022318660880347174","last_synced_commit":"f60ad528d54c0b0ae25044d2629a29faeefa2f5f"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azoner%2Fpyx12","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azoner%2Fpyx12/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azoner%2Fpyx12/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azoner%2Fpyx12/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azoner","download_url":"https://codeload.github.com/azoner/pyx12/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223346675,"owners_count":17130479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T16:01:08.176Z","updated_at":"2026-05-04T05:04:26.559Z","avatar_url":"https://github.com/azoner.png","language":"Python","funding_links":[],"categories":["CLI utilities"],"sub_categories":["Golang"],"readme":"# Pyx12\n\n[![Build Status](https://github.com/azoner/pyx12/actions/workflows/main.yml/badge.svg)](https://github.com/azoner/pyx12/actions/workflows/main.yml)\n\n\nPyx12 is a HIPAA X12 document parser, validator and converter.  It reads an ANSI X12 data file and validates it against a representation of the X12 Implementation Guidelines.  By default, it creates a 997 response for 4010 and a 999 response for 5010. It can create an HTML representation of the X12 document and can translate to and from an XML representation of the data file. \n\n# Usage\n\nAs a command line X12 validator\n\n    x12valid.exe \u003cfilename\u003e\n\nFixes common X12 structural errors.  Can add or remove line breaks.  Can fix loop and segment counting.\n\n    x12norm.exe --fix --eol \u003cfilename\u003e\n\n# Code Examples\n\n    Iterate over a loop.  Alter children. Show changes\n```python\n    src = pyx12.x12context.X12ContextReader(param, errh, fd_in)\n    for datatree in src.iter_segments('2300'):\n        # do something with a 2300 claim loop\n        # we have access to the 2300 loop and all its children\n        for loop2400 in datatree.select('2400'):\n            print(loop2400.get_value('SV101'))\n            # update something\n            loop2400.set_value('SV102', 'xx')\n            # delete something\n            if loop2400.exists('PWK'):\n                loop2400.delete('PWK')\n        # iterate over all the child segments\n        for seg_node in datatree.iterate_segments():\n            print(seg_node.format())\n```\n\n# Install\n\n    uv pip install pyx12\n\n# Contributing\n\nThe most useful contributions are **new implementation-guide maps** —\neither upgrading an existing 4010 map to its 5010 counterpart, or adding\nsupport for an X12 transaction pyx12 doesn't yet cover. Pyx12's design\nalready handles the engine; the bottleneck is map coverage.\n\n## Where the maps live\n\nXML maps live under `pyx12/map/`, one file per (transaction, version)\npair, named like `\u003ctransaction\u003e.\u003cversion\u003e.\u003cX-number\u003e[.A\u003cn\u003e].xml` —\ne.g. `834.4010.X095.A1.xml`, `837.5010.X222.A1.xml`. The index that\npyx12 consults at runtime is `pyx12/map/maps.xml`; each entry binds a\n`(vriic, fic[, tspc])` triple to a map filename:\n\n| Name                                             | Abbreviation | X12 Element |\n| :----------------------------------------------- | :----------- | :---------- |\n| Interchange Control Version Number               | ICVN         | ISA12       |\n| Version / Release / Industry Identifier Code     | VRIIC        | GS08        |\n| Functional Identifier Code                       | FIC          | GS01        |\n| Transaction Set Purpose Code (used only for 278) | TSPC         | BHT02       |\n\n## Converting a 4010 map to 5010\n\nSeveral 4010 maps don't yet have 5010 siblings — the candidates are\nlisted in the commented-out block in `maps.xml` (270/271 eligibility,\n276/277 claim status, 277U, 278 services review, 837D dental, 841). To\nadd one:\n\n1. Get the 5010 implementation guide for the transaction from\n   [X12.org](https://x12.org/products) or its HIPAA companion guide.\n2. Copy the existing 4010 map as a starting point — `cp\n   pyx12/map/270.4010.X092.A1.xml pyx12/map/270.5010.X279.A1.xml` (the\n   X-number changes between versions).\n3. Walk the IG diff and apply structural changes: new loops, new\n   segments, renamed elements, added or removed code values, changed\n   `usage` flags, changed `max_use`, changed `repeat`, changed syntax\n   rules. The 834.4010 ↔ 834.5010 pair is a good reference for the\n   typical scope of changes.\n4. Update the `\u003cvalid_codes\u003e` lists from the 5010 code list. Many\n   external-code references (`\u003cexternal\u003e`) stay pointed at the same\n   bundled list in `codes.xml` but the lists themselves may need\n   refreshing — see the commit history for `codes.xml` for the pattern.\n5. Register the new file under the `\u003cversion icvn=\"00501\"\u003e` block in\n   `maps.xml`:\n\n   ```xml\n   \u003cmap vriic=\"005010X279A1\" fic=\"HS\" abbr=\"270\"\u003e270.5010.X279.A1.xml\u003c/map\u003e\n   ```\n6. Add a fixture and a test. Tests live under `pyx12/test/`; the\n   simplest pattern is a `test_x12n_document.py` entry that runs\n   `x12n_document` against a sample file from the IG and compares the\n   997/999 output, or a focused `test_map_if_load.py` entry that just\n   confirms the map parses cleanly.\n\n## Adding a new X12 IG\n\nThe same shape applies — pyx12 is HIPAA-focused but the map engine is\ntransaction-agnostic. Drop a new XML map into `pyx12/map/`, register it\nin `maps.xml` with the right `(icvn, vriic, fic[, tspc])`, and you're\nin. If the transaction uses code lists that aren't already bundled,\nadd them under `\u003ccodeset\u003e` blocks in `codes.xml` and reference them\nfrom your map's `\u003cexternal\u003e` elements.\n\n## Running the project\n\n```bash\n# Set up the dev environment\nuv sync --extra dev\n\n# Tests\nuv run pytest\n\n# Type check\nuv run mypy\n\n# Format \u0026 sort imports\nuv run ruff format pyx12/\nuv run ruff check --select I --fix pyx12/\n```\n\nA green `pytest` and `mypy --strict` run is required for CI to pass.\nPRs welcome via [github.com/azoner/pyx12](https://github.com/azoner/pyx12).\n\n# Licensing\n\nPyx12 uses a BSD license. The full license text is included with the source code for the package. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazoner%2Fpyx12","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazoner%2Fpyx12","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazoner%2Fpyx12/lists"}