Conditional (ConditionalGenerator)

The Conditional generator applies different generators to the value conditionally based on any value in the table.

You do not configure consistency or differential privacy for the Conditional generator.

The metadata object is populated from the ConditionalMetadata object.

The defaultGenerator object specifies the generator to apply if none of the conditions are met. It includes a condition object with an empty list of conditions.

The conditionalGenerators object contains the generators to apply based on one or more conditions. For each entry in conditionalGenerators, you identify and configure the generator, and provide the conditions to meet in order to apply that generator. The conditions can be joined by AND or OR.

Each condition identifies the column for which to check the value, the type of check, the value to check, and the type of data in the column that is checked.

{
  "schema": "string",
  "table": "string",
  "column": "string",
  "dataType": "string",  //MongoDB only
  "metadata": {
    "generatorId": "ConditionalGenerator",
    "presetId": "ConditionalGenerator",
    "customValueProcessor": "string", //If custom value processor applied
    "defaultGenerator": {
      "metadata": {
        "presetId": "string",
        "generatorId": "string",
        //Metadata for the selected generator
      },
      "condition": {
          "op": "AND",
          "conditions": []
    },
    "conditionalGenerators": [
      {
        "metadata": {
          "presetId": "string",
          "generatorId": "string",
          "customValueProcessor": "string", //If custom value processor applied
          //Metadata for the selected generator
        },
        "condition": {
          "op": "enum",
          "conditions": [
            {
              "col": "string",
              "op": "enum",
              "val": "string",
              "colDataType": "string"
            }
          ]
        }
      }
    ]
  }
}

Example replacement

In the following example replacement for the Conditional generator, the default generator is the Address generator, which is configured with the zip code as the address type.

The column being configured is column1.

If column1 contains the value VALUE and column2 is not NULL, then the Random Integer generator is applied to column1. It applies a value between 0 and 10.

If column4 contains a value that matches the regular expression .*, then the Categorical generator is applied to column1. epsilon is 1, and differential privacy is disabled.

{
  "name": "column1",
  "table": "consistency",
  "schema": "public",
  "links": [
    {
      "column": "column1",
      "schema": "public",
      "table": "consistency",
      "metadata": {
        "generatorId": "ConditionalGenerator",
        "presetId": "ConditionalGenerator",
        "defaultGenerator": {
          "metadata": {
            "presetId": "AddressGenerator",
            "generatorId": "AddressGenerator",
            "addressType": "ZipCode",
            "isConsistent": false
          }
        },
        "conditionalGenerators": [
          {
            "metadata": {
              "presetId": "RandomIntegerGenerator",
              "generatorId": "RandomIntegerGenerator",
              "min": 0,
              "max": 10
            },
            "condition": {
              "op": "AND",
              "conditions": [
                {
                  "col": "column1",
                  "op": "contains",
                  "val": "VALUE",
                  "colDataType": "integer"
                },
                {
                  "col": "column2",
                  "op": "is not NULL",
                  "colDataType": "integer"
                }
              ]
            }
          },
          {
            "metadata": {
              "presetId": "CategoricalGenerator",
              "generatorId": "CategoricalGenerator",
              "epsilon": 1,
              "isDifferentiallyPrivate": false
            },
            "condition": {
              "op": "AND",
              "conditions": [
                {
                  "col": "column4",
                  "op": "regex",
                  "val": ".*",
                  "colDataType": "character varying"
                }
              ]
            }
          }
        ]
      }
    }
  ]
}

Last updated