|
Example: Data ScrubbingOne very useful application of scripted transformation is for building a utility to remove confidential data from a set of HL7 messages. This sample VMD file is a very basic example of how you could begin to remove confidential data from an HL7 message. This VMD file removes Z segments from a stream of HL7 messages and replaces patient name fields with the text string fff. This VMD file provides a default message containing a Python transformation script. This script looks like this:
Transformation Script The key things that this script does:
If you examine the PID-5 outbound script from the PID segment in the GUI, you will see the following script:
PID-5 Outbound Script This is where the data scrubbing is occurring. The script is invoking a global function called scrub_name to change the values in the field object. It also assigns the value variable to the return value of this function. The return value of the function is the first sub-field of the field. The global function scrub_name is defined in the Global Inbound Script window, which you can access by clicking Chameleon > Global Inbound Script. In this window, you will find the following code:
Global Inbound Script This is the function that takes every populated sub-field and translates it to fff. Obviously, this is just a start. A well-developed data scrubber would preserve the coherency of the data: always randomizing strings in same standard way by keeping a hash table of random strings, preserving numerical data as numerical data, and so on. The easiest way to use the data scrubber is to use the msgtransform tool to invoke this scripted transformation on a large batch of messages.
Scrubbing a Data File The original messages should be in the confidential.txt file. The cleaned data will appear in cleaned.txt.
|