@cosyte/x12 0.0.1 → 0.0.2
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.
- package/CHANGELOG.md +234 -145
- package/README.md +19 -14
- package/TRADEMARKS.md +31 -0
- package/dist/index.cjs +132 -132
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1291 -1291
- package/dist/index.d.ts +1291 -1291
- package/dist/index.mjs +132 -132
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
# @cosyte/x12
|
|
2
2
|
|
|
3
|
-
> Parse real-world, vendor-quirky ASC X12 healthcare EDI
|
|
3
|
+
> Parse real-world, vendor-quirky ASC X12 healthcare EDI (835 remits, 837 claims, 270/271 eligibility, 276/277 status, 278, 820, 834, 999/TA1) and pull the fields you need without reading a TR3.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@cosyte/x12)
|
|
6
6
|
[](https://github.com/cosyte/x12/actions/workflows/ci.yml)
|
|
7
7
|
[](./LICENSE)
|
|
8
8
|
[](https://nodejs.org)
|
|
9
9
|
|
|
10
|
-
A developer-focused ASC X12 EDI parser and utility library for Node.js and TypeScript
|
|
10
|
+
A developer-focused ASC X12 EDI parser and utility library for Node.js and TypeScript: the payer-side sibling of [`@cosyte/hl7`](https://github.com/cosyte/hl7). Zero runtime dependencies, dual ESM/CJS, strict types. Lenient on the way in (vendor deviations become warnings, not exceptions), spec-clean on the way out.
|
|
11
11
|
|
|
12
|
-
> **Status:** pre-alpha
|
|
12
|
+
> **Status:** pre-alpha, **published on npm at `0.0.1`**, on the `0.0.x`-until-first-alpha ladder, from a public repo. The full v1 **read** scope (270/271, 276/277/277CA, 278, 820, 834, 835, 837P/I/D, 999, TA1) and **emit** scope (per-transaction domain builders + a general serializer) are complete and hardened. Pre-alpha means the public API may still move before `0.1`. Pin an exact version.
|
|
13
13
|
|
|
14
14
|
## Quickstart
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
# pnpm (recommended)
|
|
17
|
+
# pnpm (recommended), also works with: npm install @cosyte/x12 | yarn add @cosyte/x12
|
|
18
18
|
pnpm add @cosyte/x12
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Parse an 835 remittance advice and read the money
|
|
21
|
+
Parse an 835 remittance advice and read the money, three lines of useful output, no TR3 lookup:
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
24
|
import { parseX12, get835 } from "@cosyte/x12";
|
|
@@ -27,25 +27,30 @@ const ix = parseX12(rawEdi); // never throws except on 4 structural fatals
|
|
|
27
27
|
const tx = ix.groups[0]?.transactions.find((t) => t.st.elements[1] === "835");
|
|
28
28
|
const remit = tx ? get835(ix.delimiters, tx) : undefined;
|
|
29
29
|
|
|
30
|
-
remit?.payment.totalActualPayment.toString(); // "450.00"
|
|
31
|
-
remit?.claims[0]?.patientControlNumber; // "PT-ACCT-001"
|
|
32
|
-
remit?.claims[0]?.serviceLines[0]?.adjustments[0]?.reasonCode; // "1"
|
|
30
|
+
remit?.payment.totalActualPayment.toString(); // "450.00": BigInt-exact, never a float
|
|
31
|
+
remit?.claims[0]?.patientControlNumber; // "PT-ACCT-001": your account number, echoed back
|
|
32
|
+
remit?.claims[0]?.serviceLines[0]?.adjustments[0]?.reasonCode; // "1": CARC (why it was adjusted)
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
That's the pitch: no schema upload, no spec knowledge. The parser accepts vendor-quirky input by default and flags what it tolerated with stable warning codes; you reach for strict mode, dot-paths, profiles, or the emit builders when you want them.
|
|
36
36
|
|
|
37
37
|
## What's inside
|
|
38
38
|
|
|
39
|
-
- **Every v1 HIPAA transaction, read + emit
|
|
40
|
-
- **Postel's Law
|
|
41
|
-
- **Money is exact
|
|
42
|
-
- **Safety-critical fidelity
|
|
43
|
-
- **PHI-disciplined
|
|
39
|
+
- **Every v1 HIPAA transaction, read + emit**: 270/271, 276/277/277CA, 278, 820, 834, 835, 837P/I/D, plus 999/TA1 acknowledgments. Per-transaction helpers (`get835`, `get837Claims`, `get271Eligibility`, …) and domain builders (`build835`, `build837P/I/D`, `build271`, …).
|
|
40
|
+
- **Postel's Law**: a lenient parser (deviations → warnings with a stable code + positional context) and a strict, spec-clean serializer with recomputed envelope counts. Only **4 structural failures** are ever fatal.
|
|
41
|
+
- **Money is exact**: every monetary/percent/quantity field decodes as `X12Decimal` (string-backed, BigInt arithmetic). The library **never `parseFloat`s** an EDI amount.
|
|
42
|
+
- **Safety-critical fidelity**: TRN reassociation traces, 835 balance invariants, 837 HL hierarchy integrity, 834 maintenance types, and 278 certification actions are preserved **verbatim** and never inferred; ambiguity yields a warning or a typed refusal, never a confident wrong answer.
|
|
43
|
+
- **PHI-disciplined**: synthetic-only fixtures, a PHI commit-gate, and warnings/errors that carry codes and positions but never patient data.
|
|
44
44
|
|
|
45
45
|
See the [**Cookbook**](./docs-content/cookbook.md) for task-oriented recipes (post an 835, route 277CA rejections, round-trip a 271, walk an 837, read a 999) and [**KNOWN-LIMITATIONS.md**](./KNOWN-LIMITATIONS.md) for the honest do-not-over-trust list.
|
|
46
46
|
|
|
47
|
+
## Trademarks
|
|
48
|
+
|
|
49
|
+
Availity and Blue Cross Blue Shield are trademarks of their respective owners. cosyte is not affiliated with, endorsed by, or
|
|
50
|
+
sponsored by any of them. The names identify the trading partners whose companion-guide deviations the built-in profiles accommodate. See [TRADEMARKS.md](./TRADEMARKS.md).
|
|
51
|
+
|
|
47
52
|
## License
|
|
48
53
|
|
|
49
|
-
MIT
|
|
54
|
+
MIT. See [LICENSE](./LICENSE).
|
|
50
55
|
|
|
51
56
|
Built by [Cosyte](https://cosyte.com).
|
package/TRADEMARKS.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Trademarks
|
|
2
|
+
|
|
3
|
+
`@cosyte/x12` is an independent open-source project. cosyte is **not affiliated with, endorsed by,
|
|
4
|
+
or sponsored by** any company named in this repository or its documentation.
|
|
5
|
+
|
|
6
|
+
## Why these names appear
|
|
7
|
+
|
|
8
|
+
Clearinghouses and payers publish companion guides that deviate from the base X12 implementation
|
|
9
|
+
guide. A profile records whose deviation it accommodates, which cannot be said without naming
|
|
10
|
+
them.
|
|
11
|
+
|
|
12
|
+
Every reference is **descriptive**: it identifies whose companion-guide deviation a profile accommodates, and nothing more. Naming a system is the only way to say
|
|
13
|
+
whether a library works with it.
|
|
14
|
+
|
|
15
|
+
## Where the profiles come from
|
|
16
|
+
|
|
17
|
+
The built-in profiles are authored through this package's own public `defineProfile()` API and are
|
|
18
|
+
grounded in **synthetic** fixtures written from scratch. No real payer or clearinghouse file was
|
|
19
|
+
used to produce them. They are descriptive only: selecting a profile never changes a correct
|
|
20
|
+
parse. They embed no privileged, confidential, or reverse-engineered material.
|
|
21
|
+
|
|
22
|
+
## Names referenced
|
|
23
|
+
|
|
24
|
+
| Name | Where it appears |
|
|
25
|
+
| ----------------------------- | --------------------------------------------------------------------------------------------- |
|
|
26
|
+
| Availity | `profiles.availity`: a built-in profile name |
|
|
27
|
+
| Blue Cross Blue Shield (BCBS) | `profiles.bcbsCommon`: a built-in profile name, and descriptive use in documentation examples |
|
|
28
|
+
|
|
29
|
+
All product names, logos, and brands are the property of their respective owners. Use of a name here
|
|
30
|
+
does not imply any affiliation with, or endorsement by, its owner. If you own one of these marks and
|
|
31
|
+
would like a reference changed, please open an issue.
|