Hi Dan,
I write a lot of code that deals with many varieties of HL7 and
especially with invalid HL7. I ended up creating a library that just
doesn't care what's in the HL7 message as long as it respects the
delimiters specified in the MSH seg. If it'll help you there's
information about it here: http://nule.org/wp/?page_id=75 including
javadoc and samples. The license is LGPL and it doesn't require any
databases to build. In your case you could just do a
hl7.get("SEG").field(fieldNumber).getRepCount()
and .getRep(repNumber). I need to update the javadoc on the site, but
it's not that out of date for that kind of stuff.
Hope that helps,
Mike
On Jul 23, 2009, at 2:36 PM, Kamp, Daniel (GE Healthcare) wrote:
Good afternoon,
I am trying to write a transformer which converts an HL7 message to
a local object graph. In doing so, I need to account for repeating
fields.
For example, PID-5 can have multiple names and we need to parse it
out into a List of PatientName objects (each PatientName object
contains family name, given name, and name type code).
Since we need to support many versions of HL7 we can not use a
specific v 2.x model data types. Instead we are relying on the
generic:
ca.uhn.hl7v2.model.Message
ca.uhn.hl7v2.util.Terser
to parse the message.
I have had a difficult time finding simple examples of parsing
repeating fields using these generic classes.
I realize if we used
ca.uhn.hl7v2.model.v25.message
it would be easier to do this, but we need to remain version agnostic.
Can anyone assist me in a simple way to extract a repeating field as
mentioned above?
Thank you in advance,
Dan
Dan Kamp
GE Healthcare
Information Technologies - Global Engineering
Shared Asset Solutions
T (847) 277- 4327
D *567-4327
E [email protected]
www.gehealthcare.com
------------------------------------------------------------------------------
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel
------------------------------------------------------------------------------
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel