imsweb / x12-parser

A Java parser for ANSI ASC X12 documents.
Other
80 stars 44 forks source link

Issue when processing 271-5010 file for dependent #72

Open chenw5000 opened 5 months ago

chenw5000 commented 5 months ago

Hi, Dev

We are trying to use the update https://github.com/nddipiazza/x12-parser/tree/issue_48_add_271_5010_support to support 271-5010 version.

The following is an example from the x12.org:

ISA*00*          *00*          *ZZ*AV09311993     *01*030240928      *240312*0240*U*00501*000001044*1*T*:~
GS*HB*92-1609342*030240928*20240312*0240*1044*X*005010X279A1~
ST*271*4322*005010X279A1~
BHT*0022*11*10001235*20060501*1319~
HL*1**20*1~
NM1*PR*2*ABC COMPANY*****PI*842610001~
HL*2*1*21*1~
NM1*1P*2*BONE AND JOINT CLINIC*****SV*2000035~
HL*3*2*22*1~
NM1*IL*1*SMITH*JOHN****MI*123456789~
N3*15197 BROADWAY AVENUE*APT 215~
N4*KANSAS CITY*MO*64108~
DMG*D8*19630519*M~
HL*4*3*23*1~
TRN*2*93175-012547*9877281234~
NM1*03*1*SMITH*MARY~
N3*15197 BROADWAY AVENUE*APT 215~
N4*KANSAS CITY*MO*64108~
DMG*D8*19981014*F~
INS*N*19~
DTP*346*D8*20060101~
EB*1**30**GOLD 123 PLAN~
EB*L~
LS*2120~
NM1*P3*1*JONES*MARCUS****SV*0202034~
LE*2120~
EB*1**1^33^35^47^86^88^98^AL^MH^UC~
EB*B**1^33^35^47^86^88^98^AL^MH^UC*HM*GOLD 123 PLAN*27*10*****Y~
EB*B**1^33^35^47^86^88^98^AL^MH^UC*HM*GOLD 123 PLAN*27*30*****N~
SE*28*4322~
GE*1*1044~
IEA*1*000001044~

But the current code cannot identify the dependent section and shows error like:

reader error: [Unable to find a matching segment format in loop 2100C, Unable to find a matching segment format in loop 2100C] reader fatal error: [Parent loop 2000D is missing and should already exist, Failed to store loop data for 2100D]

anupchaudhari commented 4 months ago

Hello there. I just raised a PR for https://github.com/anupchaudhari/x12-parser/tree/issue_68_270_271_5010_support I was facing similar issues with the previous fork so I wrote these changes from scratch. Please give it a try and let me know if it works for you. :)