keironstoddart / edi-835-parser

A simple EDI 835 file format parser.
MIT License
80 stars 40 forks source link

IndexError in entity.py #20

Closed nsargent22 closed 1 year ago

nsargent22 commented 1 year ago

Some remittance files contain the 'NM1' segment multiple times in the claim loop. Occasionally the 'NM1' segments contain fewer than 3 elements, which raises an IndexError exception once the segment gets to Entity class in entity.py.

nsargent22 commented 1 year ago

From edi_835_parser.segments.entity, lines 21 - 23:

self.entity = get_element(segment, 1) self.type = get_element(segment, 2) self.last_name = get_element(segment, 3)

Using get_element instead of segment[x] allowed many of the files which threw IndexError exceptions here to parse normally. I'll create a PR for this soon.