Skip to content

Tilda JSON Syntax: Field Masking

Laurent Hasson edited this page Jun 22, 2022 · 1 revision

<-- Object Syntax

<-- View Syntax

Masks

Tilda is often used in web apps or other data integration environments and provides the ability to export data as JSON and/or CSV to generate data files for example, or return data to a browser. Sometimes, some values may need to be masked: for example, a user may not have enough rights to see some contents, or data needs to be exported in a way that doesn't expose some information. In a healthcare environment for example, a physician may have access to some notes about a patient, but not others, such as HIV status or mental health diagnoses. An application would be responsible for determining what conditions arise requiring masking, but the masking logic should be integral to the data model definition out of the box. With this feature, you can define a masking policy.

     ,"masks":[
         { "columns":["colA", "colB", "col123*"], "mask":"******" }
        ,{ "columns":["txt"]                    , "mask":"CONTENT BLOCKED" }
        ,{ "columns":["id1", "id2"]             , "mask":"-1" }
       ]

Rules:

  • The value of the mask is checked against the type of the column, so providing a mask value of "abc" to an integer field will cause validation to fail.
  • An empty value is accepted for STRING columns, though discouraged in practice.
  • Specifying the same column more than once will fail.
  • The list of columns allow for wildcards as per the standard Tilda rules ('*' alone, at the front or back of a value, never in the middle). Note that the previous rules about duplicates remains enforced if wildcards are employed.
  • Once a column is marked as masked, the property is propagated to sameAs and view columns automatically.
  • The internal state of the object (its data elements) will not change. "Activating" masking will only affect methods that output data from the object, for example, toString, toCSV and toJSON.

The fields are:

  • columns: An array containing one or more column names, including wildcards.
  • mask: a value that is compatible with the type of the column(s) specified.

This feature doesn't affect the schema definition or any SQL-level outputs of the framework and is only used in an application context in Java.

Clone this wiki locally