@openinsure/x12 package provides a pure TypeScript parser and builder for X12 EDI transaction sets used in healthcare, insurance, and transportation. No external EDI libraries or services are required — all processing runs in-process on Cloudflare Workers.
Supported Transaction Sets
| Set | Name | Direction | Use case |
|---|---|---|---|
| 834 | Benefit Enrollment & Maintenance | Inbound | Group health member enrollment from employer |
| 835 | Healthcare Claim Payment/Advice | Inbound | EOB from carrier to provider / plan |
| 837P | Healthcare Claim — Professional | Outbound | Stop-loss claim submission to reinsurer |
| 210 | Motor Carrier Freight Invoice | Inbound | Freight billing for transportation lines |
| 211 | Motor Carrier Bill of Lading | Inbound | Shipment manifest for cargo insurance |
Parsing
Member Enrollment (834)
Claim Payment (835)
Building
Transportation (210 / 211)
For commercial transportation insurance programs:Validation
The parser validates each transaction set against the relevant HIPAA or X12 implementation guide:| Check | Example |
|---|---|
| ISA/GS/GE/IEA envelope | Segment counts must match |
| Required elements | Missing NM1 segment → error |
| Element format | Date must be YYYYMMDD |
| Code values | Only valid X12 qualifier codes accepted |
Production Considerations
Caution: ISA envelope setup — Production X12 transmissions require the correct ISA sender/receiver IDs and qualifiers agreed with your trading partner. Test withISA*00*...*T*:~(test indicatorT) before switching toP(production).
- Money type: All monetary fields (
paymentAmount,submitted,paid,charge,totalCharge, etc.) returnMoneyobjects from@openinsure/ratingwith integer-cent precision. UsetoDollars(m)for display formatting. - Character encoding: X12 uses ASCII. Characters outside the basic ASCII set in insured names or addresses must be transliterated before building.
- Segment terminator: The package defaults to
~. Some trading partners use\nor\r\n. Configurable inbuild*()functions. - Acknowledgment (999): The package can parse 999 functional acknowledgments to confirm your 837P was accepted.
Integration Points
- Member enrollment (834) → populates the
memberstable for group health captives - Claim payment (835) → auto-reconciles claim payments against open reserves in the TigerBeetle ledger
- Professional claim (837P) → submits stop-loss claims to the reinsurer
- BOL (211) → pre-populates cargo submission fields for transportation risks