Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Healthcare EDI ANSI X12 Parser (837P / 835 / 271) — Python SDK

PyPI version Python Versions License: MIT Stanza API

Zero-regex parser converting raw Healthcare ANSI X12 EDI text into strongly-typed hierarchical JSON with client-side HIPAA DLP guardrails.

Official, zero-dependency Python 3.8+ client library for Healthcare EDI ANSI X12 Parser (837P / 835 / 271), built on the Stanza Micro-API Network. Intended for enterprise data pipelines, backend verification, and sub-5ms edge compute.


📦 Installation

pip install stanzaapi-x12-parser

🚀 Quickstart

import os
from stanzaapi_x12_parser import X12ParserClient

# Initialize client (api_key optional for local evaluation)
client = X12ParserClient(
    api_key=os.getenv("STANZA_API_KEY")
)

# Execute deterministic validation
response = client.parse("ISA*00*          *00*          *ZZ*SUBMITTER      *ZZ*RECEIVER       *230915*1000*^*00501*000000001*0*T*:~GS*HC*SUBMITTER*RECEIVER*20230915*1000*1*X*005010X222A1~ST*837*0001*005010X222A1~BHT*0019*00*CLAIM001*20230915*1000*CH~NM1*41*2*SUBMITTER*****46*123456789~PER*IC*EDI DEPT*TE*8005551212~NM1*40*2*RECEIVER*****46*987654321~HL*1**20*1~PRV*BI*PXC*207Q00000X~NM1*85*2*CLINIC*****XX*1999999999~HL*2*1*22*0~NM1*IL*1*SYNTHETIC*PATIENT****MI*SYN123456~CLM*CLM001*150.00***11:B:1*Y*A*Y*Y~HI*BK:J0100~LX*1~SV1*HC:99213*150.00*UN*1***1~DTP*472*D8*20230910~SE*15*0001~GE*1*1~IEA*1*000000001~")

if response.get("success"):
    print("Verification Success:", response["data"])
else:
    print("Validation Error:", response.get("error"), response.get("code"))

📄 Example Response

{
  "success": true,
  "data": {
    "transaction_type": "837P",
    "control_number": "0001",
    "total_charge": 150,
    "patient": {
      "last_name": "SYNTHETIC",
      "first_name": "PATIENT"
    },
    "claims": [
      {
        "claim_id": "CLM001",
        "amount": 150,
        "service_lines": [
          {
            "code": "99213",
            "charge": 150
          }
        ]
      }
    ]
  }
}

⚙️ Client Options

Parameter Type Default Description
api_key Optional[str] os.getenv("STANZA_API_KEY") Your Stanza API Key. Required for production quotas.
base_url Optional[str] "https://api.stanzaapi.com/x12-parser" Public edge API base URL. Enterprise tier defaults to "https://secure.api.stanzaapi.com" (AWS BAA secure plane, DNS-only/unproxied).
timeout int 15 Request timeout in seconds.
tier str "sandbox" Compliance routing tier ("sandbox", "pro", or "enterprise").

🔒 Client-Side HIPAA Safe Harbor DLP Guardrail

This SDK includes a local Data Loss Prevention (DLP) pre-flight scanner that protects un-de-identified patient records:

  • Non-BAA Tiers ("sandbox" / "pro"): If live patient identifiers (unmasked 9-digit SSNs on REF*SY or real patient names on NM1*QC) are detected, the request is aborted locally and raises PhiDetectionGuardrailError. Zero patient bytes leave your network.
  • Enterprise Tier ("enterprise"): Directs requests to the AWS HIPAA BAA Backplane at https://secure.api.stanzaapi.com (DNS-only, never proxied through Cloudflare) under a signed Business Associate Agreement.
from stanzaapi_x12_parser import X12ParserClient, PhiDetectionGuardrailError

try:
    result = client.parse(raw_edi_string)
except PhiDetectionGuardrailError as err:
    print("Blocked client-side HIPAA violation:", err)

🔗 Useful Links

📄 License

MIT © Stanza — Powered by Stanza.

About

Healthcare EDI ANSI X12 Parser (837P / 835 / 271) (python client)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages