there is a generic problem with HL7 messages that are ambiguous and can be parsed. One of the example is the ORL_O34
ORL_O34:
Chapter in Std-Doc.: 4.4.9
Message structure
MSH
MSA
[ { ERR } ]
[ { SFT } ]
[ { NTE } ]
[ RESPONSE
[ PATIENT
PID
{ SPECIMEN
SPM
[ { OBX } ]
[ { SAC } ]
[{ ORDER
ORC
[{ TIMING
TQ1
[ { TQ2 } ]
}] TIMING
[ OBSERVATION_REQUEST
OBR
[{ SPECIMEN
SPM
[ { SAC } ]
}] SPECIMEN
] OBSERVATION_REQUEST
}] ORDER
} SPECIMEN
] PATIENT
] RESPONSE
When the parser reaches a second SPM in a message there is no way to know if the SPM is the SPM that belongs to the RESPONSE/PATIENT/SPECIMEN/ORDER/OBSERVATION_REQUEST/SPECIMEN group or if it belongs to the second RESPONSE/PATIENT/SPECIMEN group.
We understand that this is not your problem and that HL7 needs to solve that issue. Currently in HAPI the Initiator class , in the ca.uhn.hl7v2.app package parses the ACK messages it receives before returning it to the caller. When such a message is received by HAPI Initiator class, an exception is raise : ca.uhn.hl7v2.HL7Exception: Can't instantiate class ca.uhn.hl7v2.model.v251.group.ORL_O34_OBSERVATION_REQUEST and the response message is not available to the calling application.
We would like to have the ability to get the response message unparsed by HAPI and returned as a string and therefore we are suggestion the following improvement to HAPI (see below the code to add in the file attached to that issue).
This is a problem that impacts other people as well as you can see there : http://www.mail-archive.com/hl7api-devel@lists.sourceforge.net/msg00696.html.
For your information a sample ORL_O34 message that HAPI can not parse :
MSH|^˜\&|LAB_ANALYZER|IHE|OM_LAB_ANALYZER_MGR|IHE|20120321103346||ORL^O34^ORL_O34|20120321103346|P|2.5.1||||||UNICODE UTF-8
MSA|AE|20120321103212
ERR|||205|E||||An order with this filler order number already exists
Thanks for considering this input
View and moderate all "feature-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Feature Requests"
Cannot attach file so here it is :
public String sendAndReceiveAsString(Message out) throws HL7Exception, LLPException, IOException {
HapiLog rawOutbound = HapiLogFactory.getHapiLog("ca.uhn.hl7v2.raw.outbound");
HapiLog rawInbound = HapiLogFactory.getHapiLog("ca.uhn.hl7v2.raw.inbound");
if (out == null) {
throw new HL7Exception("Can't encode null message", HL7Exception.REQUIRED_FIELD_MISSING);
}
//register message with response Receiver(s) (by message ID)
Terser t = new Terser(out);
String messID = t.get("/MSH-10");
if (messID == null || messID.length() == 0) {
throw new HL7Exception("MSH segment missing required field Control ID (MSH-10)", HL7Exception.REQUIRED_FIELD_MISSING);
}
MessageReceipt mr = this.conn.reserveResponse(messID);
//log and send message
String outbound = conn.getParser().encode(out);
log.info("Initiator sending message: " + outbound);
rawOutbound.info(outbound);
try {
this.conn.getSendWriter().writeMessage(outbound);
}
catch (IOException e) {
conn.close();
throw e;
}
String inbound = "";
//wait for response
boolean done = false;
long startTime = System.currentTimeMillis();
while (!done) {
synchronized (mr) {
try {
mr.wait(500); //if it comes, notifyAll() will be called
}
catch (InterruptedException e) {
}
if (mr.getMessage() != null) {
//get message from receipt
inbound = mr.getMessage();
//log that we got the message
log.info( "Initiator received message: " + inbound );
rawInbound.info(inbound);
done = true;
}
if (System.currentTimeMillis() > startTime + timeoutMillis)
throw new HL7Exception("Timeout waiting for response to message with control ID '" + messID);
}
}
return inbound;
}
Last edit: Anonymous 2013-08-26
View and moderate all "feature-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Feature Requests"
Sample message :
MSH|^˜\&|LAB_ANALYZER|IHE|OM_LAB_ANALYZER_MGR|IHE|20120321120005||ORL^O34^ORL_O34|20120321120005|P|2.5.1||||||UNICODE UTF-8
MSA|AA|20120321120002
PID|||DDS-30939^^^DDS&1.3.6.1.4.1.12559.11.1.4.1.2&ISO^PI||Bartoli^Rosine^^^^^L|Comte^^^^^^M|19751013221500|F|||Avenue Antoine Pinay^^Hem^^59510^FRA||||||||||||||||||||N
SPM|1|84&IHE_OM_ANALYZER&1.3.6.1.4.1.12559.11.1.2.2.4.5&ISO^85&IHE_OM_ANALYZER&1.3.6.1.4.1.12559.11.1.2.2.4.5&ISO||BON^Bone^2.16.840.1.113883.12.70|||PACE^Pace, Gen-Probe^1.3.6.1.4.1.21367.100.1||||Q^Control specimen^1.3.6.1.4.1.21367.100.1|||||BHZ^Biohazard^1.3.6.1.4.1.21367.100.1|20120321120000|20120322120000||N||||||1
SAC|||154^IHE_OM_OP^1.3.6.1.4.1.12559.11.1.2.2.4.2^ISO
ORC|OK|46^IHE_OM_ANALYZER_MGR^1.3.6.1.4.1.12559.11.1.2.2.4.4^ISO|86^IHE_OM_ANALYZER^1.3.6.1.4.1.12559.11.1.2.2.4.5^ISO|155^IHE_OM_OP^1.3.6.1.4.1.12559.11.1.2.2.4.2^ISO|SC||||20120321120000|3456^ROSZEK^JEANETTE^G^^DR||3456^ROSZEK^JEANETTE^G^^DR|||||922229-20^IHE-LAB^1.3.6.1.4.1.21367.100.1
OBR||46^IHE_OM_ANALYZER_MGR^1.3.6.1.4.1.12559.11.1.2.2.4.4^ISO|46^IHE_OM_ANALYZER_MGR^1.3.6.1.4.1.12559.11.1.2.2.4.4^ISO|LAB338^Vitamin B12^1.3.6.1.4.1.21367.100.1||||||||||||3456^ROSZEK^JEANETTE^G^^DR||||||||||||3456^JIANG^WEI^^^DR
Last edit: Anonymous 2013-09-25