# Setting Up Anonymization (PII) and Custom Recognizer

## Masking Personal Identifiable Information (PII) for Data Source Fields

See also: [**Masking PII**](https://docs.aisera.com/aisera-platform/tenant-setup/security-and-privacy-traps/masking-pii)

To configure masking of PII for data source fields:

1. Navigate to the **Settings > Data Sources** menu of the Aisera Administration application to specify your data source configuration.\ <br>

   <figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FD6NVqwgHDtvWWwxaaQ8u%2Fdata_sources4.png?alt=media&#x26;token=c57ae723-1390-490e-b71e-d59bc23deba6" alt="" width="380"><figcaption></figcaption></figure>

   \ <br>
2. Select the embedded application for which you want to mask fields in the data source. \ <br>

   <figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FuMQv0j6J7XxeW9qERKyf%2Fdata_source3.png?alt=media&#x26;token=942c9271-ddd5-42ba-9539-4a39f6358e29" alt="" width="563"><figcaption></figcaption></figure>

   \
   The PII configuration is set at the field level for each data source.  <br>
3. Hover your cursor over the lower-right section of the window to see the edit button for the field you want to configure.

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FZQMQRVYcS3TT4OKUfTDI%2Fdata_source_fields.png?alt=media&#x26;token=42090a90-c6f8-419c-b7ed-4b48e1a923c3" alt="" width="563"><figcaption></figcaption></figure>

The following screenshot shows the **Description** field with masking applied to it for a few standard entities.

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FfojZoCQy85F71cVnAeM9%2Fmasking_data_source_fields.png?alt=media&#x26;token=4ea80fdc-5b82-4cb5-86fd-8c1b85dbf824" alt="" width="563"><figcaption></figcaption></figure>

Here’s a template you can use that will identify and scrub the following out-of-the-box entities:

* PERSON
* PHONE
* EMAIL
* CREDIT CARD

The fields that need to be masked should be included in the **AnalyzeTemplate** object and the value it will be masked with should be added to the **AnonymizeTemplate** object.

`{ "AnalyzeTemplate": { "fields": [ { "name": "PERSON" }, { "name": "PHONE_NUMBER" }, { "name": "EMAIL_ADDRESS" }, { "name": "CREDIT_CARD" } ] }, "AnonymizeTemplate": { "fieldTypeTransformations": [ { "fields": [ { "name": "PERSON" } ], "transformation": { "replaceValue": { "newValue": "<PERSON>" } } }, { "fields": [ { "name": "PHONE_NUMBER" } ], "transformation": { "replaceValue": { "newValue": "<PHONE_NUMBER>" } } }, { "fields": [ { "name": "EMAIL_ADDRESS" } ], "transformation": { "replaceValue": { "newValue": "<EMAIL_ADDRESS>" } } }, { "fields": [ { "name": "CREDIT_CARD" } ], "transformation": { "replaceValue": { "newValue": "<CREDIT_CARD>" } } } ] } }`

\
For entities that are not available as out-of-the-box entities, you will need to create a **custom recognizer** and specify the exact pattern of the data.

For example: Server id can consist of more than 12 alphanumeric characters and some special characters or has the format ID-12345678. So you have to provide the pattern for each of these entities.&#x20;

If a pattern is too generic, such as 8 numbers, then we cannot create a custom recognizer because it will have a lot of false positives.
