KW X12 EDI Parser
A Python library for parsing and writing X12 healthcare EDI files.
PyPI: pypi.org/project/kw-x12-parser · Source: github.com/rohanrkamath/KW-X12-Parser
Installation
pip install kw-x12-parser
# With DataFrame support and write-claims CLI:
pip install kw-x12-parser[dataframe]
From source (development):
pip install -e .
pip install -e ".[dataframe]"
Usage
1. casual_parse_x837p – key columns
DataFrame with essential columns (one row per claim): provider_name, claim_id, patient_name, total_charge, etc.
from kw_x12_parser import casual_parse_x837p
df = casual_parse_x837p("path/to/837p_file.txt")
# or: casual_parse_x837p(open("file.txt").read())
print(df[["claim_id", "patient_name", "total_charge"]])
2. full_parse_x837p – full schema
DataFrame with every loop and segment (420+ columns): ISA_, GS_, CLM_, NM1_, SV1_, OTHER_SUBSCRIBER_, etc.
from kw_x12_parser import full_parse_x837p
df = full_parse_x837p("path/to/837p_file.txt")
# Use for COB claims or when you need complete data
3. write_to_edi_x837p – DataFrame to EDI
Convert a DataFrame back to 837P EDI. Two modes: filter original EDI by claim IDs (preserves segments) or build from scratch.
from kw_x12_parser import casual_parse_x837p, write_to_edi_x837p
df = casual_parse_x837p("original.txt")
released = df[df["claim_id"].isin({"123", "456"})]
write_to_edi_x837p(released, "claims_out.txt", original_edi="original.txt")
CLI
write-claims claims.csv -o claims.txt
write-claims claims.csv original.txt -o claims.txt # filter by claim IDs
Requires pip install kw-x12-parser[dataframe].
Project structure
kw_x12_parser/
└── x837p/
├── api.py # casual_parse_x837p, full_parse_x837p, write_to_edi_x837p
├── write_claims.py # write-claims CLI
├── workflow/ # Workflow notebook
├── edi_examples/ # Sample 837P files
└── utils/ # Parser internals
Ultimate goal
Support parsing of all healthcare X12 EDI formats:
| Code | Name | Purpose | Dev status |
|---|---|---|---|
| 270 | Eligibility inquiry | Ask payer if patient is eligible for coverage | — |
| 271 | Eligibility response | Payer’s response to 270 | — |
| 276 | Claim status request | Request status of a claim | — |
| 277 | Claim status response | Payer’s claim status response | — |
| 278 | Prior authorization | Request/response for prior authorization (inbound/outbound) | — |
| 820 | Premium payment | Pay health plan premiums | — |
| 834 | Benefit enrollment | Enroll or update member benefits | — |
| 835 | Payment/remittance | Payer payment and remittance advice (ERA) | — |
| 837P | Professional claim | Medical/professional claims | ✅ |
| 837I | Institutional claim | Hospital/facility claims | — |
| 837D | Dental claim | Dental claims | — |
Current supported formats
- X12 837P (005010X222A1)
Contributing
Issues and pull requests: github.com/rohanrkamath/KW-X12-Parser/issues
Metadata
Release files for kw-x12-parser 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kw_x12_parser-0.1.6.tar.gz | 41.5 kB | Without provenance | Details for kw_x12_parser-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kw_x12_parser-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for kw_x12_parser-0.1.6-py3-none-any.whl |
Total release size: 82.9 kB
Release files / kw_x12_parser-0.1.6.tar.gz
| Download URL | kw_x12_parser-0.1.6.tar.gz |
|---|---|
| Size | 41.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d3ade934d604b10df207f4c82b7fd8d791034046504e9328c3786bc022ff464
|
|
BLAKE2b-256 checksum How to use checksums |
d70d1c1b4ed67158ceb4349599c57722770eb66c0ebcdf32e4c07fc53148a817
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / kw_x12_parser-0.1.6-py3-none-any.whl
| Download URL | kw_x12_parser-0.1.6-py3-none-any.whl |
|---|---|
| Size | 41.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78a6578a524e65fbf9cb6c2a1f0083c457666f0618ffbdddce30316faeb5c37c
|
|
BLAKE2b-256 checksum How to use checksums |
b11278c03a2d40fdf4818834d70e43da202699682bfa42b1aec180a4a6fece94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for kw-x12-parser 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.