You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, I have a normal HL7 message that contains one MSH segment at the beginning. When I parse the message msg[:MSH] is an array of three items.
Is there a reason this array contains three instances of HL7::Message::Segment::MSH? Is this a bug or is there a reason for this? I haven't spent a lot of time reading the code so I may be missing something here.
The text was updated successfully, but these errors were encountered:
@Stratus3D A message is a collection of segments. In this case, that's msg. When you access msg[:MSH] you're selecting just one particular segment. So, when you calculate the length of just that one segment, you're getting a count of how many fields there are in the MSH segment.
For example, I'm looking at a result message from an immunization registry. So, it's a large message with 113 segments in it:
MSH|^~\&|CIR HL7 Web Service 2.01|NYC DOHMH|CAREDOX|0004Q10|20140529223528-0400||RSP^K11^RSP_K11|20140529223528-0400CIR-WS|T|2.5.1|||NE|NE|||||Z32^CDCPHINVS|
MSA|AA|hxe0P6tTzGBCqlIaWAcUBA|
QAK|QThxe0P6tTzGBCqlIaWAcUBA|OK|
QPD|Z34^Request ImmunizationHistory^HL70471|QThxe0P6tTzGBCqlIaWAcUBA||Mason^Matthew^Thomas^^^^L|Walters^Rebecca^^^^^M|20081025|M|305 BigApple Blvd&Big Apply Blvd&305^7C^NewYork^NY^12345-1234^^P|PRN^212^5551
PID|||777815087^^^^LR||MASON^MATTHEW^THOMAS^^^^L||20081015|M|
...
To count the segments, I apply the length method on the whole message:
[56] pry(main)> res.length
=> 113
And I get the expected 113 segments/lines. But if I select just the header segment, length() will count the number of vertical bar separated fields in :MSH:
For example, I have a normal HL7 message that contains one MSH segment at the beginning. When I parse the message
msg[:MSH]
is an array of three items.Is there a reason this array contains three instances of HL7::Message::Segment::MSH? Is this a bug or is there a reason for this? I haven't spent a lot of time reading the code so I may be missing something here.
The text was updated successfully, but these errors were encountered: