Hierarchical Loop error unbundling 837 P claims (5010)

Apr 2, 2013 at 6:02 PM
Dear Dstrubhar,

This is another error I am getting when trying to unbundle some X12 837 5010 P claims:

Hierarchical Loop 1425 expects Parent ID 1411 which did not occur preceding it.

Any insight into how/why this occurs and anything we can do as a workaround would be greatly appreciated.

Thank you, in advance, for your kind help.
Kind Regards,
Apr 2, 2013 at 6:17 PM
Edited Apr 2, 2013 at 6:21 PM
Have you always gotten this error? Or is it only in the latest release?

According to https://www.disa.org/apps/workbook/X12_October_2012/se/se_HL.htm the numbers should be unique and sequential within the file.

IS this a true EDI file that has passed through a clearinghouse or is a test file?

Does the HL * 1411 * ~ segment occur later in the file?

I could either modify the code so that HL loops that point to non-exist parent IDs can just parse as if it didn't have a parent ID, but if the parent ID appears later in the file this could be harder to do. But my understanding is the HL loops should be sequential. Did the parser fail to see the HL * 1411 * segment earlier in the file?
Apr 3, 2013 at 12:39 AM
Thank you for your response. This information is very useful.

I am getting this error with last year's release (August'12).

Using example from another claim that also fails with a similar error:
Hierarchical Loop 1017 expects Parent ID 998 which did not occur preceding it.

I don't find the HL * 998 * * anywhere in the claim. This means the parent segment is missing, correct?

Thanks again!
Apr 3, 2013 at 2:30 AM
Yes, it appears that it is pointing to a parent that is missing. I am surprised that you are getting this problem in production files. Though I have had a few others report this same problem.
There might be some validation tools available to help point out these type of syntax errors before you accept a file from your trading partner.

I am going to change the code to continue parsing this type of error, but throwing warning events so you know the file may not be valid. I'll update the discussion when the code is checked in.
Apr 3, 2013 at 2:50 AM
Respected Sir,
I can't thank you enough for your help with this issue. In fact, this is not the first time you actually fixed the parser for syntax errors in production data I reported to you.

I have communicated your response back to our Trading partner. Hopefully, they will be able to correct this for future claims.

I can't express how grateful I am to you and this wonderful product you (and your team) has created.

In the true interest of open source, I can only pray that this product get more visibility and be widely accepted in the healthcare arena (if not already well-known in the industry). Thank you again, Sir.


Apr 3, 2013 at 3:12 AM
I have updated changeset 24814 to allow for parsing of the syntax error that you have.
Because this will no longer throw an exception on this error. Make sure that you have an event handler for the new ParserWarning event that I have added. This will allow you to identify files that are invalid. It will be up to you if you still want to process and accept the file even with the bad syntax.
Apr 3, 2013 at 3:06 PM
I have made one more change to changeset 24841 that will actually make the default behavior throw exceptions as before. When you pass into the X12Parser constructor throwExceptionOnSyntaxErrors = false, this will have the new behavior that will throw warnings instead for both the missing HL parent and for unrecognized segments.
This will keep the behavior the same for existing users, but allow them to switch over to warnings at their convenience. I will probably get a new release out within the week.
Apr 3, 2013 at 8:18 PM
I absolutely agree. I will download the new files and test shortly.
Thank you again for making this change on such a short notice. I really appreciate your prompt help.