This is an interface that was running in JCAPS, but an upgrade to the 
destination forced us off JCAPS because it couldn't cope with the updated web 
service interface we had to post to.
 
People don't seem to realise how much better HAPI is at parsing HL7 than 
eGate/JCAPS and anything I have tried to write myself. My gratitude goes to all 
who have contributed to the project. You have made my life much easier.
 
Test case shown has been run using 2.0 and 2.1, results posted are the 2.1 
version, both behave the same.
 
Thanks
Ian

>>> James Agnew <[email protected]> 02/05/13 22:48 >>>
Hi Ian,

This is an issue that we have faced many times over the years, especially over 
the last 2 as we moved a bunch of legacy interfaces off of an eGate Interface 
Engine. Ugh.

What you are describing looks suspiciously like a bug we fixed in HAPI 2.1. 
What version of the library are you using?

Cheers,
James

On Tue, Apr 30, 2013 at 6:14 PM, Ian Vowles <[email protected]> 
wrote:


One of the most common problems I face with vendors who claim to follow the HL7 
standard is their failure to escape the delimiters.
On a recent project I have implemented all the HL7 transforms in hapi, and 
everything was looking good until it was noted that a description field could 
have un-escaped ^ and & in it.
The client asked me to reconstruct the correct content, which I was hopeful I 
could do. Unfortunately, I have hit a snag.
Below is my test case code, and it's output. As you can see, there is some 
strangeness about what happens when you parse, terse and encode.
Can anyone shed any light on how I might be able to reconstruct the text 
content of the field, despite it's failure to adhere to the standard?
Thanks
Ian
Code:
public void TestZAE() throws HL7Exception {

ModelClassFactory cmf = new 
CustomModelClassFactory("au.gov.qld.health.sit.hl7");
QH_ZPACK zPack = new QH_ZPACK(cmf);
String message = 
"MSH|^~\\&|HAS|201^201|CIS^prjOrmisIn|00201|20120508000011||ORU^R01|9833|P|^2.4|||||||en\r"
+ "ZAE|20120528130312|Location Group|Arrival Transport Code|Ambulance 
Number|Not Used 1|Not Used 2|Not Used 3|Presenting Problem&C1SC1^Second 
Component&C2SC1^Third Component&C3SC1^Fourth Component&C4SC1";
zPack.parse(message);
Terser terser = new Terser(zPack);
System.out.println(zPack.printStructure());
System.out.println(zPack.getZAE().getZAE1_DateTimeSeen().getTimeOfAnEvent().getValueAsDate());
ST presentingProblem = zPack.getZAE().getZAE8_PresentingProblem();
System.out.println("Presenting Problem '" + presentingProblem.getValue() + "'");
System.out.println("Presenting Problem has " + 
presentingProblem.getExtraComponents().numComponents() + " extra components.");
String reconstructed = presentingProblem.getValue();
System.out.println("Tersing /ZAE-8-1-2 '" + terser.get("/ZAE-8-1-2") + "'");
System.out.println("Tersing /ZAE-8-2-2 '" + terser.get("/ZAE-8-2-2") + "'");
ST testExample = new ST(zPack);
testExample.parse("Presenting Problem&C1SC1^Second Component&C2SC1^Third 
Component&C3SC1");
System.out.println(testExample.encode());
for (int i = 2; i < presentingProblem.getExtraComponents().numComponents() + 2; 
i++) {
Varies extraData = presentingProblem.getExtraComponents().getComponent(i - 2);
int ec = extraData.getExtraComponents().numComponents();
System.out.println("Extra component " + i + " has " + ec + " extra 
components.");
String extraComponent = terser.get("/ZAE-8-" + i);
int j = 1;
String extraSubcomponent = terser.get("/ZAE-8-" + i + "-" + j);
while (extraSubcomponent != null) {
extraComponent = extraComponent + "&" + extraSubcomponent;
j++;
extraSubcomponent = terser.get("/ZAE-8-" + i + "-" + j);
}
reconstructed = reconstructed + "^" + extraComponent;
}
System.out.println("Presnting Problem '" + reconstructed + "'");
}
Result:
QH_ZPACK (start)
MSH - 
MSH|^~\&|HAS|201^201|CIS^prjOrmisIn|00201|20120508000011||ORU^R01|9833|P|^2.4|||||||en
ZAE - ZAE|20120528130312|Location Group|Arrival Transport Code|Ambulance 
Number|Not Used 1|Not Used 2|Not Used 3|Presenting Problem^Second 
Component&C2SC1^Third Component&C3SC1^Fourth Component&C4SC1
ZAL - Not populated
ZAP - Not populated
ZBD - Not populated
ZCD - Not populated
ZEI - Not populated
ZMR - Not populated
ZMV - Not populated
ZPD - Not populated
ZPX - Not populated
ZRC - Not populated
ZTD - Not populated
ZV1 - Not populated
ZVX - Not populated
ZWL - Not populated
QH_ZPACK (end)
Mon May 28 13:03:12 EST 2012
Presenting Problem 'Presenting Problem'
Presenting Problem has 3 extra components.
Tersing /ZAE-8-1-2 'Second Component'
Tersing /ZAE-8-2-2 'C2SC1'
Presenting Problem\T\C1SC1^Second Component^Third Component
Extra component 2 has 0 extra components.
Extra component 3 has 0 extra components.
Extra component 4 has 0 extra components.
Presenting Problem 'Presenting Problem^Second Component&Second 
Component&C2SC1^Third Component&Third Component&C3SC1^Fourth Component&Fourth 
Component&C4SC1'

********************************************************************************
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 ( tel:%2B61%201800%20198%20175 ) 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.
**********************************************************************************

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel




********************************************************************************
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.
**********************************************************************************

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to