# How to Use a Classification Framework with Your Own Tags

After you have registered data sources in Immuta, you can start automating data classification of a column based on its context, which is the combination of

* associated tags already applied to the column
* tags applied to the neighboring columns and
* table tags on the data source.

The starter framework in this how-to is built to map a classification scale of restricted, confidential, internal, and public to Immuta's three-level scale of sensitivity. The sensitivity in the classification tags will then appear in [data source and query event dashboards](https://documentation.immuta.com/saas/govern/detect-your-data/detection/detect-concept#audit-dashboards-with-classification).

Follow this guide to map your tags to the example framework, or consult the [framework API guide](https://documentation.immuta.com/saas/developer-guides/api-intro/immuta-v1-api/configure-your-instance-of-immuta/frameworks) for more information about the framework schema.

### Customize the framework

Using the example framework below, customize the framework for your organization's classification tags:

<pre class="language-json"><code class="lang-json">{
  "shortName": "ECMC Framework",
  "name": "External Catalog Mapping Classification Framework",
  "description": "This framework maps the classification tags the organization has in Collibra to Immuta data sources.",
  "<a data-footnote-ref href="#user-content-fn-1">tags</a>": [
    {
      "name": "ECMC.Confidentiality.Highly Sensitive",
      "source": "curated",
      "<a data-footnote-ref href="#user-content-fn-2">sensitivities</a>": [
        {
          "<a data-footnote-ref href="#user-content-fn-3">dimension</a>": "confidentiality",
          "<a data-footnote-ref href="#user-content-fn-4">sensitivity</a>": 2
        }
      ]
    },
    {
      "name": "ECMC.Confidentiality.Sensitive",
      "source": "curated",
      "sensitivities": [
        {
          "dimension": "confidentiality",
          "sensitivity": 1
        }
      ]
    },
    {
      "name": "ECMC.Confidentiality.Nonsensitive",
      "source": "curated",
      "sensitivities": []
    }
  ],
  "<a data-footnote-ref href="#user-content-fn-5">rules</a>": [
    {
      "name": "ECMC 00001",
      "<a data-footnote-ref href="#user-content-fn-6">classificationTag</a>": {
        "name": "ECMC.Confidentiality.Highly Sensitive",
        "<a data-footnote-ref href="#user-content-fn-7">source</a>": "curated"
      },
      "<a data-footnote-ref href="#user-content-fn-8">columnTags</a>": [
        {
          "name": "Restricted",
          "source": "collibra"
        }
      ],
      "<a data-footnote-ref href="#user-content-fn-9">neighborColumnTags</a>": [],
      "<a data-footnote-ref href="#user-content-fn-10">tableTags</a>": []
    },
    {
      "name": "ECMC 00002",
      "classificationTag": {
        "name": "ECMC.Confidentiality.Sensitive",
        "source": "curated"
      },
      "columnTags": [
        {
          "name": "Confidential",
          "source": "collibra"
        }
      ],
      "neighborColumnTags": [],
      "tableTags": []
    },
    {
      "name": "ECMC 00003",
      "classificationTag": {
        "name": "ECMC.Confidentiality.Sensitive",
        "source": "curated"
      },
      "columnTags": [
        {
          "name": "Internal",
          "source": "collibra"
        }
      ],
      "neighborColumnTags": [],
      "tableTags": []
    },
    {
      "name": "ECMC 00004",
      "classificationTag": {
        "name": "ECMC.Confidentiality.Nonsensitive",
        "source": "curated"
      },
      "columnTags": [
        {
          "name": "Public",
          "source": "curated"
        }
      ],
      "neighborColumnTags": [],
      "tableTags": []
    }
  ],
  "<a data-footnote-ref href="#user-content-fn-11">active</a>": true
}
</code></pre>

#### Parameters

For more information about these parameters see the [Frameworks API reference guide](https://documentation.immuta.com/saas/developer-guides/api-intro/immuta-v1-api/configure-your-instance-of-immuta/frameworks#framework-payload).

1. `tags`: These tags are automatically created in Immuta with the sensitivity you assign. They must not already exist in Immuta. All tags used in the `classificationTag` parameter should be defined here.
2. `tags.sensitivities`: This is metadata for the sensitivity of the new tag. Use `confidentiality` for `dimension`. Options for `sensitivity` are `1` (shown as sensitive in audit dashboards) and `2` (shown as highly sensitive in audit dashboards). For nonsensitive, leave this parameter empty.
3. `rules`: These are the rules for applying the `tags` defined above. Each rule contains the classification tag to apply if the requirements are met and the requirements: the column tags, neighboring column tags, and table tags that must be present. All requirements within each defined rule must be met for the classification tag to be applied.
4. `rules.classificationTag`: The name and source of the tag you want applied if the rule requirements are met. This classification tag must be defined in `tags`. The `source` is `curated`.
5. `rules.columnTags`: These are the required tags for a column. If the tags defined here are found on a column, and the other tag rules are met, then the rule's `classificationTag` will be applied to the same column.
6. `rules.neighborColumnTags`: These are the required tags on other columns in the data source (or in the query if dynamic query classification is enabled). If the tags defined here are found on any column in the data source, and the other tag rules are met, then the rule's `classificationTag` will be applied to all the neighboring columns.
7. `rules.tableTags`: These are the required tags on the data source. If the tags defined here are found on the data source, and the other tag rules are met, then the rule's `classificationTag` will be applied to all the columns in that data source.
8. `active`: When `true` the framework is active and will apply tags when the rules are met.

### How to edit rules

Follow the example below to map your tags to the rules in the example framework.

This example framework has a rule where columns tagged `DSF.Interpretation.Credentials.Secret` by identification will be tagged `RAF.Confidentiality.High`:

```json
"rules": [
{
    "name": "RAF 00004",
    "classificationTag": {
      "name": "RAF.Confidentiality.High",
      "source": "curated"
    },
    "columnTags": [
    {
        "name": "DSF.Interpretation.Credentials.Secret",
        "source": "curated"
    }
    ],
    "neighborColumnTags": [],
    "tableTags": []
}
]
```

To translate this to your tags, replace the name and source value of the `columnTags`, `neighborColumnTags`, or `tableTags` with your own. This new example is for a Collibra tag from the external catalog that an organization uses for confidential data. This rule now states: Apply the classification tag `RAF.Confidentiality.High` to a column if it has the `collibra` tag `Confidential`. Repeat this for your organization's remaining classification levels.

```json
"rules": [
{
    "name": "RAF 00004",
    "classificationTag": {
      "name": "RAF.Confidentiality.High",
      "source": "curated"
    },
    "columnTags": [
    {
        "name": "Confidential",
        "source": "collibra"
    }
    ],
    "neighborColumnTags": [],
    "tableTags": []
}
]
```

### Find the `name` and `source` for your tags

If you do not know the `name` or `source` for your tags, you can list your tags using the Immuta API:

```bash
curl \
    --request GET \
    --header "accept: application/json" \
    --header "Authorization: Bearer <your-token." \
    https://your-immuta-url.com/tag
```

This request will list all the tags in your Immuta environment, similar to this example response:

```json
[
  {
    "id": 114,
    "name": "DataProperties.Cross-Sectional",
    "source": "curated",
    "deleted": false,
    "systemCreated": true
  },
  {
    "id": 2,
    "name": "Discovered.Country.Argentina",
    "source": "curated",
    "deleted": false,
    "systemCreated": true
  },
  {
    "id": 9,
    "name": "Discovered.Country.Australia",
    "source": "collibra",
    "deleted": false,
    "systemCreated": true
  }
]
```

### Activate your new framework

**Requirement**: Immuta permission `GOVERNANCE`

Once you have made all the customizations to the example framework, make the following request using the Immuta API, with your full customized framework as the payload.

```bash
curl \
    --request POST \
    --header "Content-Type: application/json" \
    --header "Authorization: Bearer <your-token>" \
    --data @example-payload.json \
    https://your.immuta.com/frameworks/
```

Your new framework will now be visible in the Immuta UI by navigating the Classification section.

[^1]: These tags are automatically created in Immuta with the sensitivity you assign. All tags used in the `classificationTag` parameter should be defined here.

[^2]: This is metadata for the sensitivity of the new tag.

[^3]: Use `confidentiality` for `dimension`.

[^4]: Options for `sensitivity` are `1` (shown as sensitive in audit dashboards) and `2` (shown as highly sensitive in audit dashboards). For nonsensitive, leave this parameter empty.

[^5]: These are the rules for applying the `tags` defined above.

[^6]: This classification tag must be defined in `tags`. This is the tag that will be applied if the rule requirement is met.

[^7]: The `source` is `curated`.

[^8]: This object represents tags on a column. If the tag defined here is found on a column, then the rule's `classificationTag` will be applied to the same column.

[^9]: This object represents tags on other columns in the data source. If the tag defined here is found on any column in the data source, then the rule's `classificationTag` will be applied to all the neighboring columns.

[^10]: This object represents tags on the data source. If the tag defined here is found on the data source, then the rule's `classificationTag` will be applied to all the columns in that data source.

[^11]: When `true` the framework is active and will apply tags when the rules are met.
