As I mentioned - I have very little experience with this format, so this
may be another dumb question, but curious why the API couldn't be object
oriented and get this for free?
On Thu, Jan 10, 2013 at 12:26 PM, James Agnew <ja...@jamesagnew.ca> wrote:
> For what it's worth, I'll mention how University Health Network deals with
> this.
>
> We do a whole lot of ADT interfacing with one specific system, so we
> created an XML conformance profile using Message Workbench that contains
> all of the needed segments. In other words, we started with an ADT_A01
> structure, then added all of the missing segments in order to process all
> messages we need to process (MRG, the second PID in an A17, etc.). This
> gave us a kind of "super structure" that could be used to access any ADT
> message.
>
> We then use a maven plugin to translate that conformance profile into HAPI
> structure classes as described
> here<http://hl7api.sourceforge.net/conformance.html>
> .
>
> This way of doing things is definitely by far the most work to get set up,
> but once you have it set up you certainly have nice clean readable code,
> since you don't need parser tricks or whatever else.
>
> I should really document this whole process start to finish at some point.
> Maybe it would make sense to include an ADT "super structure" in the base
> HAPI release for just this purpose..
>
> James
>
>
>
>
> On Thu, Jan 10, 2013 at 9:48 AM, Carlos Oliva <carl...@pbsinet.com> wrote:
>
>> How would you examine repetitive segments with the Preparser? To carry
>> out a completely generic parsing, one could retrieve data with the
>> preparser like Christian mentioned.****
>>
>> ** **
>>
>> One problem might be with several instances of the same segment in one
>> message. How would you retrieve the fields from all these segments?****
>>
>> ** **
>>
>> *From:* steven touw [mailto:tou...@gmail.com]
>> *Sent:* Thursday, January 10, 2013 8:20 AM
>> *To:* Laurent Hasson
>>
>> *Cc:* hl7api-devel@lists.sourceforge.net
>> *Subject:* Re: [HAPI-devel] reading HL7 generically****
>>
>> ** **
>>
>> Thank you all, very helpful.****
>>
>> On Thu, Jan 10, 2013 at 7:55 AM, Laurent Hasson <l...@360fresh.com> wrote:
>> ****
>>
>> This is the kind of code we have been using for that purpose:****
>>
>> ****
>>
>> try****
>>
>> {****
>>
>> _PID = new HL7PID((PID)Msg.get("PID"));****
>>
>> }****
>>
>> catch (HL7Exception E) { }****
>>
>> ****
>>
>> try****
>>
>> {****
>>
>> Segment segment = (Segment)Msg.get("PV1");****
>>
>> if (segment != null)****
>>
>> _PV = new HL7PV((PV1)segment,
>> (PV2)Msg.get("PV2"));****
>>
>> }****
>>
>> catch (HL7Exception E) { }****
>>
>> ****
>>
>> try****
>>
>> {****
>>
>> Structure[] Structs = Msg.getAll("DG1");****
>>
>> if (Structs != null && Structs.length > 0)****
>>
>> {****
>>
>> _DG1 = new HL7DG1[Structs.length];****
>>
>> for (int i = 0; i < Structs.length; ++i)****
>>
>> _DG1[i] = new HL7DG1((DG1)Structs[i]);****
>>
>> }****
>>
>> }****
>>
>> catch (HL7Exception E) { }****
>>
>> ****
>>
>> We do a few things:****
>>
>> - We have our own structures to capture the elements of a
>> particular message we care about (here, HL7PID, HL7DG1 etc…)****
>>
>> - We have try-catch blocks because HAPI can throw an exception
>> if the segment doesn’t exist.****
>>
>> ****
>>
>> This has been working ok for us. ****
>>
>> ****
>>
>> ___________________________________________________________****
>>
>> Laurent Hasson****
>>
>> Co-Founder and CTO****
>>
>> 360Fresh Inc.****
>>
>> cell: 646.283.2186****
>>
>> ****
>>
>> "Strange women lyin' in ponds distributin' swords is no basis for a
>> system of government" - Dennis****
>>
>> ****
>>
>> This e-mail may contain confidential and/or privileged information. This
>> information is intended only for the use of the individual(s) and
>> entity(ies) to whom it is addressed. If you are the intended recipient,
>> further disclosures are prohibited without proper authorization. If you are
>> not the intended recipient (or have received this e-mail in error) please
>> notify the sender immediately and destroy this e-mail. Any unauthorized
>> copying, disclosure or distribution of the material in this e-mail is
>> strictly forbidden and possibly a violation of federal or state law and
>> regulations.****
>>
>> ****
>>
>> -----Original Message-----
>> From: Christian Ohr [mailto:christian....@gmail.com]
>> Sent: Thursday, January 10, 2013 2:58 AM
>> To: steven touw
>> Cc: hl7api-devel@lists.sourceforge.net
>> Subject: Re: [HAPI-devel] reading HL7 generically****
>>
>> ****
>>
>> Forgot to mention that you currently still need to include the
>> hapi-structure jar(s) in your classpath, depending on the HL7****
>>
>> version(s) you expect. You can also use the CanonicalModelClassFactory
>> with your parser, then you only need the latest structure jar.****
>>
>> In HAPI 2.1 (not released yet), you will be able to omit the structure
>> jars completely.****
>>
>> ****
>>
>> Christian****
>>
>> ****
>>
>> 2013/1/10 Christian Ohr <christian....@gmail.com>:****
>>
>> > In general, you don't have to cast to a specific message structure****
>>
>> > class: the parser returns a Message object, and you can obtain ****
>>
>> > segments using message.get("segment-name") , and from a Segment you ***
>> *
>>
>> > can obtain a field using segment.getField(field-number). If that's not
>> ****
>>
>> > generic enough, take a look at ca.uhn.hl7v2.preparser.PreParser.****
>>
>> > ****
>>
>> > cheers****
>>
>> > Christian****
>>
>> > ****
>>
>> > 2013/1/9 steven touw <tou...@gmail.com>:****
>>
>> >> Hello,****
>>
>> >> I am new to HL7 as well as it's contents. I hope this question isn't
>> ****
>>
>> >> too stupid.****
>>
>> >> I'm trying to read from messages generically - is there any way to ***
>> *
>>
>> >> grab particular segments without having to cast the Message object ***
>> *
>>
>> >> into ADT_A05 for example? I could have various ADT_* and trying to **
>> **
>>
>> >> find the best way to do this...****
>>
>> >> ****
>>
>> >> Thanks,****
>>
>> >> Steve****
>>
>> >> ****
>>
>> >> ---------------------------------------------------------------------*
>> ***
>>
>> >> --------- Master Java SE, Java EE, Eclipse, Spring, Hibernate, ****
>>
>> >> JavaScript, jQuery and much more. Keep your Java skills current with *
>> ***
>>
>> >> LearnJavaNow -****
>>
>> >> 200+ hours of step-by-step video tutorials by Java experts.****
>>
>> >> SALE $49.99 this month only -- learn more at:****
>>
>> >> http://p.sf.net/sfu/learnmore_122612****
>>
>> >> _______________________________________________****
>>
>> >> Hl7api-devel mailing list****
>>
>> >> Hl7api-devel@lists.sourceforge.net****
>>
>> >> https://lists.sourceforge.net/lists/listinfo/hl7api-devel****
>>
>> >> ****
>>
>> ****
>>
>>
>> ------------------------------------------------------------------------------
>> ****
>>
>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and
>> experts. ON SALE this month only -- learn more at:****
>>
>> http://p.sf.net/sfu/learnmore_122712****
>>
>> _______________________________________________****
>>
>> Hl7api-devel mailing list****
>>
>> Hl7api-devel@lists.sourceforge.net****
>>
>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel****
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>> MVPs and experts. ON SALE this month only -- learn more at:
>> http://p.sf.net/sfu/learnmore_122712
>> _______________________________________________
>> Hl7api-devel mailing list
>> Hl7api-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel****
>>
>> ** **
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>> MVPs and experts. ON SALE this month only -- learn more at:
>> http://p.sf.net/sfu/learnmore_122712
>> _______________________________________________
>> Hl7api-devel mailing list
>> Hl7api-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>>
>>
>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel