SQLite track status, resend messages

Clovertech Forums Cloverleaf SQLite track status, resend messages

  • Creator
    Topic
  • #114575
    Eric Wright
    Participant

      I’m looking to do the following:

      • When I receive a message that a patient has a status of LOA, I want to send that message to the receiving system, and I also want to store that patient in a database to track them while on LOA.
      • If I receive any orders for a patient while on LOA, I want to filter them from going to the receiving system, storing them instead in a database.  If an order for a patient is received who is not on LOA, I would send the message, and not store it in a database.  (There is no LOA indicator in the ORM message to use, so I’d have to pull the status from the previously mentioned table).
      • When I receive a message that a patient has been removed from LOA, I want to send that message to a receiving system, resend all order messages that were received while on LOA, remove those orders from the table, then remove the patient from the table which tracks status.

      I don’t have much experience with database functionality inside of Cloverleaf so I’m not entirely sure how to go about each step above.  I could build it in TCL, but if I can do it inside of the GUI I’d like to start there.

      I can create the tables I need to track a patient with a status of LOA, and the table I’d need for orders received while on LOA.  I can create outbound database threads, and translations to insert the data that I need.  But, I’m not sure how to do the filtering portion, or how to pull a complete message from a field and send it as a new message.

      Would someone be able to give me an example of how to do filtering based off of a sql table?  And how to pull a message from a table and resend it?  For the latter I was thinking of a table which had MRN, Visit ID, OrderID, OrderMessage (entire message).

    Viewing 3 reply threads
    • Author
      Replies
      • #114577
        Charlie Bursell
        Participant

          When you get the message that the patient has ended LOA, pull your messages from the database.

          For each message do a msgcopy of the message recieved that remoced from LOA and msgset each copied message handle with a message from the database.  Put each into dispList as a CONTINUE.  The add KILL original message to list.  Return the list.

          Be sure and delete all of the messages from the database.  You may also have to set up a thread to run on a timer maybe once a day to get rid of any “outlaws: remaining over a given period of time. For example, what happens if the patient never returns?

          A lot to do here but, I think, easily implemented.  This is just looking from a high level.

           

        • #114643
          Eric Wright
          Participant

            Hi Charlie,

            Thanks for the advice.  I decided to do the following:

            I’m writing the start of the LOA to the database when I receive an A21.  Using a standard outbound database thread/translation.

            I put a pre-proc on the orders route to check if the patient is on LOA, and if so, I kill the message(s), and write the order(s) to the database for later use.

            I put a pre-proc on the A22 route to do the following:

            • remove the entry in the A21 table (taking the patient off LOA)
            • add the A22 to the dispList
            • do a search for any orders which were stored
            • add each order to the dispList as a continue

            I’ve tested the code out in the testing tool and so far everything is working as expected.  I’m going to add the code to the routes, and resubmit some messages to verify that it’ll work.

          • #114652
            Charlie Bursell
            Participant

              Looks good.  As I said though you will need to have an automated or manual method to clean out junk data that has been there too long.  I would recommend for each patient when you enter the LOA to also enter a timestamp and a maximum time for the LOA.  That way you can get rid of junk in the DB either with a timed thread or manually/

              Remember, Murphy was an optimist, 🙂

            • #114654
              Eric Wright
              Participant

                Yep, agreed.  I added a time stamp to the A21 table as well.  I’ve just gotta do a little research to see how long patients are typically on LOA.  Then I’ll put in a cleanup routine.

            Viewing 3 reply threads
            • You must be logged in to reply to this topic.