Thanks Rahul.
I will certainly would like to experiment with ModelClassFactory idea as it seems less computing to get on Highest Version Message. Will keep the you posted. Thanks. Regards -Niranjan. From: rahul somasunderam [mailto:[email protected]] Sent: Thursday, July 23, 2009 4:45 PM To: [email protected] Subject: Re: [HAPI-devel] How to access repeating fields usingthegeneric Message type Hi Niranjan, public Message convert(Message message, String version) throws EncodingNotSupportedException, HL7Exception { String inVersion = message.getVersion(); Terser terser = new Terser(message); if (!terser.get("/MSH-12").equals(version)) { terser.set("/MSH-12", version); PipeParser pp = new PipeParser(); message = pp.parse(pp.encode(message)); return message; } else { return message; } } Hope that helps. And given that HAPI 0.6 is out, it is a good idea to convert all messages to 2.6 [instead of 2.5 as I am doing], and then process them. I haven't tried the ModelClassFactory, but if that does the job in pretty much the same way, please compare the performance of both solutions. I parse the message twice and encode it once, making it slower. If you want to use the Idea James first mentioned, i.e. using XPath like expressions, I would side with Michael's idea of using LightHl7Lib. I use LightHl7Lib for preprocessing messages before parsing them with HAPI. LightHl7Lib appears to be faster to me. I haven't run any metrics though. Regards, rahul From: Sharma, Niranjan K (GE Healthcare) [mailto:[email protected]] Sent: Thursday, July 23, 2009 3:26 PM To: rahul somasunderam; [email protected] Subject: RE: [HAPI-devel] How to access repeating fields using thegeneric Message type Rahul, How do you use Terser to convert to V2.5? I think James idea of having a extended ModelClassFactory for V2.6 can serve the purpose? Thoughts? Thanks. Regards -Niranjan. From: rahul somasunderam [mailto:[email protected]] Sent: Thursday, July 23, 2009 12:51 PM To: [email protected] Subject: Re: [HAPI-devel] How to access repeating fields using thegeneric Message type Most of the times you're fine converting a message to the highest supported version. We use the terser and convert any message to a 2.5 message. Then we apply the logic that would apply for a 2.5 message. I understand there are some message types, some data types, and some segments which get dropped as you progress across versions, but we haven't lost much data because of that. Regards, rahul From: Kamp, Daniel (GE Healthcare) [mailto:[email protected]] Sent: Thursday, July 23, 2009 11:36 AM To: [email protected] Subject: [HAPI-devel] How to access repeating fields using the generic Message type 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] <blocked::mailto:[email protected]> www.gehealthcare.com <blocked::http://www.gehealthcare.com/> Checked by AVG - www.avg.com Version: 8.5.387 / Virus Database: 270.13.20/2250 - Release Date: 07/23/09 06:02:00 Checked by AVG - www.avg.com Version: 8.5.387 / Virus Database: 270.13.20/2250 - Release Date: 07/23/09 06:02:00
------------------------------------------------------------------------------
_______________________________________________ Hl7api-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/hl7api-devel

