-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement high-level containers (Message & Interchange) #19
Comments
A and I would put But yes, this looks fine to me - but would be a bit of an overhaul ;-) |
Why not, but note the following : the term |
I don't know. ATM we have a str/file that is read into tokens, which is converted into Segments by the parser. in the next step I would create classes for each high-level API element (like FTX, DOC, etc.) and a map like {
"DTM": DateTimeSegment,
# ...
} These classes represent each special Segment and contain logic, validation etc. class DateTimeSegment(Segment):
def __init__(function_code_qualifier, value, format_code):
pass
def __str__(self):
pass
def __eq__(self, other):
pass enhance the parser (or especially, the SegmentFactory) to create a DateTimeSegment whenever it detects a DTM segment in the string. This way it is the most clear and readable structure I can think of. |
Oh, sorry, now I get the point. I kind of mix up
|
Idea for high level api, how it could be creating a message easily: m = Message(...)
m.add_segment(DTXSegment(...))
m.add_segment(NADSegment(...))
# ...
g = FunctionalGroup(...)
g.add_message(m)
g.add_message(...)
interchange = Interchange(...)
interchange.add_group(g) Correct? |
OK, let me know if I can help. |
I think there really are two possibly independent changes to be carried in current codebase/API :
Do you see it the same way or do you think that this is a work to be done at the same time ? |
- plan its removal for v1.0 - move from_file() method and UNA parsing to Interchange class - create a replacement RawSegmentCollection class for use cases with lousy structured segment bunches. Ref nerdocs#19
- plan its removal for v1.0 - move from_file() method and UNA parsing to Interchange class - create a replacement RawSegmentCollection class for use cases with lousy structured segment bunches. Ref nerdocs#19
- plan its removal for v1.0 - move from_file() method and UNA parsing to Interchange class - create a replacement RawSegmentCollection class for use cases with lousy structured segment bunches. Ref nerdocs#19
- plan its removal for v1.0 - move from_file() method and UNA parsing to Interchange class - create a replacement RawSegmentCollection class for use cases with lousy structured segment bunches. Ref nerdocs#19
In terms of high-level design and rough API, what do you think about :
It would allow to iterate over the segments as pydifact already does, or to go more semantically, digging Interchange−>Message->Segment.
Il let appart the functional groups for now, as they are optional, but they would fit easily in this model.
The text was updated successfully, but these errors were encountered: