Last In First Out based on certain conditions

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Last In First Out based on certain conditions

  • Creator
    Topic
  • #49976
    Alka Sharma
    Participant

    I was wondering if anyone has an answer or faced the same issue

    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.

Viewing 28 reply threads
  • Author
    Replies
    • #64338
      Amol Kulkarni
      Participant

      Does not sound right from SCC; The Test and all its result interpretation should be in a single message. Perhaps I am misunderstanding.

      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

    • #64339
      Alka Sharma
      Participant

      It is not SCC but our internal workflow. Below are the parent and child messages.

      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.

    • #64340
      Amol Kulkarni
      Participant

      This is a sample message that our SCC sends outbound for the PT /INR results. As i recall, this was accomplished by SCC to pull in the text that had to accompany every PT/INR test, thereby avoiding a seperate message.

      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

    • #64341
      Alka Sharma
      Participant

      Thanks so much for your reply. We have tried going that route but our lab sends messages to various systems and all the other systems have report order defined in application(s). So a change in SCC test definition is not an option for us.

    • #64342
      Jim Kosloskey
      Participant

      Alka,

      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.

    • #64343
      Shravan K
      Participant

      Alka,

             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

    • #64344
      Jim Kosloskey
      Participant

      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.

    • #64345
      Amol Kulkarni
      Participant

      Alka,

      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.

    • #64346
      Amol Kulkarni
      Participant

      Alka,

      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.

    • #64347
      Alka Sharma
      Participant

      This is our current lab workflow. Interpretation is added by using a automated rule in SCC after the tech results the parent code. So it is built like a reflex test in our version of SCC. Since it works in all our other receiving applications, lab is not willing to change the workflow. Our version of SCC is 3.1.4 ASCII. Has anyone running 3.1.4 version of ASCII that might have encountered this issue?

    • #64348
      Jim Kosloskey
      Participant

      Alka,

      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.

    • #64349
      Alka Sharma
      Participant

      Hi Everyone,

      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.

    • #64350
      Jim Kosloskey
      Participant

      Alka,

      Keep us informed of your progress.

      Jim Kosloskey

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    • #64351
      Alka Sharma
      Participant

      We had a call with Quovadx and they had suggested few things. Based on the suggestion, I had written a post tcl proc. It works in the testing editor, but when I send messages using smat, my process panics and shuts downs the threads. When I restart the threads, my outbound message is exactly what I want. message 2 and then message 1. I am attaching the error log and my tcl. Since I am new to cloverleaf and tcl, I was hoping someone out there can tell me what I am doing incorrectly.

    • #64352
      John Hamilton
      Participant

      I tried to pull this down and look at it.

      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.

    • #64353
      Kevin Kinnell
      Participant

      Alka,

      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 in the start code?  When don’t you?

      Thanks,

    • #64354
      Kevin Kinnell
      Participant

      John:

      I reformatted it.  (Good old Emacs.) 🙂

    • #64355
      Alka Sharma
      Participant

      I am doing a match on test and lab accession number. Once I have the tcl proc working, we will go through a lot of testing and all scenarios. Thanks for reformatting.

    • #64356
      John Hamilton
      Participant

      I see it now thanks.

      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.

    • #64357
      Kevin Kinnell
      Participant

      John Hamilton wrote:

      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.

    • #64358
      Alka Sharma
      Participant

      I will when get back home. I am checking this from a baseball field

      Thanks a lot

    • #64359
      Alka Sharma
      Participant

      This is good learning experience for me. Here are the messages:

      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.

    • #64360
      Jim Kosloskey
      Participant

      Alka,

      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.

    • #64361
      Alka Sharma
      Participant

      This is just a proof of concept. I do understand that the MSH 14 is not the desired place to copy test and accession #. All the messages that I have seen which needs to be paired up have had the same message control id. Thanks everyone for your responses. This is been more of a personal challenge of why the process panics and shuts down the thread than a viable solution for UCONN.

    • #64362
      John Hamilton
      Participant

      Ok here is something. It is not well documented. Nor well tested.

      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.

    • #64363
      Alka Sharma
      Participant

      Thanks so much. I will keep you updated.

      Alka…

    • #64364
      Kevin Kinnell
      Participant

      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 you have to implement will be a maintenance nightmare anyway — why not isolate it in a little Perl/Tcl/Beanshell/whatever script that just listens, compares and sends using gdbm or sqlite as the db?  If it works you can tell management that the Lab has to pay you a developers fee every time something changes.  A BIG fee.  It’s safer, cleaner and probably easier than trying to cover everything that might happen with a suspend file and a TPS.

    • #64365
      Michael Hertel
      Participant

      We had to do something like this with Dictaphone.

      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.

    • #64366
      Alka Sharma
      Participant

      Thanks everyone for your input. I am testing John’s tcl proc that he included earlier. It looks like this approach may not be signed by our risk management group. Have a great weekend

      Alka…

Viewing 28 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,129
Forums
28
Topics
9,301
Replies
34,447
Topic Tags
288
Empty Topic Tags
10