yedipy 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yedipy-0.1.0/.gitattributes +1 -0
- yedipy-0.1.0/.github/workflows/ci.yml +22 -0
- yedipy-0.1.0/.github/workflows/deploy-pages.yml +39 -0
- yedipy-0.1.0/.github/workflows/publish.yml +39 -0
- yedipy-0.1.0/.gitignore +7 -0
- yedipy-0.1.0/CHANGELOG.md +1 -0
- yedipy-0.1.0/LICENSE +21 -0
- yedipy-0.1.0/PKG-INFO +112 -0
- yedipy-0.1.0/README.md +81 -0
- yedipy-0.1.0/docs/api.md +53 -0
- yedipy-0.1.0/docs/edi-to-python.html +468 -0
- yedipy-0.1.0/docs/getting-started.md +62 -0
- yedipy-0.1.0/docs/index.md +294 -0
- yedipy-0.1.0/docs/overview.md +16 -0
- yedipy-0.1.0/docs/publishing.md +26 -0
- yedipy-0.1.0/docs/transactions.md +97 -0
- yedipy-0.1.0/docs/x12-270.md +33 -0
- yedipy-0.1.0/mkdocs.yml +40 -0
- yedipy-0.1.0/overrides/assets/stylesheets/home.css +1124 -0
- yedipy-0.1.0/overrides/home.html +163 -0
- yedipy-0.1.0/pyproject.toml +57 -0
- yedipy-0.1.0/src/yedipy/__init__.py +5 -0
- yedipy-0.1.0/src/yedipy/cli.py +123 -0
- yedipy-0.1.0/src/yedipy/py.typed +0 -0
- yedipy-0.1.0/src/yedipy/x12/__init__.py +25 -0
- yedipy-0.1.0/src/yedipy/x12/lexer.py +180 -0
- yedipy-0.1.0/src/yedipy/x12/model.py +104 -0
- yedipy-0.1.0/src/yedipy/x12/slicing.py +46 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/__init__.py +119 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/_registry.py +141 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/_runtime.py +464 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/__init__.py +20 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts270.py +1395 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts271.py +2104 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts276.py +1114 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts277.py +1206 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts278.py +3961 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts820.py +1285 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts834.py +2159 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts835.py +1952 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts837d.py +3853 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts837i.py +6116 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v4010/ts837p.py +6926 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/__init__.py +10 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/t270.py +425 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts270.py +1689 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts271.py +2445 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts276.py +1226 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts277.py +1434 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts277a.py +1555 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts278.py +7003 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts820.py +1676 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts820hix.py +985 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts834.py +2734 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts835.py +2437 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts837d.py +4984 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts837i.py +6529 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts837p.py +6977 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010/ts999.py +387 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010_pre_errata/__init__.py +16 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010_pre_errata/ts270.py +1685 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010_pre_errata/ts271.py +2461 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010_pre_errata/ts834.py +2724 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010_pre_errata/ts835.py +2431 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010_pre_errata/ts837d.py +4866 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010_pre_errata/ts837i.py +6362 -0
- yedipy-0.1.0/src/yedipy/x12/transactions/v5010_pre_errata/ts837p.py +6813 -0
- yedipy-0.1.0/src/yedipy/x12/validation.py +232 -0
- yedipy-0.1.0/tests/fixtures/270-subscriber.edi +14 -0
- yedipy-0.1.0/tests/fixtures/4010/270.edi +1 -0
- yedipy-0.1.0/tests/fixtures/4010/271.edi +1 -0
- yedipy-0.1.0/tests/fixtures/4010/834.edi +1 -0
- yedipy-0.1.0/tests/fixtures/4010/835.edi +1 -0
- yedipy-0.1.0/tests/fixtures/4010/837i.edi +1 -0
- yedipy-0.1.0/tests/fixtures/4010/837p.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010/271.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010/276.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010/277.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010/834.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010/835.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010/837p.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010/999.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010_pre_errata/270.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010_pre_errata/271.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010_pre_errata/834.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010_pre_errata/835.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010_pre_errata/837d.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010_pre_errata/837i.edi +1 -0
- yedipy-0.1.0/tests/fixtures/5010_pre_errata/837p.edi +1 -0
- yedipy-0.1.0/tests/test_cli.py +69 -0
- yedipy-0.1.0/tests/test_generated_transactions.py +88 -0
- yedipy-0.1.0/tests/test_lexer.py +133 -0
- yedipy-0.1.0/tests/test_realistic_4010.py +56 -0
- yedipy-0.1.0/tests/test_realistic_5010.py +68 -0
- yedipy-0.1.0/tests/test_realistic_5010_pre_errata.py +82 -0
- yedipy-0.1.0/tests/test_t270.py +73 -0
- yedipy-0.1.0/tests/x12_samples.py +121 -0
- yedipy-0.1.0/tools/generate_x12_models.py +616 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.edi -text
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: ${{ matrix.python-version }}
|
|
18
|
+
- run: python -m pip install -e ".[dev]"
|
|
19
|
+
- run: ruff check .
|
|
20
|
+
- run: pyright
|
|
21
|
+
- run: pytest -q
|
|
22
|
+
- run: python -m build
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Deploy documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
pages: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: pages
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.13"
|
|
25
|
+
- run: python -m pip install "mkdocs-material>=9.6"
|
|
26
|
+
- run: python -m mkdocs build --strict
|
|
27
|
+
- uses: actions/upload-pages-artifact@v3
|
|
28
|
+
with:
|
|
29
|
+
path: site
|
|
30
|
+
|
|
31
|
+
deploy:
|
|
32
|
+
needs: build
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
environment:
|
|
35
|
+
name: github-pages
|
|
36
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
37
|
+
steps:
|
|
38
|
+
- id: deployment
|
|
39
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.13"
|
|
18
|
+
- run: python -m pip install build twine
|
|
19
|
+
- run: python -m build
|
|
20
|
+
- run: python -m twine check dist/*
|
|
21
|
+
- uses: actions/upload-artifact@v4
|
|
22
|
+
with:
|
|
23
|
+
name: python-package-distributions
|
|
24
|
+
path: dist/
|
|
25
|
+
|
|
26
|
+
publish:
|
|
27
|
+
needs: build
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
environment:
|
|
30
|
+
name: pypi
|
|
31
|
+
url: https://pypi.org/p/yedipy
|
|
32
|
+
permissions:
|
|
33
|
+
id-token: write
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/download-artifact@v4
|
|
36
|
+
with:
|
|
37
|
+
name: python-package-distributions
|
|
38
|
+
path: dist/
|
|
39
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
yedipy-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Changelog
|
yedipy-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Patrick Arron Lee
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
yedipy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: yedipy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Lossless X12 EDI parsing for Python
|
|
5
|
+
Project-URL: Documentation, https://patrickarronlee.github.io/yedipy/
|
|
6
|
+
Project-URL: Source, https://github.com/PatrickArronLee/yedipy
|
|
7
|
+
Project-URL: Issues, https://github.com/PatrickArronLee/yedipy/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/PatrickArronLee/yedipy/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Patrick Arron Lee
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: edi,healthcare,hipaa,x12,x12-270
|
|
13
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Text Processing
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: pydantic>=2.11
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
25
|
+
Requires-Dist: mkdocs-material>=9.6; extra == 'dev'
|
|
26
|
+
Requires-Dist: pyright>=1.1.390; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=8.3; extra == 'dev'
|
|
28
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
29
|
+
Requires-Dist: twine>=6.1; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# YediPy
|
|
33
|
+
|
|
34
|
+
YediPy is a Python library for lossless X12 EDI parsing and safe structural validation. It includes typed models for the healthcare transaction sets in X12 releases `004010`, `005010`, and `005010` pre-errata (270, 271, 276, 277, 277A, 278, 820, 820 HIX, 834, 835, 837D, 837I, 837P, and 999), plus a hand-written `005010X279A1` 270 parser with hierarchy validation.
|
|
35
|
+
|
|
36
|
+
## What It Does
|
|
37
|
+
|
|
38
|
+
- Detects separators from a fixed-width ISA header.
|
|
39
|
+
- Preserves the original source bytes, segment order, elements, and byte offsets.
|
|
40
|
+
- Validates ISA/IEA, GS/GE, and ST/SE nesting, control numbers, and counts.
|
|
41
|
+
- Slices one interchange into ordered ST/SE transactions.
|
|
42
|
+
- Parses 32 transaction sets across three releases into generated Pydantic models with snake_case attributes and OpenFoo aliases.
|
|
43
|
+
- Parses the 270 hierarchy with `HL` parent validation.
|
|
44
|
+
- Emits diagnostics without including source values.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
After the first PyPI release:
|
|
49
|
+
|
|
50
|
+
```shell
|
|
51
|
+
python -m pip install yedipy
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
From a checkout:
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
python -m pip install -e ".[dev]"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## CLI
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
yedipy x12 inspect input.edi
|
|
64
|
+
yedipy x12 validate input.edi --transaction 270
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`inspect` returns structural JSON only. `validate` returns JSON diagnostics and exits with `0` for valid input, `2` for validation failures, and `3` when the input cannot be read.
|
|
68
|
+
|
|
69
|
+
## Python API
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from pathlib import Path
|
|
73
|
+
|
|
74
|
+
from yedipy.x12 import parse_x12
|
|
75
|
+
from yedipy.x12.transactions.v5010 import parse_270
|
|
76
|
+
|
|
77
|
+
result = parse_x12(Path("request.edi").read_bytes())
|
|
78
|
+
result.raise_for_errors()
|
|
79
|
+
|
|
80
|
+
interchange = result.interchange
|
|
81
|
+
assert interchange is not None
|
|
82
|
+
|
|
83
|
+
typed = parse_270(interchange.transactions[0], interchange.delimiters)
|
|
84
|
+
assert typed.transaction is not None
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Any supported transaction set:
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from yedipy.x12.transactions import parse_transaction
|
|
91
|
+
|
|
92
|
+
claims = parse_transaction(interchange.transactions[0], interchange.delimiters)
|
|
93
|
+
claims.errors
|
|
94
|
+
claims.transaction # e.g. yedipy.x12.transactions.v5010.ts837p.TS837P
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Documentation
|
|
98
|
+
|
|
99
|
+
- [Getting started](https://patrickarronlee.github.io/yedipy/getting-started/)
|
|
100
|
+
- [Transaction sets](https://patrickarronlee.github.io/yedipy/transactions/)
|
|
101
|
+
- [X12 270 support](https://patrickarronlee.github.io/yedipy/x12-270/)
|
|
102
|
+
- [API reference](https://patrickarronlee.github.io/yedipy/api/)
|
|
103
|
+
- [EDI to Python object model](https://patrickarronlee.github.io/yedipy/edi-to-python.html)
|
|
104
|
+
- [Publishing](https://patrickarronlee.github.io/yedipy/publishing/)
|
|
105
|
+
|
|
106
|
+
## Status
|
|
107
|
+
|
|
108
|
+
YediPy is pre-release software. It is not a payer-ready eligibility workflow, a FHIR mapper, or a complete X12 implementation.
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
YediPy is released under the [MIT License](https://github.com/PatrickArronLee/yedipy/blob/main/LICENSE).
|
yedipy-0.1.0/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# YediPy
|
|
2
|
+
|
|
3
|
+
YediPy is a Python library for lossless X12 EDI parsing and safe structural validation. It includes typed models for the healthcare transaction sets in X12 releases `004010`, `005010`, and `005010` pre-errata (270, 271, 276, 277, 277A, 278, 820, 820 HIX, 834, 835, 837D, 837I, 837P, and 999), plus a hand-written `005010X279A1` 270 parser with hierarchy validation.
|
|
4
|
+
|
|
5
|
+
## What It Does
|
|
6
|
+
|
|
7
|
+
- Detects separators from a fixed-width ISA header.
|
|
8
|
+
- Preserves the original source bytes, segment order, elements, and byte offsets.
|
|
9
|
+
- Validates ISA/IEA, GS/GE, and ST/SE nesting, control numbers, and counts.
|
|
10
|
+
- Slices one interchange into ordered ST/SE transactions.
|
|
11
|
+
- Parses 32 transaction sets across three releases into generated Pydantic models with snake_case attributes and OpenFoo aliases.
|
|
12
|
+
- Parses the 270 hierarchy with `HL` parent validation.
|
|
13
|
+
- Emits diagnostics without including source values.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
After the first PyPI release:
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
python -m pip install yedipy
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
From a checkout:
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
python -m pip install -e ".[dev]"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## CLI
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
yedipy x12 inspect input.edi
|
|
33
|
+
yedipy x12 validate input.edi --transaction 270
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`inspect` returns structural JSON only. `validate` returns JSON diagnostics and exits with `0` for valid input, `2` for validation failures, and `3` when the input cannot be read.
|
|
37
|
+
|
|
38
|
+
## Python API
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from pathlib import Path
|
|
42
|
+
|
|
43
|
+
from yedipy.x12 import parse_x12
|
|
44
|
+
from yedipy.x12.transactions.v5010 import parse_270
|
|
45
|
+
|
|
46
|
+
result = parse_x12(Path("request.edi").read_bytes())
|
|
47
|
+
result.raise_for_errors()
|
|
48
|
+
|
|
49
|
+
interchange = result.interchange
|
|
50
|
+
assert interchange is not None
|
|
51
|
+
|
|
52
|
+
typed = parse_270(interchange.transactions[0], interchange.delimiters)
|
|
53
|
+
assert typed.transaction is not None
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Any supported transaction set:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from yedipy.x12.transactions import parse_transaction
|
|
60
|
+
|
|
61
|
+
claims = parse_transaction(interchange.transactions[0], interchange.delimiters)
|
|
62
|
+
claims.errors
|
|
63
|
+
claims.transaction # e.g. yedipy.x12.transactions.v5010.ts837p.TS837P
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
- [Getting started](https://patrickarronlee.github.io/yedipy/getting-started/)
|
|
69
|
+
- [Transaction sets](https://patrickarronlee.github.io/yedipy/transactions/)
|
|
70
|
+
- [X12 270 support](https://patrickarronlee.github.io/yedipy/x12-270/)
|
|
71
|
+
- [API reference](https://patrickarronlee.github.io/yedipy/api/)
|
|
72
|
+
- [EDI to Python object model](https://patrickarronlee.github.io/yedipy/edi-to-python.html)
|
|
73
|
+
- [Publishing](https://patrickarronlee.github.io/yedipy/publishing/)
|
|
74
|
+
|
|
75
|
+
## Status
|
|
76
|
+
|
|
77
|
+
YediPy is pre-release software. It is not a payer-ready eligibility workflow, a FHIR mapper, or a complete X12 implementation.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
YediPy is released under the [MIT License](https://github.com/PatrickArronLee/yedipy/blob/main/LICENSE).
|
yedipy-0.1.0/docs/api.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
## `parse_x12(payload)`
|
|
4
|
+
|
|
5
|
+
Parses `bytes` or an ASCII `str` into an `X12ParseResult`.
|
|
6
|
+
|
|
7
|
+
| Result member | Description |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `interchange` | An `X12Interchange` when the ISA header is valid. |
|
|
10
|
+
| `diagnostics` | Ordered structural diagnostics. |
|
|
11
|
+
| `errors` | Diagnostics whose severity is `error`. |
|
|
12
|
+
| `raise_for_errors()` | Raises `X12ParseError` using diagnostic codes only. |
|
|
13
|
+
|
|
14
|
+
## `X12Interchange`
|
|
15
|
+
|
|
16
|
+
| Member | Description |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `source` | Original input bytes. |
|
|
19
|
+
| `delimiters` | Element, repetition, component, and segment separators. |
|
|
20
|
+
| `segments` | Ordered `RawSegment` values with byte offsets. |
|
|
21
|
+
| `transactions` | Ordered `RawTransaction` ST/SE slices. |
|
|
22
|
+
| `to_source()` | Returns `source` unchanged. |
|
|
23
|
+
|
|
24
|
+
## `parse_270(transaction, delimiters)`
|
|
25
|
+
|
|
26
|
+
Parses one `RawTransaction` into a `Parse270Result`.
|
|
27
|
+
|
|
28
|
+
| Result member | Description |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| `transaction` | A `Transaction270` when structural validation succeeds. |
|
|
31
|
+
| `diagnostics` | 270-specific structural diagnostics. |
|
|
32
|
+
| `errors` | Error diagnostics. |
|
|
33
|
+
|
|
34
|
+
The resulting `Transaction270` exposes `control_number`, `implementation_version`, `beginning`, and `information_sources`.
|
|
35
|
+
|
|
36
|
+
## `parse_transaction(transaction, delimiters, *, implementation_version=None, release=None)`
|
|
37
|
+
|
|
38
|
+
Parses one `RawTransaction` with the generated model selected from `ST01` and `ST03` (or `implementation_version`). Returns a `ParseTransactionResult`. Raises `LookupError` when no single model matches.
|
|
39
|
+
|
|
40
|
+
| Result member | Description |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `transaction` | The generated transaction model, or `None` when errors are present. |
|
|
43
|
+
| `diagnostics` | Placement and validation diagnostics. |
|
|
44
|
+
| `errors` | Error diagnostics. |
|
|
45
|
+
| `unmatched_segments` | Segments that did not fit the transaction layout. |
|
|
46
|
+
|
|
47
|
+
## `load_transaction_model(transaction_set_id, *, implementation_version=None, release=None)`
|
|
48
|
+
|
|
49
|
+
Imports and returns a generated `X12TransactionSet` subclass. `find_transaction_set` returns its `TransactionSetEntry` without importing it, and `TRANSACTION_SETS` lists every entry.
|
|
50
|
+
|
|
51
|
+
## `X12TransactionSet.parse(transaction, delimiters)`
|
|
52
|
+
|
|
53
|
+
Parses with a specific generated model, for example `TS835.parse(raw, delimiters)`. See [Transaction Sets](transactions.md).
|