duderoot / x12-parser

Automatically exported from code.google.com/p/x12-parser
0 stars 0 forks source link

Cannot get the parser to work for a 271 response. #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. load the Cf as provided below.
2. traverse to LS loop.
3. lsLoop.findSegment() always returns empty list.

What is the expected output? What do you see instead?
It should return segments within LS loop, e.g. NM1, N3, N4, etc.
But it always returns empty list.

What version of the product are you using? On what operating system?
I am using x12-v0.9.jar on Windows.

Please provide any additional information below.

I guess the issue is how to tell the parser the LS/LE loop.

Here is my loadCf():
{
    Cf cfX12 = new Cf("X12"); // root node
    Cf cfISA = cfX12.addChild("ISA", "ISA");
    Cf cfGS = cfISA.addChild("GS", "GS");
    Cf cfST = cfGS.addChild("ST", "ST", "271", 1);

    Cf cf2000A = cfST.addChild("2000A", "HL", "20", 3); // Info Source
    Cf cf2000B = cfST.addChild("2000B", "HL", "21", 3); // Info Receiver
    Cf cf2000C = cfST.addChild("2000C", "HL", "22", 3); // Subscriber
    Cf cf2000D = cfST.addChild("2000D", "HL", "23", 3); // Dependent

    Cf cf2100A = cf2000A.addChild("2100A", "NM1");  // Info Source Name

    Cf cf2100B = cf2000B.addChild("2100B", "NM1");  // Info Receiver Name

    Cf cf2100C = cf2000C.addChild("2100C", "NM1");  // Subscriber Name
    Cf cf2110C = cf2100C.addChild("2110C", "EB");   // Subscriber Eligibility/Benefits
    Cf cf2115C = cf2110C.addChild("2115C", "III");  // Subscriber Elig or Benefit Additional Info
    Cf cf2120C = cf2110C.addChild("LS", "LS");  // Subscriber Benefit Related Entity Name
    cf2110C.addChild("LE", "LE");

    Cf cf2100D = cf2000D.addChild("2100D", "NM1");  // Dependent Name
    Cf cf2110D = cf2100D.addChild("2110D", "EB");   // Dependent Eligibility/Benefits
    Cf cf2115D = cf2110D.addChild("2115D", "III");  // Dependent Elig or Benefit Additional Info
    Cf cf2120D = cf2110D.addChild("LS", "LS");  // Dependent Benefit Related Entity Name
    cf2110D.addChild("LE", "LE");

    cfGS.addChild("SE", "SE");
    cfISA.addChild("GE", "GE");
    cfX12.addChild("IEA", "IEA");
}

Original issue reported on code.google.com by james...@gmail.com on 31 May 2013 at 1:19

GoogleCodeExporter commented 8 years ago
I found the real issue -- Loop 2100C/2100D NM1 conflicts with the NM1 segments 
within LS/LE loop. So the workaround solution is:

    //Cf cf2100C = cf2000C.addChild("2100C", "NM1");    // Subscriber Name
    Cf cf2110C = cf2000C.addChild("2110C", "EB");   // Subscriber Eligibility/Benefits
    //Cf cf2115C = cf2110C.addChild("2115C", "III");    // Subscriber Elig or Benefit Additional Info
    //Cf cf2120C = cf2110C.addChild("LS", "LS");    // Subscriber Benefit Related Entity Name
    //cf2110C.addChild("LE", "LE");

    //Cf cf2100D = cf2000D.addChild("2100D", "NM1");    // Dependent Name
    Cf cf2110D = cf2000D.addChild("2110D", "EB");   // Dependent Eligibility/Benefits
    //Cf cf2115D = cf2110D.addChild("2115D", "III");    // Dependent Elig or Benefit Additional Info
    //Cf cf2120D = cf2110D.addChild("LS", "LS");    // Dependent Benefit Related Entity Name
    //cf2110D.addChild("LE", "LE");

Original comment by james...@gmail.com on 1 Jun 2013 at 2:07

GoogleCodeExporter commented 8 years ago
I am not sure why you are getting conflicts. Since the subscriber and dependent 
loops are under different hierarchy.

You might also be able to resolve this using the alternate constructor for add 
child for the NM1 segments.

Cf cf2100C = cf2000C.addChild("2100C", "NM1", "IL", 1); // Subscriber Name
Cf cf2100D = cf2000D.addChild("2100D", "NM1", "QC", 1); // Dependent Name

Original comment by p2b...@gmail.com on 3 Jul 2013 at 7:21

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi guys

Can you please give me example for parsing 271 response ?

Original comment by vbsenthi...@gmail.com on 19 Aug 2013 at 8:20

GoogleCodeExporter commented 8 years ago
I know this is old, but I wanted to chime in as well.  The issue is that for 
271 there are "NM1" segments in multiple loops in the same hierarchy (2100C and 
2120C, 2100D and 2120D).  I have not been able to come up with a configuration 
that allows you to properly access all of these segments in their appropriate 
places. The suggestion to use the segment qualifiers unfortunately won't work 
since none of the NM1 elements can uniquely identify the loop that the segment 
belongs to.

Original comment by anthony....@gmail.com on 29 Apr 2015 at 2:58