Skip to content

Custom dictionary: detect a user-defined list of terms and redact them

Source: 22-custom-dictionary.phisql

PhiSQL

-- Custom dictionary: detect a user-defined list of terms and redact them.
-- FUZZY enables approximate matching; SENSITIVITY tunes how strict it is
-- (one of auto, off, low, medium, high). Compiles to 22-custom-dictionary.json.

POLICY custom_dictionary;

DEFINE DICTIONARY 'medications'
  TERMS ('aspirin', 'ibuprofen', 'metformin')
  FUZZY SENSITIVITY medium
  WITH REDACT;

Compiles to

{
  "identifiers": {
    "dictionaries": [
      {
        "classification": "medications",
        "terms": [ "aspirin", "ibuprofen", "metformin" ],
        "fuzzy": true,
        "sensitivity": "medium",
        "customFilterStrategies": [
          { "strategy": "REDACT" }
        ]
      }
    ]
  }
}