node-x12 icon indicating copy to clipboard operation
node-x12 copied to clipboard

X12 EDI Loop Schema Possibilities

Open Elijah-Smith96 opened this issue 2 years ago • 2 comments

Hi Aaron, I was wanting to know if there is a way to generate a JSON object containing all of the appropriate loops within the parsed EDI. Im very interested in the 837 capabilities, so far all I have been able to produce are objects containing the segments and elements. What I would like to produce would be nested objects containing the actual 837 loops.

Elijah-Smith96 avatar Nov 11 '23 17:11 Elijah-Smith96

Do you have sample documents? I think the query language may be the best place to start, but if you can share some samples, I'd be able to provide a more clear answer.

aaronhuggins avatar Nov 11 '23 18:11 aaronhuggins

@Elijah-Smith96 I'm pretty sure the query language will be your path forward. X12 does not specify loop behaviors natively; they provide semantic constructs for defining loops in an X12 interchange, but beyond that how a loop behaves and/or how you get information about a loop is rather undefined.

The purpose of the query language is to overcome limitations in the X12 schema, among those limitations being loops. The FOREACH macro in the query language will be your best friend. More detail about how to leverage the query language can be found in the transaction mapping guide, the test suite, and the test suite map sample which is used for validation.

aaronhuggins avatar Nov 11 '23 18:11 aaronhuggins