Parsing 837 (Healthcare Claim) Transactions

The parser returns regular business objects (POJOs) such as Claim, Payment, ServiceLine, Subscriber, and so on. All X12 EDI segments and elements from 837/835 have been mapped to the appropriate properties of the business objects.

The parser’s object model provides an excellent level of abstraction so that developers don’t need to deal with X12 EDI artifacts, such as segments and loops.

Here is a simple example:

// parse all transactions in the file
EdiParsingResults results = parser.parse();
// results contains claims, payments, etc.
List<Claim> claims =;

Claim sampleClaim = claims.get(0);
// get some key attributes of the claim
BigDecimal billedAmount = sampleClaim.chargeAmount();
String patientControlNumber = sampleClaim.patientControlNumber();
// Providers
OrgOrPerson billingProvider = sampleClaim.billingProvider();
String providerNpi = billingProvider.identifier();
assertNotNull(billedAmount, patientControlNumber, providerNpi);
// Service lines
for (var line : sampleClaim.lines()) {
    String procedureCode = line.procedure().code();
    LocalDate serviceDate = line.serviceDateFrom();
    Integer unitCount = line.unitCount();
    UnitType unitType=line.unitType();
    assertNotNull(procedureCode, serviceDate, unitCount, unitType);

Claim is the root of the object graph when parsing 837s. It aggregates information from segments from the “Claim Information” loop, including “CLM,” all the “REF” segments, all the dates segments, and so on. The Claim also contains entities from the billing provider and the subscriber loops.

As expected, a claim contains a list of service lines, and each line contains line-level data, such as CPT codes, amounts, and providers, obtained from the appropriate segments in the “Service Line Number” loop.

The parser translates EDI qualifiers and some of the codes to Java enums. For example, the patient gender code from the DMG segment is parsed as GenderType enum. Entity Identifier Code from NM1 is translated into EntityRole enum.

Similarly, the Place of Service (CLM05 element) is translated into the PlaceOfServiceType enum.

Below are examples of enums:

EdiParsingResults results = parser.parse();
List<Claim> claims =;

Claim claim = claims.get(0);
PlaceOfServiceType pos=claim.placeOfServiceType();

PatientSubscriber patient = claim.patient();

EntityRole entityRole=patient.person().entityRole();

EntityType entityType=patient.person().entityType();

GenderType genderType=patient.person().gender();

To parse large files, the parser can read a file in chunks consisting of the specified number of EDI transactions. The client’s application can then process each chunk in parallel if needed. For example, claims from each chunk can be persisted using reactive drivers provided by Spring Boot.

var parser = new EdiParser(ediFile);
while (true) {
    // parse 2 transactions at a time
    var results = parser.parse(2);
    if (results.isDone()) {
    // get all claims for this chunk
    var claims =;
    // your logic goes here
    // ...

Please visit our GitHub repo for more examples.

Register below to get access to the parser: