Segment group support in Light HL7 Library

I’m well into the segment group support for LHL and you can try it out yourself now by building the latest SVN (revision 34). Basically what this does is let you take a message like the following:


Which is obviously invalid, but contains some common characteristics of more complex HL7 messages. With it, you can now say give me OBR group 2, OBX group 2, NTE 1 instead of saying give me the fifth NTE. In other words, you can address segments within their message context.

In code, previously you would have addressed that fifth NTE with a simple:

Hl7Segment seg = hl7.get("NTE", 5);

And that would have given you the segment but without any context for the hierarchy of the message. Now you have the option to say

Hl7Segment seg = hl7.getGroup("OBR", 2).getGroup("OBX", 2").get("NTE", 1);

Now that may look like more upfront work, but you no longer have to do any accounting yourself of which OBX an NTE may belong to. Additionally, I’m working on the support to add in new segments relative to the structure of the message where they now reside. So you could add a second NTE to the second OBX of the second OBR without knowing its absolute position inside of the entire HL7 message.

Pretty cool stuff, I think. At least if you’re like me and think of HL7 as a hierarchical structure of data and less as a standard to which you must adhere. There are valid points to both sides of that distinction, but as an integrator, you have to deal with the data you’re dealt, and it’s counterproductive to fight your libraries when you know how you want to address your own data. That’s what I want LHL to be – a programmers interface to HL7.

Also, I got a few more donations to the pool. Up to $50 – $45 of which went to the 2008 bill and the rest I’ll save for 2009. Thanks much for those who gave, and I’ll start up a tally page of donations soon. If you want credit for your donation in the future, say so in the paypal notes, otherwise I’ll list it as anonymous on that page. Thanks again.