|
Hi Hz, If I understand correctly what you are trying to do, you have a system which sends an HL7 message out in a custom format, and you wish to use HAPI to create an application which receives these messages and parses them, so that you can extract and use the information contained within? Does that sound like a good summary of your situation? Assuming this is it.. Each message received by HAPI will be some implementation of the Message.java interface. If the message is a standard message, a v2.4 ADT^A01 for instance, the HAPI message produced by the parser should be of type ca.uhn.hl7v2.model.v24.message.ADT_A01. If you are deviating from the standard definition of this message, you have two options: #1 (the easy, but cryptic way): The "Terser" class may be used to extract data from a message, rather than using the named methods on the instantiated subclass of Message. There is an example of how to use the Terser on the "HAPI By Example" part of the HAPI website. #2 (the harder, but more flexible way): It is possible to supply HAPI with a custom message class, and let the parser know to use it. In order to do this, you must do several things: - Create a package to contain your custom message type - Create the custom message type, naming it appropriately (ADT_A01.java, for instance). Download the message sources to see examples of how the message definition classes look inside - Create a package/directory on your classpath somewhere called "custom_packages". In this package, create a text file whose name is [version].properties. In this file, place the full package name for the package you created to house the custom message. So, if your message is a version 2.4 message, you should have a file on your classpath named "custom_packages/2.4.properties". That file might have the contents "com.somecompany.custommsgs.v24", if that was where you had put your custom message definition. I'm not sure if this makes sense. I'm going to try and flesh this example out and put it on the HAPI site over the next few days. Cheers, James Agnew Hz wrote: Hi I am a newbie currently trying to get to grips with HAPI and am finding it quite a steep learning curve. Currently I am trying to create customized HL7 messages for use within my system. I have followed some of the instructions I found within the comments of DefaultModelClassFactory.java, but the parser is not picking up my customized message classes.If there is anyone out there who has successfully managed to implement customized HL7 messages I'd really appreciate any pointers you could give me on how to successfully implement this. Thanks in advance. Hz |
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ Hl7api-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/hl7api-devel

