Thank you, i think that may be what i was looking for.

------------------------------------------------------------------------
*Laurent (Harry) Hasson*
360Fresh


On 2/16/2012 22:41, Ian Vowles wrote:
What you are after is the terser. Cut and pasted snippets below. Since the structure of the ORM is rather deep, I included some additional strings to make it easier. The example I extracted this from uses a properties file that has a database column name as the key, and the datatype and terse destination as the value, like this:
MESSAGE_TYPE=VARCHAR2|MSH-9-1
TRIGGER_EVENT=VARCHAR2|MSH-9-2
PATIENT_CLASS=VARCHAR2|PV1-2
ORDER_CONTROL=VARCHAR2|ORC-1
ORDER_STATUS=VARCHAR2|ORC-5
CLI_ID=NUMBER|PID-3
CLI_LAST_NAME=VARCHAR2|PID-5-1
CLI_FIRST_NAME=VARCHAR2|PID-5-2
CLI_OTHER_NAMES=VARCHAR2|PID-5-3
CLI_TITLE=VARCHAR2|PID-5-5
CLI_BIRTH_DATE=DATE|PID-7
I split the value on the pipe, make some format decisions using the datatype, and put the value into the nominated field with the terser. The deeper and somewhat odd looking terser keys can be seen if you create a message of a particular type and do a printstructure. With the message object and it's terser you can use both the technique you have shown, and the terser interchangeably to construct your message. You mention that there are differences from hospital to hospital, which I have seen with content, but seldom with structure. If the hospital doesn't follow the HL7 standard in it's structure, you may have to build custom messages. If they just put funny content in, you can use either of these techniques to get at the content, and do what you need. Note this code is a few lines cut from a running interface, just to show the use. It's not in any way complete. It doiesn't show the loop through the columns of the recordset object of the database source to fill the entire message. The MSH segment is filled out using the hl7Out.getMSH().getVersionID().getVersionID().setValue("2.3.1"); technique.
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.model.DataTypeException;
import ca.uhn.hl7v2.model.v231.message.ORM_O01;
import ca.uhn.hl7v2.parser.CustomModelClassFactory;
import ca.uhn.hl7v2.parser.ModelClassFactory;
import ca.uhn.hl7v2.util.Terser;
ModelClassFactory cmf = new CustomModelClassFactory("au.gov.qld.health.sit.bsqr");
            ORM_O01 hl7Out = new ORM_O01(cmf);
            System.out.println(hl7Out.printStructure());
            Terser terser = new Terser(hl7Out);
            String pidTerse = "/PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1";
            String pv1Terse = "/PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1/PV1PV2";
String orcTerse = "/ORCOBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTECTIBLG"; String obrTerse = orcTerse + "/OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE";

             if (!mobileStationName.equalsIgnoreCase("unknown")) {
                    terser.set(obrTerse + "/OBR-21", mobileStationName);
             }

Best of luck
Ian



>>> LDH <l...@360fresh.com> 17/02/12 12:37 >>>

I just worked on a project which used Mirth, and in the mapping code, we'd do something like

    var PatientGivenName = msg['PID.5.2'].toString();

I have been searching the docs and samples online to find a way to access values from "path expressions" like the above, but without success. A quick pointer would be so useful.

The reason why i am researching this is that i'd like eventually to have a simple configuration file that would provide simple mappings which could then be modified without changing code. Currently, i'd get the field with the following code:

    ADT_A01 ADT = (ADT_A01) Msg;
    ADT.getPID().getPatientName(0).getGivenName().getValue();

Clearly, for FirstName, that is unlikely to change, but some other values seem to vary a lot from hospital to hospital and would like my doce to be more flexible and driven by a simple mapping configuration.

Thank you.
Laurent Hasson
360Fresh

********************************************************************************

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175 or by return email. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

**********************************************************************************



------------------------------------------------------------------------------
Virtualization&  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/


_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to