Hi Sara,
The names of various fields changed between versions of HL7. Using a newer
version of the structures is fine (although you need to be aware that some
fields may have been added which will be incompatible with older versions
of the standard).
Because of these name changes though, the method names you need to use to
populate data in the messages will change too. If you have compile errors,
look to see if there are methods with similar names (opening up the actual
HL7 standard for the version you are using would be helpful) and you can
probably simply change as required. Maybe also try looking for other
modules in the code you are working with that need to populate these fields.
James
On Thu, Jun 5, 2014 at 2:47 AM, Sara Fatima <sara.mirz...@gmail.com> wrote:
> Hi James
>
> I tried with removing <scope>provided</scope> but still the error is
> there.
>
> What I realised that openmrs-core has already structures v25 and v26. So I
> tried changing my imports, and work with v25. (Earlier I was trying to add
> structure v24 dependency)
>
> import ca.uhn.hl7v2.model.v25.message.ADT_A01;
>> import ca.uhn.hl7v2.model.v25.segment.MSH;
>> import ca.uhn.hl7v2.model.v25.segment.PID;
>
>
> By doing this my error was resolved and I could generate HL7 message, but
> by changing to v25 I got error in below line.
>
>
>> mshSegment.getDateTimeOfMessage().getTimeOfAnEvent().setValue("200701011539");
>> mshSegment.getMessageType().getMessageType().setValue("ADT");
>> pid.getPatientIdentifierList(0).getID().setValue("123456");
>
>
> Currently I just commented out these lines to check if the rest is
> working, it is working now. But I would like to know why these lines aren't
> getting compiled. (As I will also need patient identifier in my HL7 message)
>
> Also my knowledge about HAPI is limited and I am not very sure what effect
> would be there by changing structure from v24 to v25. Could you please
> brief me about the purpose of these 2 structures?
>
> Thanks & Regards
> Sara
>
> Regards
> Sara Fatima
>
>
>
> On Wed, Jun 4, 2014 at 11:55 PM, James Agnew <ja...@jamesagnew.ca> wrote:
>
>> I would try removing the <scope>provided</scope> from your dependencies.
>> That means "use it to compile, but don't include it in the finished
>> product" which is probably not wanted here.
>> James
>>
>>
>> On Wed, Jun 4, 2014 at 1:22 PM, Sara Fatima <sara.mirz...@gmail.com>
>> wrote:
>>
>>> Hi
>>>
>>> Which classpath are you referring to? I haven't set any classpath as of
>>> now. What class paths do I need to set?
>>> On 4 Jun 2014 22:49, "g3949" <g3...@yahoo.com> wrote:
>>>
>>>>
>>>> then your classpath is wrong...
>>>> HAPI doesn't find the hapi-jar files while trying do run the programm
>>>>
>>>> FP
>>>>
>>>>
>>>> On Wednesday, June 4, 2014 7:10 PM, Sara Fatima <
>>>> sara.mirz...@gmail.com> wrote:
>>>>
>>>>
>>>> Hi Christian,
>>>>
>>>> I have added the below dependencies,
>>>>
>>>> <dependency>
>>>> <groupId>ca.uhn.hapi</groupId>
>>>> <artifactId>hapi-base</artifactId>
>>>> <version>2.0</version>
>>>> <scope>provided</scope>
>>>> <exclusions>
>>>> <exclusion>
>>>> <groupId>org.slf4j</groupId>
>>>> <artifactId>slf4j-api</artifactId>
>>>> </exclusion>
>>>> <exclusion>
>>>> <groupId>log4j</groupId>
>>>> <artifactId>log4j</artifactId>
>>>> </exclusion>
>>>> </exclusions>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>ca.uhn.hapi</groupId>
>>>> <artifactId>hapi-structures-v24</artifactId>
>>>> <version>2.0</version>
>>>> <scope>provided</scope>
>>>> </dependency>
>>>>
>>>>
>>>> But I am still facing the same problem.
>>>>
>>>> An Internal Error has Occurred
>>>>
>>>> *java.lang.NoClassDefFoundError *ca/uhn/hl7v2/model/v24/message/ADT_A01
>>>>
>>>>
>>>>
>>>> Regards
>>>> Sara Fatima
>>>>
>>>>
>>>>
>>>> On Wed, Jun 4, 2014 at 9:43 PM, Christian Ohr <christian....@gmail.com>
>>>> wrote:
>>>>
>>>> You need to add dependencies on the structure libraries.
>>>> Please get started with
>>>> http://hl7api.sourceforge.net/getting_started.html.
>>>>
>>>> Christian
>>>>
>>>>
>>>> 2014-06-04 17:35 GMT+02:00 Sara Fatima <sara.mirz...@gmail.com>:
>>>>
>>>> Hi Christian,
>>>>
>>>> Thank you for the guidelines. I am trying the below code to create HL7
>>>> message.
>>>>
>>>> ADT_A01 adt = new ADT_A01();
>>>>
>>>> MSH mshSegment = adt.getMSH();
>>>> mshSegment.getFieldSeparator().setValue("|");
>>>> mshSegment.getEncodingCharacters().setValue("^~\\&");
>>>>
>>>> mshSegment.getDateTimeOfMessage().getTimeOfAnEvent().setValue("200701011539");
>>>>
>>>> mshSegment.getSendingApplication().getNamespaceID().setValue("TestSendingSystem");
>>>> mshSegment.getSequenceNumber().setValue("123");
>>>> mshSegment.getMessageType().getMessageType().setValue("ADT");
>>>> mshSegment.getMessageType().getTriggerEvent().setValue("A01");
>>>> mshSegment.getMessageType().getMessageStructure().setValue("ADT
>>>> A01");
>>>>
>>>> PID pid = adt.getPID();
>>>>
>>>> pid.getPatientName(0).getFamilyName().getSurname().setValue("Doe");
>>>> pid.getPatientName(0).getGivenName().setValue("John");
>>>> pid.getPatientIdentifierList(0).getID().setValue("123456");
>>>>
>>>> Parser parser = new PipeParser();
>>>> String encodedMessage = parser.encode(adt);
>>>> System.out.println("Printing ER7 Encoded Message:");
>>>> System.out.println(encodedMessage);
>>>>
>>>> return encodedMessage;
>>>>
>>>> But I am facing an error, as
>>>>
>>>> An Internal Error has Occurred
>>>>
>>>> *java.lang.NoClassDefFoundError *ca/uhn/hl7v2/model/v24/message/ADT_A01
>>>>
>>>>
>>>> Is there any jar file which I should add to support ADT? (I am using it
>>>> in maven project)
>>>>
>>>> Thanks & Regards
>>>> Sara Fatima
>>>>
>>>>
>>>>
>>>> On Wed, Jun 4, 2014 at 8:29 PM, Christian Ohr <christian....@gmail.com>
>>>> wrote:
>>>>
>>>> Basically you instantiate an instance of PipeParser (or GenericParser)
>>>> yourself instead of obtaining it from an HapiContext:
>>>>
>>>> ADT_A01 adt = new ADT_A01();
>>>>
>>>> ... populate message ...
>>>>
>>>> Parser parser = new PipeParser();
>>>> String encodedMessage = parser.encode(adt);
>>>> System.out.println("Printing ER7 Encoded Message:");
>>>> System.out.println(encodedMessage);
>>>>
>>>> When you need to parse a HL7 message, you would call parser.parse
>>>> instead of parser.encode, obviously.
>>>>
>>>> BTW. we always try to retain backwards-compatibility on API level as
>>>> good as possible. The code above is still valid in 2.1 and 2.2.
>>>> There have been some internal changes between 2.0 and 2.1 and 2.2 (and
>>>> bugfixes!), but chances are that OpenMRS may work as-is with newer HAPI
>>>> versions, too.
>>>>
>>>> regards
>>>> Christian
>>>>
>>>>
>>>> 2014-06-04 7:17 GMT+02:00 Sara Fatima <sara.mirz...@gmail.com>:
>>>>
>>>> Hi all,
>>>>
>>>> Since few weeks I am trying to work with HAPI. My aim here is to create
>>>> a HL7 message and send it to an HIE over MLLP (using PAM profile). I need
>>>> to include this feature in an OpenMRS module. HAPI is already embed in
>>>> OpenMRS-core, but OpenMRS is supporting HAPI v2.0.
>>>>
>>>> I was using this example
>>>> <http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/CreateAMessage.html>
>>>> to
>>>> create HL7 message. What I understand here is this example is working fine
>>>> with HAPI v2.1 and not with HAPI v2.0. I see that HapiContext and
>>>> DefaultHapiContext are working with v2.1 and not with v2.0. So I am looking
>>>> for a way to create HL7 message using HAPI v2.0.
>>>>
>>>> I would be glad if someone could guide me to old documentation, or any
>>>> examples which can help create HL7 message using v2.0.
>>>>
>>>> Thanks & Regards
>>>> Sara Fatima
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their
>>>> applications. Written by three acclaimed leaders in the field,
>>>> this first edition is now available. Download your free book today!
>>>> http://p.sf.net/sfu/NeoTech
>>>> _______________________________________________
>>>> Hl7api-devel mailing list
>>>> Hl7api-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their
>>>> applications. Written by three acclaimed leaders in the field,
>>>> this first edition is now available. Download your free book today!
>>>> http://p.sf.net/sfu/NeoTech
>>>> _______________________________________________
>>>> Hl7api-devel mailing list
>>>> Hl7api-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their
>>>> applications. Written by three acclaimed leaders in the field,
>>>> this first edition is now available. Download your free book today!
>>>> http://p.sf.net/sfu/NeoTech
>>>>
>>>> _______________________________________________
>>>> Hl7api-devel mailing list
>>>> Hl7api-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>>>>
>>>>
>>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Learn Graph Databases - Download FREE O'Reilly Book
>>> "Graph Databases" is the definitive new guide to graph databases and
>>> their
>>> applications. Written by three acclaimed leaders in the field,
>>> this first edition is now available. Download your free book today!
>>> http://p.sf.net/sfu/NeoTech
>>> _______________________________________________
>>> Hl7api-devel mailing list
>>> Hl7api-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>>>
>>>
>>
>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel