Hi Tony, Ah ok, I see what you mean. HAPI's PipeParser will happily parse messages with unexpected or custom segments and you will end up with a fully populated message, including the unexpected segments.
The major caveat is that the bahaviour can be a bit unexpected in that case. When PipeParser encounters a segment that isn't "supposed" to be there, it will recurse as deep as it can into the next segment group it encounters, and then start placing the segments there. I have found that depending on the structure of the message you are trying to parse and the location of the unexpected segment within the message, sometimes every segment after the unexpected one ends up attached to the wrong structure in the message. Oddly enough, this is behaviour that is fixed in the CVS version of PipeParser, and will be released with the next version. If the custom segments you want to parse are at or near the end of the message, you shouldn't have any trouble. If they are closer to the front (and you don't want to upgrade) it's going to be possible, but a bit more work to find the data you are looking for. Cheers, James On Wed, Oct 21, 2009 at 4:02 PM, Tony Kennedy <[email protected]> wrote: > James, > > > I started to take a look at this and I think I wasn’t clear. I need to > parse messages with the non-standard segments, not create them. Can I just > use the Terser() functions to grab data? Will those non-standard segments > be parsed? Or will I need to add some parsing code somewhere? > > > > Thanks again for the help, > > Tony > > > > *From:* [email protected] [mailto:[email protected]] *On Behalf Of > *James > Agnew > *Sent:* Tuesday, October 20, 2009 9:29 PM > *To:* Tony Kennedy > *Cc:* [email protected] > *Subject:* Re: [HAPI-devel] custom segments > > > > Hi Tony, > > You can actually add a custom segment to messages at runtime fairly easily, > there is a method called "addCustomSegment(String name)" on the Group class, > which is the superclass of Message. Using that, you could add a custom > segment fairly easily, and I'm fairly sure (though not positive) that this > method existed in the 0.4 release. > > The one caviat is that this method adds the segment to the end of the group > or message, so you don't have much control over where the segment ends up. > The upcoming 1.0 release actually improves this functionality quite a bit, > allowing you to choose where in the message a custom segment added at > runtime ends up. In addition, very shortly it will be possible to generate > custom message structures or segments using the Message Workbench Tool and > have HAPI generate custom message classes (this is in CVS already, but > documentation isn't yet written. If anyone wants to know more, I'm happy to > explain further). > > If I may ask, why is upgrading the library a lot of coding? Definitely one > of our design goals is that new versions should be backwards compatible, so > I'm wondering if there's something that needs fixing. The one thing that I > can think of that broks backwards compatibiity between 0.4 and 0.5 was that > 0.4 had incorrect segment group names for HL7 2.4 and 2.5 message types. Is > that the source of your issue? I'm thinking it might be possible to produce > structures jars for the newest version of HAPI that used the old structures > names if that was it.. > > Cheers, > James > > On Tue, Oct 20, 2009 at 5:01 PM, Tony Kennedy <[email protected]> wrote: > > I’d prefer not to have to modify any source. I’d like to be able to add a > custom segment just like you can add a custom message package. But, I’m not > quite sure how to go about that. Any examples? I’m using the 0.42 build > (no, I don’t want to update, it’s a LOT of re-coding.) If I need to modify > source, I can, but as a last resort. > > > > Thanks, > > Tony > > > > > > *From:* Charles D. Fisher [mailto:[email protected]] > *Sent:* Tuesday, October 20, 2009 4:30 PM > *To:* Tony Kennedy > *Cc:* [email protected] > *Subject:* Re: [HAPI-devel] custom segments > > > > When you modify source, you don't necessarily have to recompile the whole > thing. You just have to recompile the ones you changed, and then contrive to > have them in the classpath ahead of the standard jar files, so your modified > ones get picked up first. This works for us. > > Charles Fisher > Division of Epidemiology > New York State Dept. of Health > 518-474-2735 > > [image: Inactive hide details for "Tony Kennedy" <[email protected]>]"Tony > Kennedy" <[email protected]> > > *"Tony Kennedy" <[email protected]>* > > 2009_10_20 01:55 PM > > To > > > <[email protected]> > > cc > > Subject > > > [HAPI-devel] custom segments > > > > > Hi all, > > Is there a way to add custom segment parsing without having to add code to > HAPI and recompile the whole thing? > > Thanks > Tony > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Hl7api-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > IMPORTANT NOTICE: This e-mail and any attachments may contain confidential > or sensitive information which is, or may be, legally privileged or > otherwise protected by law from further disclosure. It is intended only for > the addressee. If you received this in error or from someone who was not > authorized to send it to you, please do not distribute, copy or use it or > any attachments. Please notify the sender immediately by reply e-mail and > delete this from your system. Thank you for your cooperation. > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Hl7api-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Hl7api-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > >
<<image002.png>>
<<image001.gif>>
<<image003.png>>
------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference
_______________________________________________ Hl7api-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/hl7api-devel

