iNTERFACEWARE Products Manual > Installing and Using Chameleon > Using Python Scripting > Python Scripting Examples > Message Manipulation > Filtering Messages |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
In Chameleon, you can use a Python script to filter incoming messages based on the data contained in one or more fields of a segment. Suppose, for example, that you are processing a series of ADT^A04 (Register a Patient) messages and you want your system to ignore any patient registrations that occurred before January 1, 2000. To do this, you need to create a Python script that examines the event date of each message and flags the obsolete registrations. The following Global Inbound Script can handle this task for you:
This code looks for all messages whose EVN.6 field is a date earlier than January 1, 2000. When it finds such a message, it modifies the MSH.9 field to be "ADT^A04^IGNORE". The next step is to create two message definitions in your VMD file:
Note that the message definition file specifies that the ADT^A04^IGNORE message identity is to be tried first. This ensures that modified messages are caught by this message definition and then ignored. For more information on specifying the message order in a message definition file, see Defining the Matching Order of Message Definitions. |