-
Notifications
You must be signed in to change notification settings - Fork 26
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
Layouts failing because maps are incorrect for ORed segments #39
Comments
ORR_O02_ORDERMap has same problem |
So this is a choice, and you're right, the generated map just isn't going to cut it. The question is, should the Layout include a single Segment, which can be one of those types, or does there need to be a new type which allows a selection/choice of segments. Because of things like But using something like |
Here is what I am thinking... Introduce a new type to provide a choice (e.g. Segment<Option<OBR, RQD, RQ1, RXO, ODS, ODT>>) The field in the ORM_O01_ORDER_DETAIL layout could look something like this... The corresponding map would look something like this... The Option method would work similar to Layout in that it would allow you define at the Segment level. This would sick because we would also be able to potentially define optional layouts. The corresponding map could look something like this...
|
Well, I won't nest generic types like that, it's a train wreck of complexity. Since the segments and maps are all generated code, it doesn't matter if the configuration of it is verbose, so I'm thinking that another type of Layout makes sense. A type that has a property for each Segment, and they're all optional, but the Option type itself is required, and an option type is valid if one of the segments is present. It's essentially how you would specify an Or condition in a layout.
Then in the map
Then you could select using |
The more I think about this, the more it makes sense to just have a Segment, and provide the ability to dynamically cast it so it can be used in pattern matching rather than forcing it into a separate interface. Then the map can specify the valid types.
|
Yeah, I see your point. It would make more sense doing it at the map level. So, the map would something like this.. Option(x => x.OrderDetail, x => So, the more I think about it, we will also need something similar on the query side as well. How would I use this in the Query method? How would I access it off of EntityResult? It might make sense also thinking about it from the query perspective as well. Perhaps defining it as an interface instead of dynamically makes most sense when thinking about querying. I can imagine that we would need to have some extension methods hanging off of the EntityResult to get at and perform work: Select<TSegment> : need to be able to return the optional result Perhaps would need to modify Translates as well to be able to get at conditional segments. |
ignored test because of issue phatboyg#39
ignored test because of issue phatboyg#39
At this point many Layouts are not useful until this is fixed. This is a critical bug. I currently don't see this as a problem in X12. This seems to be strictly an HL7 issue for now but I think it probably should be commonly available to any Schema. @phatboyg |
HL7 layouts cannot work without this functionality. |
Consider the following HL7 2.6 specification fragment...
ORC
[
<OBR|RQD|RQ1|RXO|ODS|ODT>
[{ NTE }]
[ CTD ]
[{ DG1 }]
[{
OBX
[{ NTE }]
}]
]
...the current Machete schema and map for this is as follows:
The problem is that when the spec identifies segments as <OBR|RQD|RQ1|RXO|ODS|ODT> we are interpreting this to mean all segments are required rather than one, which is the intent of the spec specifying the OR operator (i.e. |). Also, because we have defined this as being 6 segments the indexes are off, which means it will never match a real ORM message.
The text was updated successfully, but these errors were encountered: