Documentation

X12 Mappings

English-to-X12 lookup for SDK classes, methods, and properties.

This document maps the SDK's English-facing classes, methods, and properties to the underlying X12 concepts they represent.

Looking for what a specific validation diagnostic means? See diagnostics.md — every code the engine emits is documented there in plain English plus X12 detail.

Reading Guide

X12 names in this repo follow the standard envelope hierarchy:

  • ISA / IEA: interchange envelope
  • GS / GE: functional group envelope
  • ST / SE: transaction set envelope
  • Loops, segments, and elements: business content inside the transaction

Some SDK fields are direct projections of a single X12 element. Others are normalized or derived values, such as totals and counts.

Class Mapping

English classX12 counterpartNotes
AnalyzerFile, buffer, or stream level X12 parserOrchestrates analysis of one or more X12 transaction sets.
AnalyzerOptionsParse and validation controlsGoverns how strictly the X12 envelope and transaction content are processed.
AnalysisResultParsed interchange / group / transaction summaryHolds structure, counts, diagnostics, and extracted transactions.
TransactionFactsPHI-safe X12 transaction snapshotNormalized facts extracted from one transaction set.
TransactionTypeX12 transaction classificationMaps to business transaction families: 837P/I/D (claims), 835 (remittance), 270/271 (eligibility), 276/277 (claim status), 277CA (claim acknowledgment), 278 (prior authorization), 820 (premium payment), 834 (benefit enrollment), 999 (implementation acknowledgment), TA1 (interchange acknowledgment).

Method Mapping

English methodX12 counterpartNotes
analyze_file(path)Parse X12 from a fileReads a file and builds interchange, group, and transaction facts.
analyze_string(data)Parse X12 from a stringSame analysis path, but input is already in memory.
analyze_memory(span) / analyze_bytes(data)Parse X12 from a memory bufferUseful for embedded or streamed payloads.
analyze_stream(stream)Parse X12 from an input streamStream-oriented ingestion of X12 content.
analyze_file_streaming(path, callback)Transaction-by-transaction X12 extractionEmits each transaction set as it is parsed.
validate_file(path)X12 syntax / structural validationValidates envelope and control-number consistency without returning facts.
validate_string(data)X12 syntax / structural validationString-based validation only.
to_json() / to_dict()Serialize extracted X12 factsPresentation layer only; no new X12 meaning.
facts_json()Serialize PHI-safe transaction factsExports the normalized facts schema.
set_strict_validation()Envelope and rule enforcementControls how aggressively the parser validates X12 structure.
set_extract_facts()Fact extraction toggleEnables or disables PHI-safe transaction extraction.
set_max_transactions()Transaction-set processing limitCaps how many ST/SE sets are processed.
set_continue_on_error()Error recovery behaviorControls whether parsing continues after validation failures.

Property Mapping

Envelope and transaction controls

English propertyX12 counterpartNotes
typeST01 plus transaction-family refinementExample values: 837P, 837I, 837D, 835, 270, 271, 276, 277, 277CA, 278, 820, 834, 999. (277 and 277CA both have ST01=277; disambiguated by ST03 / implementation reference.)
interchange_controlISA13 / IEA02Interchange control number.
group_controlGS06 / GE02Functional group control number.
transaction_controlST02 / SE02Transaction set control number.
transaction_countCount of ST/SE transaction setsDerived from parsed transaction sets.
bytes_processedInput sizeDerived from the source payload length.
segments_parsedParsed segment countCount of segments encountered during parsing.
is_validValidation outcomeTrue when no blocking validation errors remain.
error_countValidation error countDerived from diagnostics.
warning_countValidation warning countDerived from diagnostics.
elapsed_secondsProcessing timeRuntime metric, not an X12 element.

837 / 835 facts

English propertyX12 counterpartNotes
claim_idCLM01 (837) or CLP01 (835)Primary claim identifier in the transaction.
claim_statusCLP02835 claim status code.
payer_id2010BB loop NM109Payer identifier.
payer_name2010BB loop NM103Payer name.
billing_provider_npi2010AA loop NM109Billing provider NPI.
place_of_serviceCLM05-1 (837P) or CLM05 (837I)Service location indicator.
original_referenceREF / trace / control reference elementsSource varies by transaction family; it is a normalized reference value.
patient_responsibility835 payment responsibility amountComputed from 835 payment detail.

Clinical and financial aggregates

English propertyX12 counterpartNotes
total_chargeAggregate charge from claim and service-line amountsDerived value, typically accumulated from claim/service detail.
total_paymentAggregate paid amount in 835Derived value from remittance payment detail.
service_line_countCount of service line segmentsTypically SV1 / SV2 for 837 and SVC for 835.
procedure_codesSV1 / SV2 / SVC procedure code valuesContext depends on transaction family.
diagnosis_codesHI segment codesUsually ICD-10 diagnosis codes in 837 transactions.
service_datesDTP date valuesNormalized date or date-range values from DTP segments.

Transaction-Family Notes

837 Professional / Institutional / Dental

English conceptX12 counterpartNotes
Claim identifierCLM01Primary claim control reference.
Billing provider NPI2010AA NM109Submitted billing provider identifier.
Payer identity2010BB NM109 / NM103Payer identifier and payer name.
Diagnosis codesHIClinical diagnosis codes attached to the claim.
Procedure codesSV1 / SV2Service-line procedure codes.
Service datesDTPClaim or service-line date information.

835 Remittance

English conceptX12 counterpartNotes
Claim identifierCLP01Claim reference in the remittance advice.
Claim statusCLP02Status code for the claim outcome.
Payment amount835 payment detailSummed into total_payment.
Patient responsibilityPayment responsibility detailSummed into patient_responsibility.
Procedure codesSVCService-level payment detail.

Practical Rule of Thumb

If the field is a control number, look at the envelope:

  • ISA / IEA for interchange-level data
  • GS / GE for functional-group-level data
  • ST / SE for transaction-set-level data

If the field is business content, look at the transaction family and loop:

  • 837 claims: CLM, NM1, HI, SV1, SV2, DTP, REF
  • 835 remittance: CLP, SVC, CAS, NM1, DTP, REF
  • 270/271 eligibility: HL, NM1, EQ (270 inquiry), EB (271 response), III, DTP
  • 276/277 claim status: HL, NM1, TRN, SVC, STC, REF, DTP
  • 277CA claim acknowledgment: HL, NM1, TRN, STC, SVC (service-line status), QTY, AMT
  • 278 prior authorization: HL (UMO/Requester/Subscriber/Dependent/Patient Event/Service), NM1, UM, HSD, SV1/SV2/SV3, TOO, TRN
  • 820 premium payment: BPR, TRN, N1, ENT, RMR, ADX, IT1, SAC, SLN
  • 999 implementation acknowledgment: AK1, AK2, IK3, IK4, CTX, IK5, AK9

Example

English phraseX12 mapping
patient NPINM109 in loop 2010BA where NM101 = IL
billing provider NPINM109 in loop 2010AA
payer nameNM103 in loop 2010BB
claim IDCLM01 in 837 or CLP01 in 835
service line countnumber of SV1 / SV2 / SVC segments

Caveats

  • Some fields are computed, not direct one-to-one element copies.
  • Some values vary by transaction type, especially between 837 and 835.
  • When a field name is normalized for SDK users, this document names the most likely X12 source rather than every possible source.