Re: [HAPI-devel] Generic class for ADT message

2013-06-19 Thread sagarshah1983

Thanks Christian for sharing this link.
I was trying to use ADT_AXX structure only, but found few issues with
generating HL7 message with ADT_AXX and did not find a way to solve that
out. So thought of checking for any other generic structure for ADT
messages.
Anyways, here's the issue I am facing.
Code Snippet.

ADT_AXX adt = new ADT_AXX();
MSH msh = adt.getMSH();

msh.getMsh9_MessageType().getMsg1_MessageCode().setValue("ADT");
msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A28");
msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A28");

Above works perfectly fine, but the moment I change last two lines to
reflect A01, it fails.

msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A01");
msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A01");

Error details:
Caused by: ca.uhn.hl7v2.validation.ValidationException: Message
(superstructure ADT_AXX) of type ADT_A01 must not have content in MSH

Any advice is appreciated.

Regards,
Sagar Shah



Christian Ohr-2 wrote:
> 
> If you are using HAPI 2.1, you should have a look at this:
> http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/ExampleSuperStructures.html
> .
> 
> cheers
> Christian
> 
> 
> 2013/6/18 sagarshah1983 
> 
>>
>> That would be really great for me.
>> Appreciate your reply and time for the same.
>>
>> Regards,
>> Sagar Shah
>>
>> LDH-2 wrote:
>> >
>> > I am not aware of one in 1.x... I don't know 2.x well enough yet. I am
>> on
>> > the road, but I can send out later the type of code I have used to be
>> adt
>> > generic.
>> >
>> >
>> >
>> > ___
>> > Laurent Hasson (via my BlackBerry)
>> > email: l...@360fresh.com
>> > cell: 646-283-2186
>> > twitter: @ldhasson
>> >
>> > -Original Message-
>> > From: sagarshah1983 
>> > Date: Tue, 18 Jun 2013 08:53:15
>> > To: 
>> > Subject: [HAPI-devel]  Generic class for ADT message
>> >
>> >
>> --
>> > This SF.net email is sponsored by Windows:
>> >
>> > Build for Windows Store.
>> >
>> > http://p.sf.net/sfu/windows-dev2dev
>> >
>> >
>> --
>> > This SF.net email is sponsored by Windows:
>> >
>> > Build for Windows Store.
>> >
>> > http://p.sf.net/sfu/windows-dev2dev
>> > ___
>> > Hl7api-devel mailing list
>> > Hl7api-devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Generic-class-for-ADT-message-tp35639316p35639472.html
>> Sent from the hl7api-devel mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> ___
>> Hl7api-devel mailing list
>> Hl7api-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>>
> 
> --
> This SF.net email is sponsored by Windows:
> 
> Build for Windows Store.
> 
> http://p.sf.net/sfu/windows-dev2dev
> ___
> Hl7api-devel mailing list
> Hl7api-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
> 
> 
-- 
View this message in context: 
http://old.nabble.com/Generic-class-for-ADT-message-tp35639316p35642054.html
Sent from the hl7api-devel mailing list archive at Nabble.com.


--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel


Re: [HAPI-devel] Generic class for ADT message

2013-06-19 Thread Christian Ohr
Yes, I can reproduce this problem. It seems that the MSH segment is not
allowed e.g. for A01 message by the validator, which is obviously nonsense.
Maybe James can enlighten this a bit potentially there's a bug in the
generator.

After all, when creating messages I don't see a need to create
superstructure messages, as you know which message you create. You still
have the problem that there is no common super-class or interface to ADT
messages, but their are ways to circumvent this, e.g. using the Terser
class:

Message m = new ADT_A01();
m.initQuickstart("ADT", "A01", "P");
// everything below works on a generic level
Terser t = new Terser(m);
t.set("/MSH-9-2", "A04");
t.set("/PID-3-1", "myIdentifier");
...

hope this helps
Christian


2013/6/19 sagarshah1983 

>
> Thanks Christian for sharing this link.
> I was trying to use ADT_AXX structure only, but found few issues with
> generating HL7 message with ADT_AXX and did not find a way to solve that
> out. So thought of checking for any other generic structure for ADT
> messages.
> Anyways, here's the issue I am facing.
> Code Snippet.
>
> ADT_AXX adt = new ADT_AXX();
> MSH msh = adt.getMSH();
> 
> msh.getMsh9_MessageType().getMsg1_MessageCode().setValue("ADT");
> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A28");
> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A28");
>
> Above works perfectly fine, but the moment I change last two lines to
> reflect A01, it fails.
>
> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A01");
> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A01");
>
> Error details:
> Caused by: ca.uhn.hl7v2.validation.ValidationException: Message
> (superstructure ADT_AXX) of type ADT_A01 must not have content in MSH
>
> Any advice is appreciated.
>
> Regards,
> Sagar Shah
>
>
>
> Christian Ohr-2 wrote:
> >
> > If you are using HAPI 2.1, you should have a look at this:
> >
> http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/ExampleSuperStructures.html
> > .
> >
> > cheers
> > Christian
> >
> >
> > 2013/6/18 sagarshah1983 
> >
> >>
> >> That would be really great for me.
> >> Appreciate your reply and time for the same.
> >>
> >> Regards,
> >> Sagar Shah
> >>
> >> LDH-2 wrote:
> >> >
> >> > I am not aware of one in 1.x... I don't know 2.x well enough yet. I am
> >> on
> >> > the road, but I can send out later the type of code I have used to be
> >> adt
> >> > generic.
> >> >
> >> >
> >> >
> >> > ___
> >> > Laurent Hasson (via my BlackBerry)
> >> > email: l...@360fresh.com
> >> > cell: 646-283-2186
> >> > twitter: @ldhasson
> >> >
> >> > -Original Message-
> >> > From: sagarshah1983 
> >> > Date: Tue, 18 Jun 2013 08:53:15
> >> > To: 
> >> > Subject: [HAPI-devel]  Generic class for ADT message
> >> >
> >> >
> >>
> --
> >> > This SF.net email is sponsored by Windows:
> >> >
> >> > Build for Windows Store.
> >> >
> >> > http://p.sf.net/sfu/windows-dev2dev
> >> >
> >> >
> >>
> --
> >> > This SF.net email is sponsored by Windows:
> >> >
> >> > Build for Windows Store.
> >> >
> >> > http://p.sf.net/sfu/windows-dev2dev
> >> > ___
> >> > Hl7api-devel mailing list
> >> > Hl7api-devel@lists.sourceforge.net
> >> > https://lists.sourceforge.net/lists/listinfo/hl7api-devel
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Generic-class-for-ADT-message-tp35639316p35639472.html
> >> Sent from the hl7api-devel mailing list archive at Nabble.com.
> >>
> >>
> >>
> >>
> --
> >> This SF.net email is sponsored by Windows:
> >>
> >> Build for Windows Store.
> >>
> >> http://p.sf.net/sfu/windows-dev2dev
> >> ___
> >> Hl7api-devel mailing list
> >> Hl7api-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
> >>
> >
> >
> --
> > This SF.net email is sponsored by Windows:
> >
> > Build for Windows Store.
> >
> > http://p.sf.net/sfu/windows-dev2dev
> > ___
> > Hl7api-devel mailing list
> > Hl7api-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/hl7api-devel
> >
> >
> --
> View this message in context:
> http://old.nabble.com/Generic-class-for-ADT-message-tp35639316p35642054.html
> Sent from the hl7api-devel mailing list archive at Nabble.com.
>
>
>
> --
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> ___
> Hl7api-devel maili

Re: [HAPI-devel] Generic class for ADT message

2013-06-19 Thread sagarshah1983

Thanks a ton Christian for this.
I think I can make use of Terser to make it generic and use ADT_A01 as base
message, as there are some issues with ADT_AXX as reported in previous
message.



Christian Ohr-2 wrote:
> 
> Yes, I can reproduce this problem. It seems that the MSH segment is not
> allowed e.g. for A01 message by the validator, which is obviously
> nonsense.
> Maybe James can enlighten this a bit potentially there's a bug in the
> generator.
> 
> After all, when creating messages I don't see a need to create
> superstructure messages, as you know which message you create. You still
> have the problem that there is no common super-class or interface to ADT
> messages, but their are ways to circumvent this, e.g. using the Terser
> class:
> 
> Message m = new ADT_A01();
> m.initQuickstart("ADT", "A01", "P");
> // everything below works on a generic level
> Terser t = new Terser(m);
> t.set("/MSH-9-2", "A04");
> t.set("/PID-3-1", "myIdentifier");
> ...
> 
> hope this helps
> Christian
> 
> 
> 2013/6/19 sagarshah1983 
> 
>>
>> Thanks Christian for sharing this link.
>> I was trying to use ADT_AXX structure only, but found few issues with
>> generating HL7 message with ADT_AXX and did not find a way to solve that
>> out. So thought of checking for any other generic structure for ADT
>> messages.
>> Anyways, here's the issue I am facing.
>> Code Snippet.
>>
>> ADT_AXX adt = new ADT_AXX();
>> MSH msh = adt.getMSH();
>> 
>> msh.getMsh9_MessageType().getMsg1_MessageCode().setValue("ADT");
>> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A28");
>> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A28");
>>
>> Above works perfectly fine, but the moment I change last two lines to
>> reflect A01, it fails.
>>
>> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A01");
>> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A01");
>>
>> Error details:
>> Caused by: ca.uhn.hl7v2.validation.ValidationException: Message
>> (superstructure ADT_AXX) of type ADT_A01 must not have content in MSH
>>
>> Any advice is appreciated.
>>
>> Regards,
>> Sagar Shah
>>
>>
>>
>> Christian Ohr-2 wrote:
>> >
>> > If you are using HAPI 2.1, you should have a look at this:
>> >
>> http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/ExampleSuperStructures.html
>> > .
>> >
>> > cheers
>> > Christian
>> >
>> >
>> > 2013/6/18 sagarshah1983 
>> >
>> >>
>> >> That would be really great for me.
>> >> Appreciate your reply and time for the same.
>> >>
>> >> Regards,
>> >> Sagar Shah
>> >>
>> >> LDH-2 wrote:
>> >> >
>> >> > I am not aware of one in 1.x... I don't know 2.x well enough yet. I
>> am
>> >> on
>> >> > the road, but I can send out later the type of code I have used to
>> be
>> >> adt
>> >> > generic.
>> >> >
>> >> >
>> >> >
>> >> > ___
>> >> > Laurent Hasson (via my BlackBerry)
>> >> > email: l...@360fresh.com
>> >> > cell: 646-283-2186
>> >> > twitter: @ldhasson
>> >> >
>> >> > -Original Message-
>> >> > From: sagarshah1983 
>> >> > Date: Tue, 18 Jun 2013 08:53:15
>> >> > To: 
>> >> > Subject: [HAPI-devel]  Generic class for ADT message
>> >> >
>> >> >
>> >>
>> --
>> >> > This SF.net email is sponsored by Windows:
>> >> >
>> >> > Build for Windows Store.
>> >> >
>> >> > http://p.sf.net/sfu/windows-dev2dev
>> >> >
>> >> >
>> >>
>> --
>> >> > This SF.net email is sponsored by Windows:
>> >> >
>> >> > Build for Windows Store.
>> >> >
>> >> > http://p.sf.net/sfu/windows-dev2dev
>> >> > ___
>> >> > Hl7api-devel mailing list
>> >> > Hl7api-devel@lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/Generic-class-for-ADT-message-tp35639316p35639472.html
>> >> Sent from the hl7api-devel mailing list archive at Nabble.com.
>> >>
>> >>
>> >>
>> >>
>> --
>> >> This SF.net email is sponsored by Windows:
>> >>
>> >> Build for Windows Store.
>> >>
>> >> http://p.sf.net/sfu/windows-dev2dev
>> >> ___
>> >> Hl7api-devel mailing list
>> >> Hl7api-devel@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>> >>
>> >
>> >
>> --
>> > This SF.net email is sponsored by Windows:
>> >
>> > Build for Windows Store.
>> >
>> > http://p.sf.net/sfu/windows-dev2dev
>> > ___
>> > Hl7api-devel mailing list
>> > Hl7api-devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>> >
>> >
>> --
>> View this message in context:
>> 

Re: [HAPI-devel] Generic class for ADT message

2013-06-19 Thread James Agnew
Hi All,

This does indeed appear to be a bug in the generator for the
superstructures unfortunately. Sagar, the good news is that your code
*should* work, you're doing the right thing. But the bad news is that it
isn't working obviously. :)

Superstructures are a brand new feature, and they haven't yet been heavily
used. I've got a fix for this issue locally, but it isn't yet released.

One workaround you could easily implement would be to create your own local
replacement class for ADT_AXX by copying the source to that class somewhere
else and fixing the issue. The source for this class is here (NB this is
the HL7 v2.4 version):
http://grepcode.com/file_/repo1.maven.org/maven2/ca.uhn.hapi/hapi-structures-v24/2.1-beta1/ca/uhn/hl7v2/model/v24/message/ADT_AXX.java/?v=source

If you look at the "init" method, you see a long string of method calls
like this:

this.addSuperstructureApplication("MSH", "ADT_A04");

These are the calls which advise HAPI that MSH may be used for an ADT_A04
message, but the bug is that there isn't a corresponding line for ADT_A01.
If you add that, you'll be allowed to add an MSH segment to an A01 message.
You'll need to do this for every segment and message type combination
though, which I realise will be annoying.

I'm going to try and get a fix at least checked in within the next week or
two...

Cheers,
James


On Wed, Jun 19, 2013 at 5:35 AM, sagarshah1983 wrote:

>
> Thanks a ton Christian for this.
> I think I can make use of Terser to make it generic and use ADT_A01 as base
> message, as there are some issues with ADT_AXX as reported in previous
> message.
>
>
>
> Christian Ohr-2 wrote:
> >
> > Yes, I can reproduce this problem. It seems that the MSH segment is not
> > allowed e.g. for A01 message by the validator, which is obviously
> > nonsense.
> > Maybe James can enlighten this a bit potentially there's a bug in the
> > generator.
> >
> > After all, when creating messages I don't see a need to create
> > superstructure messages, as you know which message you create. You still
> > have the problem that there is no common super-class or interface to ADT
> > messages, but their are ways to circumvent this, e.g. using the Terser
> > class:
> >
> > Message m = new ADT_A01();
> > m.initQuickstart("ADT", "A01", "P");
> > // everything below works on a generic level
> > Terser t = new Terser(m);
> > t.set("/MSH-9-2", "A04");
> > t.set("/PID-3-1", "myIdentifier");
> > ...
> >
> > hope this helps
> > Christian
> >
> >
> > 2013/6/19 sagarshah1983 
> >
> >>
> >> Thanks Christian for sharing this link.
> >> I was trying to use ADT_AXX structure only, but found few issues with
> >> generating HL7 message with ADT_AXX and did not find a way to solve that
> >> out. So thought of checking for any other generic structure for ADT
> >> messages.
> >> Anyways, here's the issue I am facing.
> >> Code Snippet.
> >>
> >> ADT_AXX adt = new ADT_AXX();
> >> MSH msh = adt.getMSH();
> >> 
> >> msh.getMsh9_MessageType().getMsg1_MessageCode().setValue("ADT");
> >> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A28");
> >>
> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A28");
> >>
> >> Above works perfectly fine, but the moment I change last two lines to
> >> reflect A01, it fails.
> >>
> >> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A01");
> >>
> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A01");
> >>
> >> Error details:
> >> Caused by: ca.uhn.hl7v2.validation.ValidationException: Message
> >> (superstructure ADT_AXX) of type ADT_A01 must not have content in MSH
> >>
> >> Any advice is appreciated.
> >>
> >> Regards,
> >> Sagar Shah
> >>
> >>
> >>
> >> Christian Ohr-2 wrote:
> >> >
> >> > If you are using HAPI 2.1, you should have a look at this:
> >> >
> >>
> http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/ExampleSuperStructures.html
> >> > .
> >> >
> >> > cheers
> >> > Christian
> >> >
> >> >
> >> > 2013/6/18 sagarshah1983 
> >> >
> >> >>
> >> >> That would be really great for me.
> >> >> Appreciate your reply and time for the same.
> >> >>
> >> >> Regards,
> >> >> Sagar Shah
> >> >>
> >> >> LDH-2 wrote:
> >> >> >
> >> >> > I am not aware of one in 1.x... I don't know 2.x well enough yet. I
> >> am
> >> >> on
> >> >> > the road, but I can send out later the type of code I have used to
> >> be
> >> >> adt
> >> >> > generic.
> >> >> >
> >> >> >
> >> >> >
> >> >> > ___
> >> >> > Laurent Hasson (via my BlackBerry)
> >> >> > email: l...@360fresh.com
> >> >> > cell: 646-283-2186
> >> >> > twitter: @ldhasson
> >> >> >
> >> >> > -Original Message-
> >> >> > From: sagarshah1983 
> >> >> > Date: Tue, 18 Jun 2013 08:53:15
> >> >> > To: 
> >> >> > Subject: [HAPI-devel]  Generic class for ADT message
> >> >> >
> >> >> >
> >> >>
> >>
> --
> >> >> > This SF.net email is sponsored by Windows:
> >> >> >

Re: [HAPI-devel] Generic class for ADT message

2013-06-19 Thread sagarshah1983

Thanks a ton James for clarifications. I will look at ADT_AXX and create
another structure out of the same at my end and follow your instructions as
a work around.
Appreciate your suggestions.

Regards,
Sagar Shah

James Agnew wrote:
> 
> Hi All,
> 
> This does indeed appear to be a bug in the generator for the
> superstructures unfortunately. Sagar, the good news is that your code
> *should* work, you're doing the right thing. But the bad news is that it
> isn't working obviously. :)
> 
> Superstructures are a brand new feature, and they haven't yet been heavily
> used. I've got a fix for this issue locally, but it isn't yet released.
> 
> One workaround you could easily implement would be to create your own
> local
> replacement class for ADT_AXX by copying the source to that class
> somewhere
> else and fixing the issue. The source for this class is here (NB this is
> the HL7 v2.4 version):
> http://grepcode.com/file_/repo1.maven.org/maven2/ca.uhn.hapi/hapi-structures-v24/2.1-beta1/ca/uhn/hl7v2/model/v24/message/ADT_AXX.java/?v=source
> 
> If you look at the "init" method, you see a long string of method calls
> like this:
> 
> this.addSuperstructureApplication("MSH", "ADT_A04");
> 
> These are the calls which advise HAPI that MSH may be used for an ADT_A04
> message, but the bug is that there isn't a corresponding line for ADT_A01.
> If you add that, you'll be allowed to add an MSH segment to an A01
> message.
> You'll need to do this for every segment and message type combination
> though, which I realise will be annoying.
> 
> I'm going to try and get a fix at least checked in within the next week or
> two...
> 
> Cheers,
> James
> 
> 
> On Wed, Jun 19, 2013 at 5:35 AM, sagarshah1983
> wrote:
> 
>>
>> Thanks a ton Christian for this.
>> I think I can make use of Terser to make it generic and use ADT_A01 as
>> base
>> message, as there are some issues with ADT_AXX as reported in previous
>> message.
>>
>>
>>
>> Christian Ohr-2 wrote:
>> >
>> > Yes, I can reproduce this problem. It seems that the MSH segment is not
>> > allowed e.g. for A01 message by the validator, which is obviously
>> > nonsense.
>> > Maybe James can enlighten this a bit potentially there's a bug in
>> the
>> > generator.
>> >
>> > After all, when creating messages I don't see a need to create
>> > superstructure messages, as you know which message you create. You
>> still
>> > have the problem that there is no common super-class or interface to
>> ADT
>> > messages, but their are ways to circumvent this, e.g. using the Terser
>> > class:
>> >
>> > Message m = new ADT_A01();
>> > m.initQuickstart("ADT", "A01", "P");
>> > // everything below works on a generic level
>> > Terser t = new Terser(m);
>> > t.set("/MSH-9-2", "A04");
>> > t.set("/PID-3-1", "myIdentifier");
>> > ...
>> >
>> > hope this helps
>> > Christian
>> >
>> >
>> > 2013/6/19 sagarshah1983 
>> >
>> >>
>> >> Thanks Christian for sharing this link.
>> >> I was trying to use ADT_AXX structure only, but found few issues with
>> >> generating HL7 message with ADT_AXX and did not find a way to solve
>> that
>> >> out. So thought of checking for any other generic structure for ADT
>> >> messages.
>> >> Anyways, here's the issue I am facing.
>> >> Code Snippet.
>> >>
>> >> ADT_AXX adt = new ADT_AXX();
>> >> MSH msh = adt.getMSH();
>> >> 
>> >> msh.getMsh9_MessageType().getMsg1_MessageCode().setValue("ADT");
>> >> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A28");
>> >>
>> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A28");
>> >>
>> >> Above works perfectly fine, but the moment I change last two lines to
>> >> reflect A01, it fails.
>> >>
>> >> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A01");
>> >>
>> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A01");
>> >>
>> >> Error details:
>> >> Caused by: ca.uhn.hl7v2.validation.ValidationException: Message
>> >> (superstructure ADT_AXX) of type ADT_A01 must not have content in MSH
>> >>
>> >> Any advice is appreciated.
>> >>
>> >> Regards,
>> >> Sagar Shah
>> >>
>> >>
>> >>
>> >> Christian Ohr-2 wrote:
>> >> >
>> >> > If you are using HAPI 2.1, you should have a look at this:
>> >> >
>> >>
>> http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/ExampleSuperStructures.html
>> >> > .
>> >> >
>> >> > cheers
>> >> > Christian
>> >> >
>> >> >
>> >> > 2013/6/18 sagarshah1983 
>> >> >
>> >> >>
>> >> >> That would be really great for me.
>> >> >> Appreciate your reply and time for the same.
>> >> >>
>> >> >> Regards,
>> >> >> Sagar Shah
>> >> >>
>> >> >> LDH-2 wrote:
>> >> >> >
>> >> >> > I am not aware of one in 1.x... I don't know 2.x well enough yet.
>> I
>> >> am
>> >> >> on
>> >> >> > the road, but I can send out later the type of code I have used
>> to
>> >> be
>> >> >> adt
>> >> >> > generic.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > ___
>> >> >> > Laurent Hasson (via my BlackBerry)
>> >> >> > email: l...@

Re: [HAPI-devel] Generic class for ADT message

2013-06-19 Thread sagarshah1983

Hi James, 
I also had one more question to understand difference between ADT_AXX and
ADT_A01.

The issues that I am getting is with ADT_AXX. So what if I have to replace
this with ADT_A01.
Can I used ADT_A01 class to generate ADT A04, A05, A08 and A28 messages as
well?
I tried generating just MSH and PID segment using ADT_A01 for above listed
different triggers and that atleast worked well.


Regards,
Sagar Shah

James Agnew wrote:
> 
> Hi All,
> 
> This does indeed appear to be a bug in the generator for the
> superstructures unfortunately. Sagar, the good news is that your code
> *should* work, you're doing the right thing. But the bad news is that it
> isn't working obviously. :)
> 
> Superstructures are a brand new feature, and they haven't yet been heavily
> used. I've got a fix for this issue locally, but it isn't yet released.
> 
> One workaround you could easily implement would be to create your own
> local
> replacement class for ADT_AXX by copying the source to that class
> somewhere
> else and fixing the issue. The source for this class is here (NB this is
> the HL7 v2.4 version):
> http://grepcode.com/file_/repo1.maven.org/maven2/ca.uhn.hapi/hapi-structures-v24/2.1-beta1/ca/uhn/hl7v2/model/v24/message/ADT_AXX.java/?v=source
> 
> If you look at the "init" method, you see a long string of method calls
> like this:
> 
> this.addSuperstructureApplication("MSH", "ADT_A04");
> 
> These are the calls which advise HAPI that MSH may be used for an ADT_A04
> message, but the bug is that there isn't a corresponding line for ADT_A01.
> If you add that, you'll be allowed to add an MSH segment to an A01
> message.
> You'll need to do this for every segment and message type combination
> though, which I realise will be annoying.
> 
> I'm going to try and get a fix at least checked in within the next week or
> two...
> 
> Cheers,
> James
> 
> 
> On Wed, Jun 19, 2013 at 5:35 AM, sagarshah1983
> wrote:
> 
>>
>> Thanks a ton Christian for this.
>> I think I can make use of Terser to make it generic and use ADT_A01 as
>> base
>> message, as there are some issues with ADT_AXX as reported in previous
>> message.
>>
>>
>>
>> Christian Ohr-2 wrote:
>> >
>> > Yes, I can reproduce this problem. It seems that the MSH segment is not
>> > allowed e.g. for A01 message by the validator, which is obviously
>> > nonsense.
>> > Maybe James can enlighten this a bit potentially there's a bug in
>> the
>> > generator.
>> >
>> > After all, when creating messages I don't see a need to create
>> > superstructure messages, as you know which message you create. You
>> still
>> > have the problem that there is no common super-class or interface to
>> ADT
>> > messages, but their are ways to circumvent this, e.g. using the Terser
>> > class:
>> >
>> > Message m = new ADT_A01();
>> > m.initQuickstart("ADT", "A01", "P");
>> > // everything below works on a generic level
>> > Terser t = new Terser(m);
>> > t.set("/MSH-9-2", "A04");
>> > t.set("/PID-3-1", "myIdentifier");
>> > ...
>> >
>> > hope this helps
>> > Christian
>> >
>> >
>> > 2013/6/19 sagarshah1983 
>> >
>> >>
>> >> Thanks Christian for sharing this link.
>> >> I was trying to use ADT_AXX structure only, but found few issues with
>> >> generating HL7 message with ADT_AXX and did not find a way to solve
>> that
>> >> out. So thought of checking for any other generic structure for ADT
>> >> messages.
>> >> Anyways, here's the issue I am facing.
>> >> Code Snippet.
>> >>
>> >> ADT_AXX adt = new ADT_AXX();
>> >> MSH msh = adt.getMSH();
>> >> 
>> >> msh.getMsh9_MessageType().getMsg1_MessageCode().setValue("ADT");
>> >> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A28");
>> >>
>> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A28");
>> >>
>> >> Above works perfectly fine, but the moment I change last two lines to
>> >> reflect A01, it fails.
>> >>
>> >> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A01");
>> >>
>> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A01");
>> >>
>> >> Error details:
>> >> Caused by: ca.uhn.hl7v2.validation.ValidationException: Message
>> >> (superstructure ADT_AXX) of type ADT_A01 must not have content in MSH
>> >>
>> >> Any advice is appreciated.
>> >>
>> >> Regards,
>> >> Sagar Shah
>> >>
>> >>
>> >>
>> >> Christian Ohr-2 wrote:
>> >> >
>> >> > If you are using HAPI 2.1, you should have a look at this:
>> >> >
>> >>
>> http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/ExampleSuperStructures.html
>> >> > .
>> >> >
>> >> > cheers
>> >> > Christian
>> >> >
>> >> >
>> >> > 2013/6/18 sagarshah1983 
>> >> >
>> >> >>
>> >> >> That would be really great for me.
>> >> >> Appreciate your reply and time for the same.
>> >> >>
>> >> >> Regards,
>> >> >> Sagar Shah
>> >> >>
>> >> >> LDH-2 wrote:
>> >> >> >
>> >> >> > I am not aware of one in 1.x... I don't know 2.x well enough yet.
>> I
>> >> am
>> >> >> on
>> >> >> > the road, but I can send out later the type of code I have used
>> 

Re: [HAPI-devel] Generic class for ADT message

2013-06-19 Thread James Agnew
Hi Sagar,

Yes, there is definitely nothing wrong with using ADT_A01 to generate other
types of messages.

The only challenge you may run into is that some ADT message types will
have structures that ADT_A01 doesn't have. For example, an ADT_A17 has a
second set of PID and PV1 segments, and these segments (which HAPI refers
to as PID2 and PV12) don't exist in the ADT_A01 structure. The workaround
there is to use the addNonStandardSegment method to add them as needed.
This is definitely fine, and is fairly common.

Cheers,
James


On Wed, Jun 19, 2013 at 9:59 AM, sagarshah1983 wrote:

>
> Hi James,
> I also had one more question to understand difference between ADT_AXX and
> ADT_A01.
>
> The issues that I am getting is with ADT_AXX. So what if I have to replace
> this with ADT_A01.
> Can I used ADT_A01 class to generate ADT A04, A05, A08 and A28 messages as
> well?
> I tried generating just MSH and PID segment using ADT_A01 for above listed
> different triggers and that atleast worked well.
>
>
> Regards,
> Sagar Shah
>
> James Agnew wrote:
> >
> > Hi All,
> >
> > This does indeed appear to be a bug in the generator for the
> > superstructures unfortunately. Sagar, the good news is that your code
> > *should* work, you're doing the right thing. But the bad news is that it
> > isn't working obviously. :)
> >
> > Superstructures are a brand new feature, and they haven't yet been
> heavily
> > used. I've got a fix for this issue locally, but it isn't yet released.
> >
> > One workaround you could easily implement would be to create your own
> > local
> > replacement class for ADT_AXX by copying the source to that class
> > somewhere
> > else and fixing the issue. The source for this class is here (NB this is
> > the HL7 v2.4 version):
> >
> http://grepcode.com/file_/repo1.maven.org/maven2/ca.uhn.hapi/hapi-structures-v24/2.1-beta1/ca/uhn/hl7v2/model/v24/message/ADT_AXX.java/?v=source
> >
> > If you look at the "init" method, you see a long string of method calls
> > like this:
> >
> > this.addSuperstructureApplication("MSH", "ADT_A04");
> >
> > These are the calls which advise HAPI that MSH may be used for an ADT_A04
> > message, but the bug is that there isn't a corresponding line for
> ADT_A01.
> > If you add that, you'll be allowed to add an MSH segment to an A01
> > message.
> > You'll need to do this for every segment and message type combination
> > though, which I realise will be annoying.
> >
> > I'm going to try and get a fix at least checked in within the next week
> or
> > two...
> >
> > Cheers,
> > James
> >
> >
> > On Wed, Jun 19, 2013 at 5:35 AM, sagarshah1983
> > wrote:
> >
> >>
> >> Thanks a ton Christian for this.
> >> I think I can make use of Terser to make it generic and use ADT_A01 as
> >> base
> >> message, as there are some issues with ADT_AXX as reported in previous
> >> message.
> >>
> >>
> >>
> >> Christian Ohr-2 wrote:
> >> >
> >> > Yes, I can reproduce this problem. It seems that the MSH segment is
> not
> >> > allowed e.g. for A01 message by the validator, which is obviously
> >> > nonsense.
> >> > Maybe James can enlighten this a bit potentially there's a bug in
> >> the
> >> > generator.
> >> >
> >> > After all, when creating messages I don't see a need to create
> >> > superstructure messages, as you know which message you create. You
> >> still
> >> > have the problem that there is no common super-class or interface to
> >> ADT
> >> > messages, but their are ways to circumvent this, e.g. using the Terser
> >> > class:
> >> >
> >> > Message m = new ADT_A01();
> >> > m.initQuickstart("ADT", "A01", "P");
> >> > // everything below works on a generic level
> >> > Terser t = new Terser(m);
> >> > t.set("/MSH-9-2", "A04");
> >> > t.set("/PID-3-1", "myIdentifier");
> >> > ...
> >> >
> >> > hope this helps
> >> > Christian
> >> >
> >> >
> >> > 2013/6/19 sagarshah1983 
> >> >
> >> >>
> >> >> Thanks Christian for sharing this link.
> >> >> I was trying to use ADT_AXX structure only, but found few issues with
> >> >> generating HL7 message with ADT_AXX and did not find a way to solve
> >> that
> >> >> out. So thought of checking for any other generic structure for ADT
> >> >> messages.
> >> >> Anyways, here's the issue I am facing.
> >> >> Code Snippet.
> >> >>
> >> >> ADT_AXX adt = new ADT_AXX();
> >> >> MSH msh = adt.getMSH();
> >> >> 
> >> >> msh.getMsh9_MessageType().getMsg1_MessageCode().setValue("ADT");
> >> >> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A28");
> >> >>
> >>
> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A28");
> >> >>
> >> >> Above works perfectly fine, but the moment I change last two lines to
> >> >> reflect A01, it fails.
> >> >>
> >> >> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A01");
> >> >>
> >>
> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A01");
> >> >>
> >> >> Error details:
> >> >> Caused by: ca.uhn.hl7v2.validation.ValidationException: Message
> >> >> (superstructure A

Re: [HAPI-devel] Generic class for ADT message

2013-06-19 Thread sagarshah1983

Ok. In that case, I think it makes more sense to replicate the code of
ADT_AXX and add support for additional event triggers (as suggested by you
in previous message).
Appreciate your direction.

Regards,
Sagar Shah


James Agnew wrote:
> 
> Hi Sagar,
> 
> Yes, there is definitely nothing wrong with using ADT_A01 to generate
> other
> types of messages.
> 
> The only challenge you may run into is that some ADT message types will
> have structures that ADT_A01 doesn't have. For example, an ADT_A17 has a
> second set of PID and PV1 segments, and these segments (which HAPI refers
> to as PID2 and PV12) don't exist in the ADT_A01 structure. The workaround
> there is to use the addNonStandardSegment method to add them as needed.
> This is definitely fine, and is fairly common.
> 
> Cheers,
> James
> 
> 
> On Wed, Jun 19, 2013 at 9:59 AM, sagarshah1983
> wrote:
> 
>>
>> Hi James,
>> I also had one more question to understand difference between ADT_AXX and
>> ADT_A01.
>>
>> The issues that I am getting is with ADT_AXX. So what if I have to
>> replace
>> this with ADT_A01.
>> Can I used ADT_A01 class to generate ADT A04, A05, A08 and A28 messages
>> as
>> well?
>> I tried generating just MSH and PID segment using ADT_A01 for above
>> listed
>> different triggers and that atleast worked well.
>>
>>
>> Regards,
>> Sagar Shah
>>
>> James Agnew wrote:
>> >
>> > Hi All,
>> >
>> > This does indeed appear to be a bug in the generator for the
>> > superstructures unfortunately. Sagar, the good news is that your code
>> > *should* work, you're doing the right thing. But the bad news is that
>> it
>> > isn't working obviously. :)
>> >
>> > Superstructures are a brand new feature, and they haven't yet been
>> heavily
>> > used. I've got a fix for this issue locally, but it isn't yet released.
>> >
>> > One workaround you could easily implement would be to create your own
>> > local
>> > replacement class for ADT_AXX by copying the source to that class
>> > somewhere
>> > else and fixing the issue. The source for this class is here (NB this
>> is
>> > the HL7 v2.4 version):
>> >
>> http://grepcode.com/file_/repo1.maven.org/maven2/ca.uhn.hapi/hapi-structures-v24/2.1-beta1/ca/uhn/hl7v2/model/v24/message/ADT_AXX.java/?v=source
>> >
>> > If you look at the "init" method, you see a long string of method calls
>> > like this:
>> >
>> > this.addSuperstructureApplication("MSH", "ADT_A04");
>> >
>> > These are the calls which advise HAPI that MSH may be used for an
>> ADT_A04
>> > message, but the bug is that there isn't a corresponding line for
>> ADT_A01.
>> > If you add that, you'll be allowed to add an MSH segment to an A01
>> > message.
>> > You'll need to do this for every segment and message type combination
>> > though, which I realise will be annoying.
>> >
>> > I'm going to try and get a fix at least checked in within the next week
>> or
>> > two...
>> >
>> > Cheers,
>> > James
>> >
>> >
>> > On Wed, Jun 19, 2013 at 5:35 AM, sagarshah1983
>> > wrote:
>> >
>> >>
>> >> Thanks a ton Christian for this.
>> >> I think I can make use of Terser to make it generic and use ADT_A01 as
>> >> base
>> >> message, as there are some issues with ADT_AXX as reported in previous
>> >> message.
>> >>
>> >>
>> >>
>> >> Christian Ohr-2 wrote:
>> >> >
>> >> > Yes, I can reproduce this problem. It seems that the MSH segment is
>> not
>> >> > allowed e.g. for A01 message by the validator, which is obviously
>> >> > nonsense.
>> >> > Maybe James can enlighten this a bit potentially there's a bug
>> in
>> >> the
>> >> > generator.
>> >> >
>> >> > After all, when creating messages I don't see a need to create
>> >> > superstructure messages, as you know which message you create. You
>> >> still
>> >> > have the problem that there is no common super-class or interface to
>> >> ADT
>> >> > messages, but their are ways to circumvent this, e.g. using the
>> Terser
>> >> > class:
>> >> >
>> >> > Message m = new ADT_A01();
>> >> > m.initQuickstart("ADT", "A01", "P");
>> >> > // everything below works on a generic level
>> >> > Terser t = new Terser(m);
>> >> > t.set("/MSH-9-2", "A04");
>> >> > t.set("/PID-3-1", "myIdentifier");
>> >> > ...
>> >> >
>> >> > hope this helps
>> >> > Christian
>> >> >
>> >> >
>> >> > 2013/6/19 sagarshah1983 
>> >> >
>> >> >>
>> >> >> Thanks Christian for sharing this link.
>> >> >> I was trying to use ADT_AXX structure only, but found few issues
>> with
>> >> >> generating HL7 message with ADT_AXX and did not find a way to solve
>> >> that
>> >> >> out. So thought of checking for any other generic structure for ADT
>> >> >> messages.
>> >> >> Anyways, here's the issue I am facing.
>> >> >> Code Snippet.
>> >> >>
>> >> >> ADT_AXX adt = new ADT_AXX();
>> >> >> MSH msh = adt.getMSH();
>> >> >> 
>> >> >> msh.getMsh9_MessageType().getMsg1_MessageCode().setValue("ADT");
>> >> >> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A28");
>> >> >>
>> >>
>> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue