Loading TOC...

ordt:redact-us-ssn

ordt:redact-us-ssn(
   $column as item(),
   $options as map:map?
) as map:map

Summary

This function redacts a column with a 9-digit US SSN (Social Security Number) string by generating random numbers or replacing numbers with a masking character. This function can be used with op:bind or op:select.

Parameters
$column The name of the column to be redacted. This can be either a string or the return value from op:col, op:view-col, or op:schema-col.
$options The options for masking the value the column.

Usage Notes

The redacted column may have a US SSN value with any of the following formats:

The options consist of the following properties:

Example

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

import module namespace ordt="http://marklogic.com/optic/redaction"
     at "/MarkLogic/optic/optic-redaction.xqy";

op:from-view("main", "employees")
   => op:bind((
      ordt:redact-us-ssn(op:schema-col("main", "employees", "taxid"), map:entry("level","partial")=>map:with("character","x"))
      ))
   => op:result()
  

Example

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

import module namespace ordt="http://marklogic.com/optic/redaction"
     at "/MarkLogic/optic/optic-redaction.xqy";

op:from-view("main", "employees")
   => op:select((
      ordt:redact-us-ssn(op:schema-col("main", "employees", "taxid"), map:entry("level","partial")=>map:with("character","x"))
      ))
   => op:result()
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.