Skip to content

Per-filter OPTIONS: set arbitrary leaf properties on the filter a statement

Source: 26-filter-options.phisql

PhiSQL

-- Per-filter OPTIONS: set arbitrary leaf properties on the filter a statement
-- produces — abstract knobs (priority, windowSize, enabled, ignoredFiles) and
-- entity-specific validation flags. Keys are Phileas schema property names; a
-- ('a', 'b') value compiles to an array. Compiles to 26-filter-options.json.

POLICY filter_options;

REDACT CREDIT_CARD WITH MASK
  OPTIONS (onlyValidCreditCardNumbers = TRUE, priority = 10, windowSize = 5, ignoredFiles = ['allowlist.txt']);

DEFINE DICTIONARY 'meds' TERMS ('aspirin')
  WITH REDACT
  OPTIONS (files = ['meds.txt'], enabled = TRUE, priority = 3);

IGNORE TERMS ('Acme Corp') OPTIONS (name = 'org-allowlist', caseSensitive = TRUE);

IGNORE PATTERN '[0-9]{4}' OPTIONS (name = 'four-digits');

Compiles to

{
  "identifiers": {
    "creditCard": {
      "creditCardFilterStrategies": [
        { "strategy": "MASK" }
      ],
      "onlyValidCreditCardNumbers": true,
      "priority": 10,
      "windowSize": 5,
      "ignoredFiles": [ "allowlist.txt" ]
    },
    "dictionaries": [
      {
        "classification": "meds",
        "terms": [ "aspirin" ],
        "customFilterStrategies": [
          { "strategy": "REDACT" }
        ],
        "files": [ "meds.txt" ],
        "enabled": true,
        "priority": 3
      }
    ]
  },
  "ignored": [
    { "terms": [ "Acme Corp" ], "name": "org-allowlist", "caseSensitive": true }
  ],
  "ignoredPatterns": [
    { "pattern": "[0-9]{4}", "name": "four-digits" }
  ]
}