HL7 Modules

Filtering Sensitive Demographics from Real Data

Using the scrub.lua module.

The “scrub” module given below redacts sensitive information from HL7 messages. For simplicity, it considers anything not in the MSH or EVN segments to be sensitive. Text is replaced with Xs, and numbers are randomized, while punctuation is preserved. This lets each message retain its shape, while preventing patient data from being exposed.

To use it, you would create a Translator Filter with a script like this:

local scrub = require('scrub')

function main(Data)
   -- Redact sensitive information before enqueuing.
   queue.push{data=scrub.scrub(Data)}
end

For example, if you received a message like this:

MSH|^~&|AcmeMed|Lab|Main HIS|St. Micheals|20110213144932||ADT^A03|9B38584D9903051F0D2B52CC0148965775D2D23FE4C51BE060B33B6ED27DA820|P|2.6|
EVN||20110213144532||||20110213145902|
PID|||4525285^^^ADT1||Smith^Tracy||19980210|F||Martian|86 Yonge St.^^ST. LOUIS^MO^51460|||||||10-346-6|284-517-569|
NK1|1|Smith^Gary|Second Cousin|
PV1||E||||||5101^Garland^Mary^F^^DR|||||||||||1318095^^^ADT1|||||||||||||||||||||||||20110213144956|
OBX|||WT^WEIGHT||102|pounds|
OBX|||HT^HEIGHT||32|cm|

You would enqueue the following scrubbed version:

MSH|^~&|AcmeMed|Lab|Main HIS|St. Micheals|20110213144932||ADT^A03|9B38584D9903051F0D2B52CC0148965775D2D23FE4C51BE060B33B6ED27DA820|P|2.6|
EVN||20110213144532||||20110213145902|
PID|||8049867^^^BBB8||CCCCC^DDDDD||56789452|E||FFFFFFF|37 GGGGG HH.^^II. JJJJJ^KK^88837|||||||75-960-9|585-228-515|
NK1|3|LLLLL^MMMM|NNNNNN OOOOOO|
PV1||P||||||8760^QQQQQQQ^RRRR^S^^TT|||||||||||2886410^^^UUU8|||||||||||||||||||||||||85928830835901|
OBX|||VV^WWWWWW||997|XXXXXX|
OBX|||YY^ZZZZZZ||99|[[|

Here is a project you can load scrub_Filter.zip.

Get the latest version of the scrub.lua module from our repository.

Leave A Comment?