Comments (4)
Hi Isi,
This can happen when there's more than one way to parse the input. It could be an issue with the grammar, or possibly an important element is missing from the input.
For instance, many grammars have different NM1
loops which are instantiated by the parser depending on one of the elements -- like NM1*XX
might be "Customer Name" and NM1*YY
might be "Supplier Name". If your grammar accidentally specifies XX
as an allowed value for both loops, then the parser constructs two trees: one where the segment means "Customer Name" and another tree where the segment means "Supplier Name".
On the other hand, suppose your grammar is not ambiguous. If the input doesn't have a value at all in the first NM1
element (it's just blank), the parser doesn't have enough information to decide, resulting in the same problem. The parser could throw away the input (and create InvalidSegmentVal nodes), but the hope is that further input will resolve the ambiguity, which doesn't always work.
You can debug this by printing each parse tree (hopefully there are only a few) and comparing them -- ideally you have a small number of trees, and only one of the parse trees is correct, and you can decide by looking at it. To print the parse trees, you can pass a -N
flag to edi-pp
. This was just pushed to master, so be sure to pull these changes into your working branch. If the trees are large, I would dump the output of edi-pp -N
to a file and use a diff tool to help find the first place where they diverge.
Once you find the location where they diverge, look back at your grammar to see if you have overlapping constraints (like both segments share allowed values, but they should've been disjoint) or perhaps constraints are missing (like you have two reachable NM1
segments but no constraints on allowed values). The implementation guide builder should be doing the work of catching ambiguous grammars, but it's not implemented, and even that wouldn't catch all the potential problems.
from stupidedi.
Hi Kyle,
Adding this flag to edi-pp
is really helpful
For one of the sample files it never stops processing, no return, but luckily I got other files which process even though the output is very lenghty
from stupidedi.
One of the segments did not have a ending marker ~
i.e:
LIN**BP*999J16F000*ON*987654321~
SN1**10*PC
HL*4*2*I*0~
noticed SN1 does not have a line termination marker, that was causing the non-deterministic problems.
Now, by having a proper of SN1 shouldn't it have handle this error ? basically the system was reading PCHL as one item yet the last SN1 field (E355) is defined as max 2 chars-- just asking to see if we can improve StupidEDI
from stupidedi.
I have been studying the trees generated by edi-pp -N
and strangely enough some of the trees do not show any errors, are identical to each other
I will refresh git w/ the latest need to take a break as I am not being productive (spent most of the day chasing these issues down w/o any luck) 👎
from stupidedi.
Related Issues (20)
- iterating over files with multiple ISAs HOT 3
- Doesn't handle arbitrarily large input files, and never will be able to HOT 5
- Duplicate Keys HOT 3
- Unknown patient gender in 270 causes validation error HOT 2
- value PR is not allowed in element NM101 HOT 2
- Segment ST Does not occur HOT 2
- Parse EDI 850 ERROR HOT 1
- Accept Tempfile in Stupidedi::Reader.build HOT 1
- Segment N1*PR~ cannot be reached
- Parsing an 837 and grabbing segment values HOT 2
- Is there a way to skip validations and build without some of the segments HOT 2
- 004010 version - B3-07 precision doesn't work as intended HOT 2
- value 091 is not allowed in element DTM01 Date/Time Qualifier HOT 2
- TD1 for X12 Release 4010 gets reduced to 2 fields instead of 10 for no reason HOT 1
- 835 - 005010X221A1 - NTE segment error HOT 2
- Stream writing HOT 2
- help wanted: Only the first element is return when iterating a repeated element HOT 2
- Inconsistent floating point output in 834 ICM data HOT 9
- Adding the additional accepted values for a segement HOT 1
- File permissions issue on v1.4.3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stupidedi.