Comments (8)
ORR_O02_ORDERMap has same problem
from machete.
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 Segment<OBR>
are only going to support OBR.
But using something like Segment<HL7Entity>
is less than obvious, and requires the ability to TryGetEntity<T>
in order to bring it back as a typed segment.
from machete.
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...
Segment<Option<OBR, RQD, RQ1, RXO, ODS, ODT>> OrderDetail { get; }
The corresponding map would look something like this...
public class ORM_O01_ORDER_DETAILMap : HL7V26LayoutMap<ORM_O01_ORDER_DETAIL> { public ORM_O01_ORDER_DETAILMap() { Option(x => OrderDetail, 0, x => x.Required = true); Segment(x => x.NTE, 1); Segment(x => x.CTD, 2); Segment(x => x.DG1, 3); Layout(x => x.Observation, 4); } }
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...
public class ORDER_DETAILMap : HL7V26SegmentOptionMap<ORDER_DETAIL> { public ORM_O01_ORDER_DETAILMap() { Segment(x => x.OBR); Segment(x => x.RQD); Segment(x => x.RQ1); Segment(x => x.RXO); Segment(x => x.ODS); Segment(x => x.ODT); } }
from machete.
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.
public interface OrderDetailOption {
Segment<OBR> OBR;
Segment<RQD> RQD;
Then in the map
Option(x => x.OrderDetail, 0, x => x.IsRequired());
Then you could select using detail.Select(x => x.OrderDetail, x => x.OBR)
and if it was present, it would continue, otherwise, HasValue would be false
.
from machete.
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.
Option(x => x.First, x =>
{
x.Segment<OBR>();
x.Segment<RQD>();
});
from machete.
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 =>
{
x.Segment();
x.Segment();
},
0,
x.IsRequired());
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
Is<TSegment> : need to be able to determine which of the segments (i.e. OBR, RQD, RQ1, RXO, ODS, ODT) was returned, ex: .Is<OBR>()
To<TSegment> : need to be able to cast to one of the segments in order to operate on them, ex: .To<OBR>. If this fails it would return an Empty<TSegment>
Perhaps would need to modify Translates as well to be able to get at conditional segments.
from machete.
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
from machete.
HL7 layouts cannot work without this functionality.
from machete.
Related Issues (20)
- X12 - incorrect mapping HOT 13
- Add Apache 2.0 license on source code HOT 1
- Documentation and Project Page Update HOT 3
- Cannot stream parse through multiple layouts in the same transaction in X12 HOT 1
- Map condition doesn't work when SegmentList is followed by Segment of same entity type HOT 1
- Create a way to initialize entities through Translate API
- X12 Select applicative throwing NullReferenceException when segment missing HOT 2
- Accessing missing Layout through indexer off of Select applicative throwing ValueMissingException HOT 4
- Fix issues with HL7 2.6 schema HOT 1
- Create way to override entity registration
- DateTimePeriod in X12 Schema not implemented HOT 3
- Layout parser failing to parse X12 loop HOT 1
- Layout parser failing to parse loop 2300 when PAT segment missing
- Not able to add user-defined layouts when registering the schema
- Add ability to return all registered layouts and entities
- Need ability to format a Layout
- Really poor performance with streaming parser HOT 4
- Update 5010 AAA segment HOT 2
- 5010 CTT Segment - Description should be string HOT 2
- Support H3 Segment for 5010 spec HOT 1
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 machete.