› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Last In First Out based on certain conditions
Systems: SCC and IBEX
Our lab sends a result for a particular test (Parent) in a result transaction and then sends a second message which has the interpretation of the test result (Child). There is no indication in the second message that it belong to the first one. I have a table and using an indicator to determine msg 1 vs msg 2.
Result file in IBEX based on the time it gets to IBEX. Last message received goes on top of the patient chart. So in Ibex, if you look in patient chart, interpretation is displayed before the actual test result. Lab would like the interpretation to file under the test.
1) First thought was to hold the first message, wait for the second message and then concatenate.
2) Second thought was to use the metadata priority. Set the first message to second highest 5110 and the second part of the message to highest priority 5111. So this way the second message will go before the first one. This does not work efficiently either
So I am looking for LIFO solution where last in first out when certain conditions are met.
Can you please post an example of what SCC is sending out.
We have SCC and IBEX interface through the cloverleaf engine and hopfully I can compare our SCC results outbound for a possible solution.
Thanks
Parent Message
MSH|^`&|LAB|L|IDX||20080407130100.0000-0400||ORU|00023540|P|2.3
PID|1||T77001402||TEST^WHITE||19761202130100.0000-0400|F||||||||||7005813|111-22-3333
PV1||E|EMR||||7438^FULLER^ROBERT
ORC|||E8070001||||||20080407130155.0000-0400|||7438^FULLER^ROBERT
OBR|1||E8070001|PT w/INR^LAB03055^PT w/INR|||20080407091000.0000-0400|20080407091000.0000-0400||MLY||||20080407092400.0000-0400||7438^FULLER^ROBERT||||||20080407130155.0000-0400|||F|||||||MLY||MLY
OBX|1|NM|PT^^PT||13.7|sec|10.0-13.0|H|||F
OBX|2|NM|INR02^^INR||1.50|ratio|||||F
Child
MSH|^`&|LAB|L|IDX||20080407130100.0000-0400||ORU|00023540|P|2.3
PID|1||T77001402||TEST^WHITE||19761202130200.0000-0400|F||||||||||7005813|111-22-3333
PV1||E|EMR||||7438^FULLER^ROBERT
ORC|||E8070001||||||20080407130155.0000-0400|||7438^FULLER^ROBERT OBR|1||E8070001|INRIN^LAB00082|||20080407091000.0000-0400|20080407091000.0000-0400||MLY||||20080407092400.0000-0400||7438^FULLER^ROBERT||||||20080407130155.0000-0400|||F|||||||AUTOV
OBX|1|ST|INRIN^LAB00082||see below||||||F
NTE|1||Warfarin is monitored by the international normalized ratio
NTE|2||(INR). The INR is calculated from the PT and is intended to
NTE|3||allow valid comparisons of results regardless of the type of
NTE|4||PT reagent used. The usual therapeutic goal is an INR of 2-3,
NTE|5||however, the therapeutic range will vary depending on the
NTE|6||indication for the use of oral anticoagulation. For further
NTE|7||recommendations for the optimal therapeutic range for various
NTE|8||indications refer to Chest 119:Suppl 1:2001- Sixth ACCP
NTE|9||Consensus Conference on Antithrombotic Therapy.
I think there is a way on SCC to attach a constant comment as a note in the test setup; perhaps the lab IT can enable this for you.
MSH|^~&|SCC||HCM|MSMC|20080422144503||ORU^R01||P|2.2
PID|||222222||LAST^JAMES||12220202|M||||||||||222222
PV1||u|02^G111||||9000^NDIAH^DEVI
ORC|RE||1|425||||||||9000^NDIAH^DEVI||||O
OBR|||1|00250^PRO TIME^^PT^PRO TIME|||200604120610|||||||200604181350||||||||200604181350|||F||||||||||||||||||||NR
OBX||NM|00250^PRO TIME^^PRO^PRO TIME||30.8|SECONDS|12.3-15.5|H|||F
OBX||NM|02553^INR^^INR^INR||3.3||||||F
NTE|||General Recommendations for Monitoring I.N.R. (International
NTE|||Normalization Ratio) Values for Warfarin Anticoagulant
NTE|||Therapy.
NTE|||Note: These are general recommendation and are not intended to
NTE||| direct treatment for individual patients. Individual
NTE||| treatment will vary with specific circumstances.
NTE|||Recommended
NTE|||I.N.R. Level Clinical Circumstance
NTE|||2.0-3.0 Deep vein thrombosis, pulmonary embolism,x0d
NTE||| atrial fibrillation, tissue heart valves,
NTE||| prevention of systemic embolism in
NTE||| valvular heart disease, acute anterior
NTE||| myocardial infarction.
NTE|||2.5-3.5 Pevention of systemic embolism with
NTE||| mechanical mitral or aortic valves.
NTE|||3.0-4.0 Arterial thromboembolism in the
NTE||| antiphospholipid syndrome.
NTE|||3.0-4.5 Prevention of systemic embolism in high
NTE||| risk patients with mechanical mitral or
NTE||| aortic valves, recurrent systemic
Can you convince the receiving system to handle the issue?
Like suspend the first result waiting for the second?
If neither the sending or receiving systems can take care of the issue, I guess you could write some Tcl code to create a suspense file for the first message and retrieve it when the second arrives.
However, you now become responsible for all of the permutations like what happens if the second message does not arrive? How long do you wait for it before an issue exists? What do you do when that situation arises?
There are probably many other procedural issues as well. Such as managing the suspense file and having full resolution and audit routines for exceptions.
That is not a situation I would like to be in.
Jim Kosloskey
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Based on what i’ve understood from your post i just want to give a suggestion it may not be what you want exactly. I feel i should try.
The problem is to determine the for which first message(Parent) does the second message(Child) belongs.This is what i understood.
If u look at both the messages u’ll find Patient Id is similar or you could say Patient Address or Patient visit information is similar.Based on these conditions you can figure out which child message belongs to appropriate Parent message.
Similarly,i believe you can do it based on message control id too.
I’m not sure whether this will help you 😕 .i just hold my fingers cross.
-Shravan
If the HL/7 standard is being followed, the Control ID (MSH-10) should be unique per message. Thus there would be no way to tie two different source messages together using that field.
Jim Kosloskey
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Thinking this one over again, the test INR; is this reported on all PT’s at your Medical Center? If yes, I would rerequest the lab to set up the PT test as a group test with INR as one its resulting components. The INR would be setup as an individual test with the INR message as a message under the message tab.
From the example you posted, it seems that the PT and INR are setup as two seperate individual tests and therefore the two seperate messages from SCC.
One other identifier you may want to use is the SCC ID in OBR.3 (filler ID); but you have to be careful because if I am not mistaken one can have upto 24 different test under a single ID.
Again I am guessing that the SCC on your side is setup similar to ours.
I am curious, why wont the lab place the TEXT comment on the
INR02 Test. If they were to define a comment under INR02, SCC would release this information with results and the comment in the NTE segment.
Perhaps I am missing something.
If the child message were a continuation of the Parent message (I am not sure that is the case) then there is an HL/7 mechanism for continuing a message. You could see if the source system will provide that functionality.
If the two messages are indeed separate messages (one is not logically a continuation of the other) then some other approach needs to be deployed.
If the receiving system cannot do a suspense process, then you may need to do that in Cloverleaf(R). However, if there is no way to ABSOLUTELY tie the messages together, then it does not mattter who is doing the handling in my opinion – it will not work 100%.
You say other systems are sensitive to the data being in two messages and you do not want to change the source because it will affect the other systems.
Another option might be to change the source system so that it provides a combined message in such a way that you can break the message apart into two messages inside Cloverleaf(R) Xlate (that is easier to do than managing a suspense file IMHO) for those receiving systems that are sensitive to receiving two messages and now the system that needs them together can also be satisfied.
That will mean changing the Integrations for all of the receiving systems — but I still think that might be more reliable and less work overall than trying to provide a Business Process (suspense file handling) inside Cloverleaf(R).
Jim Kosloskey
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
These two messages are different but I have a table in my xlate which distinguishes the parent from the child message. I am looking for a way to hold the first message till the second message arrives. Then send the second message before the first one. I have a meeting with Quovadx on Monday. We do have a possible solution but we need to come up with fail safe option. Questions like what happens when the second message never comes because of some upstream issue in lab. What happens when the insert fails in the database etc. How do we put a timer so the orphan message leaves the engine.
Keep us informed of your progress.
Jim Kosloskey
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
The format is all messed up.
I think I would spend more time trying to reformat so I could read it then it will take to figure out what is wrong.
Can you repost it where we can look at it for you.
Thanks.
I’ve downloaded the code and I’m looking it over. While I do that, I was wondering: is it ever possible that two sets of msg2,msg1 pairs could get mixed? Say msg2a, then msg2b, and then the msg1a or msg1b?
Jim or Charlie or anyone: when do you need to use the engpswthrow
Thanks,
I reformatted it. (Good old Emacs.)
I think I could get this working. But I would really be concerned.
You are taking messages and storing them in memory until you get the second part.
What happens if you get shutdown I did see what you do with the message stored in msg_part 1 but I would suspect you will need to kill them or they will be sent even with a lower priority. That means at shutdown you need to add something that will write all the messages in the proc to somewhere.
Second the time you have setup, where you look at the elapsed time a message has been waiting. What happens if you don’t get a message for a long time. That loop will never be hit.
Kind of unusually to have those fields in the MSH segment to check on. But I’m guessing the vendor could do that. But could not change the order the messages were sent in.
This would be a very dangerous routine where data will be lost at some point in time. I would not think getting it in a new order for a user would be worth the danger of losing a result.
Give me some time I will get this working but you have to consider those other things.
If you could post a couple of the MSH segments that would help me out to see exactly what they are sending.
I think I could get this working. But I would really be concerned.
No joke, that. This really REALLY screams to be done by the vendor. To do it in Cloverleaf (and do it really right) it seems you’d have to get into the guts of the engine and make another db–you’d have the error, recovery, and “user-level stuff I need to wait for other stuff before I can send it” db. At the very least you’d need to be messing with gdbm. Duct-tape and prayer…
I think I might be suggesting that the danger of a problem with patient care due to unreasonable demands on the interface outweighs the lab’s desire not to have their workflow messed with.
Thanks a lot
First Message
MSH|^`&|LAB|L|IDX||20080429150700.0000-0400||ORU|00026310|P|2.3||INRIN^E8290009^1
PID|1||T77001099||TEST^YELLOW||19600202132400.0000-0400|F||||||||||7005842
PV1||E|EMR||||7438^FULLER^ROBERT
ORC|||E8290009||||||20080429150717.0000-0400|||7438^FULLER^ROBERT
OBR|1||E8290009|PT w/INR^LAB03055^PT w/INR|||20080429150000.0000-0400|20080429150000.0000-0400||MISC||||20080429150600.0000-0400||7438^FULLER^ROBERT||||||20080429150717.0000-0400|||F|||||||EHK||EHK
OBX|1|NM|PT^^PT||14.0|sec|10.0-13.0|H|||F
OBX|2|NM|INR02^^INR||12.0|ratio|||||F
Second Message
MSH|^`&|LAB|L|IDX||20080429150700.0000-0400||ORU|00026310|P|2.3||INRIN^E8290009^2
PID|1||T77001099||TEST^YELLOW||19600202132400.0000-0400|F||||||||||7005842
PV1||E|EMR||||7438^FULLER^ROBERT
ORC|||E8290009||||||20080429150717.0000-0400|||7438^FULLER^ROBERT
OBR|1||E8290009|^LAB00082|||20080429150000.0000-0400|20080429150000.0000-0400||MISC||||20080429150600.0000-0400||7438^FULLER^ROBERT||||||20080429150717.0000-0400|||F|||||||AUTOV
OBX|1|ST|INRIN^LAB00082||see below||||||F
NTE|1||Warfarin is monitored by the international normalized ratio
NTE|2||(INR). The INR is calculated from the PT and is intended to
NTE|3||allow valid comparisons of results regardless of the type of
NTE|4||PT reagent used. The usual therapeutic goal is an INR of 2-3,
NTE|5||however, the therapeutic range will vary depending on the
NTE|6||indication for the use of oral anticoagulation. For further
NTE|7||recommendations for the optimal therapeutic range for various
NTE|8||indications refer to Chest 119:Suppl 1:2001- Sixth ACCP
NTE|9||Consensus Conference on Antithrombotic Therapy.
Wow!
OK first of all MSH-14 is the ‘Continuation Pointer’ field in the MSH. It is a ST Data Type. The usage here is as a component (probably CM) Data Type.
You should read Chapter 2 of the 2.3 HL/7 standard specifically the sections having to do with message continuation (probably the vendor should read it also).
I am a bit rusty on how this is supposed to work but I don’t think the way they are doing it is correct.
The way I recall it is supposed to be done is the first message utilizes a DSC segment in the message to indicate the message is continued and provides a ‘Continuation Pointer’ (the MSH-14 is not populated).
The second message then has the same value in MSH-14 as the first message had in the DSC segment (the DSC only has one field – ‘Continuation Pointer’. This connects the second message to the first. If the message still needed to be continued then the second message would have a unique ‘Continuation Pointer’ in its DSC segment and the third (and let’s say final) message would have the second message’s DSC ‘Continuation Pointer’ in its MSH-14.
By the way, I believe the Continuation Pointers used in a continuation set is supposed to have some sort of uniqueness in relationship to the entire set of messages similar to the goal for the Control ID (MSH-10) – such that after a gap wherein no continuation is used, you do not resume using the same pointer values when continuation resumes.
I notice the Control ID (MSH-10) is the same for both messages is that true for all messages or only for the ones to be tied together?
In any case it looks like the vendor does not understand how to continue HL/7 messages.
But whatever the situation, I agree with Kevin as I have stated before. That is, in my opinion, this activity belongs somewhere other than on an Integration Engine even though the tools might exist in Cloverleaf(R).
Even if the vendor follows the proper HL/7 message continuation protocol, the responsibility for managing the situation is fairly steep and one I hope I never am forced to accept.
Thanks,
Jim Kosloskey
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
But it should get you well on your way.
There are lots of holes in this workflow. I can’t express enough how bad an idea I think this is.
But I wanted to play with some code this gave me the chance to do that.
Have fun and let me know if you have any question.
Alka…
Have a look at this philosophical thread
It’s a knotty problem we all face, but your situation is extreme. If I were you I’d write a small, separate app that just accepted messages and compared them, then fired them back to Cloverleaf in the correct order. I’m not kidding. Any solution youeverything
The project got cancelled so I don’t have the procs to reference any more, but here is the gist.
When collecting the parts, do not return a disposition for the message to the engine. Therefore the messages stay in the recovery database.
When you get the last completed message, do a msgcopy, create the new message with the parts, return that $mh with the CONTINUE disp and return the other $mh’s with KILL disps.
Alka…