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.
- 🌐 Live Web Playground: Test your inputs online
- 📚 API Documentation: View full schema on Stanza
- ⚡ Platform Overview: Explore the Stanza Developer Network
pip install stanzaapi-x12-parserimport 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")){
"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
}
]
}
]
}
}| 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"). |
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 onREF*SYor real patient names onNM1*QC) are detected, the request is aborted locally and raisesPhiDetectionGuardrailError. Zero patient bytes leave your network. - Enterprise Tier (
"enterprise"): Directs requests to the AWS HIPAA BAA Backplane athttps://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)- Healthcare EDI ANSI X12 Parser (837P / 835 / 271) Interactive Sandbox
- Stanza Developer Directory
- Source Code & Issue Tracker
MIT © Stanza — Powered by Stanza.