-
-
Notifications
You must be signed in to change notification settings - Fork 52
Description
I am currently working/trying very hard to support the EDI data I for myself need to use, which is the EDIFACT format used in Austria for medical systems. It's horrible. Standards? we don't need that, we create our own stuff.
But even in the english Wikipedia article about EDIFACT there is an example that looks like this:
UNA:+.? '
UNB+IATB:1+6XPPC:ZZ+LHPPC:ZZ+940101:0950+1'
...
With few knowledge you you might have seen that the UNB header has "IATB" in its SyntaxIdentifier field. Which is None of "UNO[A-F]" - like the UNECE published as standard codes for that field.
In Austria, we use "ANSI", "DINA", "IBMA", "UNIX" as values there, basically it is "ANSI". And no, this is not ANSI/X12, it is EDIFACT. But non-standard rules. Even the UNB
header has other fields: SENDER
, RECEIVER
, DATE
, TIME
are all simple data elements, not a combined one for date/tie, like in the UNECE standard:
UNB+ANSI:1+ME123456+ME654321+230403+0840+1'
does the header look like.
So I have to find a way to support all these different formats.
I suggest to use a dict for Segment.plugins
with the tag name, which makes searching for tags easier and faster (as dict keys are indexed/hashed).
Segment.plugins["UNH"] -> list[Segment]
This list has only the few Segment classes that are supported - which may be 10 sometimes, but not 1000+ if we put all classes into one flat list, as we have now.
Each Segment must define a version (which can then be compared to the needed version in SegmentFactoy.create_segment()
. And it must provide the supported syntax, like ["ANSI", "UNOA", "UNOB", "UNOC",...]
, which is sumb too if we'd have to add that to each Segment class.
But in fact, each "standard" has other segments.
@lord-haffi Ideas?
I can not think about another, better way of supporting more versions.