This topic contains 4 replies, has 2 voices, and was last updated by  Robert James 3 years, 3 months ago.

Validating messages

  • Our current Python-based VMDs have considerable amounts of code dedicated to validating messages before processing them. For example, we try to make sure that when an A01/A04 is received, we have the required values (e.g. MRN, AccountNo, Room-Bed). I’m building translator scripts, and want to perform similar functions. What’s the best way for me to do this?

    As a start, I have the following as an example. in my main(), I have:
    local T = MapData(Data)

    That function looks like:

    function MapData(Data)
       local MsgIn, Name = hl7.parse{vmd='HL7_2.7.vmd', data=Data}
       local T = db.tables{vmd='atables.vmd', name='Message1'}
          
       MapMSH(T, MsgIn)
       MapEVN(T, MsgIn)
       MapPID(T, MsgIn)
       MapPV1(T, MsgIn)
       for i=1, #MsgIn.AL1 do
          MapAL1(T.AL1[i], MsgIn.AL1[i], MsgIn.MSH[10])
       end
       for i=1, #MsgIn.DG1 do
          MapDG1(T.DG1[i], MsgIn.DG1[i], MsgIn.MSH[10])
       end
       if T.MSH[1].MessageType == 'O01' then
          MapOrder(T, MsgIn)
       end
    
       return T
    end

    In MapPID, I have:
    T.PID[1].PatientInternalID = MsgIn.PID[3][1][1]

    If that value is NULL, I want to log that, and drop the message. Thoughts?

    -Robert James,
    Interface Analyst,
    GetWellNetwork, Inc.

    This should be what you are looking for:

    http://help.interfaceware.com/kb/692

    It should be possible to craft a standard shared module which should give you really nice detailed error messages that explain why a message is rejected. You can get quite fancy with it.

    Yes, that is definitely it. I’ll be able to start building that straight away. Thanks!

    -Robert James,
    Interface Analyst,
    GetWellNetwork, Inc.

    Be interesting to see how you format the errors. One could get quite slick with it with a little custom web app…

    My primary reason for the error detection is to log and filter the message. But I’m curious: how would you use a web app in this situation?

    -Robert James,
    Interface Analyst,
    GetWellNetwork, Inc.

You must be logged in to reply to this topic.