Skip to main content

PII classification in profiles

When DataDios profiles a PostgreSQL, MySQL, Oracle, or SQL Server table, it labels the columns that hold personal data (for example EMAIL_ADDRESS, PHONE_NUMBER, ID_NIK). The label shows in the profile and as a classification on the column in the catalog.

How a column gets its label​

The values decide, and for some types the column name has to agree. DataDios reads up to 100 values of the column and checks them for personal data. A column is labelled when enough of those values match. How much the values prove depends on the type:

Type of checkLabel needsExamples
A real check (a checksum, a date or a region code)the values aloneemail, credit card, IBAN, Aadhaar, Indonesian NIK, NPWP and NIP
A shape onlythe values and a word in the column nameUS SSN (ssn), PAN (pan), BPJS number (13 digits, bpjs), KK (kk), passport, vehicle plates
No value patterna word in the column name and a simple value checkreligion (agama with Islam, Kristen, ...), marital status, gender, bank account (rekening), health data, criminal record

So 13 digits in a column called no_bpjs are labelled a BPJS number, and the same digits in order_ref are not labelled. NIKs in a column called legal_id_no are labelled on their values. The words must stand alone in the name: customer does not count as us. One exception, for types found by their value shape and a column word: a word of 3 or more letters also counts when it is joined to a known part, such as no, id or customer. So PANNO, PASSPORTNO, VOTERID and CUSTOMERSSN get their labels. Shorter words such as kk and dl must stand alone.

Names and places. A column is labelled PERSON or LOCATION when one of these holds:

  • The name has a word that means people or places (mother, petugas, alamat, kota) and the values look like words, not codes. A word such as id, kode, status, notes or channel in the name stops this: kode_kota holds codes and sales_channel holds channels.
  • The name has a general word (name, nama, customer) and the name and place detection agrees.
  • The name and place detection finds names or places in most of the values. For Indonesian data this includes a model that reads names written in capitals, such as AGUS HIDAYAT.
  • For places only: the values are known place names (at least three different ones, and no word such as status in the column name) or look like addresses: a street word such as Jl., RT, street or road with a number, or two address words. Invoice No 1000 is not an address.

Company, school, hotel, office and product names (values with PT, Tbk, Ltd, school, hotel, KC, Polsek, tabungan) are not labelled PERSON. A column of flags or plain numbers (Y/N, 10) is not health data or a criminal record, whatever its name.

The profile's signals say what decided a label: presidio:<TYPE> for a value check, catalog:<TYPE> for a check that also used the column name or the name and place rules, and name:<TYPE> for a column with no values (below).

Two name rules keep customer ids from being labelled as phone numbers:

  • The words number, num and no in a column name do not make a match more certain. They say how a value is written, not what it is. A column called contact_number that holds phone numbers is labelled PHONE_NUMBER only when all, or nearly all, of the values read are phone numbers; mobile_phone or no_hp gets the label as before.
  • A column whose name has the word cif, nik, account, acct, rekening or norek is never labelled PHONE_NUMBER, unless the name also has a phone word. So cif_number, holding 10-digit customer ids, gets no phone label, while cif_phone or nik_hp holding phone numbers keeps it. The phone words are the ones DataDios's phone checks look for (such as phone, mobile, cell), plus tel, telp, hp, nohp, handphone, phonenumber and mobileno. A name such as cif_contact or nik_cellno gets no phone label. The words must stand alone: cif_number and CIF_NUMBER match cif, cifnumber does not. Dates such as 9999-12-31 00:00:00 never count as phone numbers.

When DataDios is upgraded to a version with these rules, every profiled column is classified again on its next profile, so a label can change without any change to the data.

For personal names, the column name moves the bar. The language model that spots names is built for English and misses many Indonesian names, especially ones written in capitals. It also reads some place names, such as village names, as people. So DataDios looks at the main word of the column name: the word before name, or the word after a leading nama (Indonesian puts the word for name first).

ColumnResultWhy
customer_name, mother_name, first_name, nama_lengkap, nama_nasabah, nama_ibu_kandungPERSON, even when only some of the values read as namesThe main word is a person word (customer, mother, nasabah, ibu, ...)
village, customer_city_name, nama_cabang, nama_desa_nasabahnever PERSONThe main word is a place word (village, city, cabang, desa, ...), so a value such as Coblong is not taken for a person
parent_name, customer_company_name, branch_manager_namedecided by the values alone, as for any other columnThe main word is neither a person nor a place word

A person-named column is labelled when about 15% of its values read as personal names. Any other column needs roughly half. The name never labels a column on its own: a person-named column with no value that reads as a name stays unlabelled. A place-named column is not labelled as a place either. The person and place words are fixed in DataDios; unlike name hints, the administrator file below does not change them.

A column with no values is labelled from its name. A table loaded without data has nothing to read, so the values cannot decide. For a column with no readable value, DataDios looks the column name up in a table of name hints. In an empty table:

ColumnLabelWhy
email, user_email, email_addressEMAIL_ADDRESSThe name ends in the hint word email, or in email plus a filler word (see below)
mobile_phone, phone_numberPHONE_NUMBERThe name ends in the hint word phone, or in phone plus a filler word
email_status, phone_type, email_countnoneThe name ends in another word, so it holds a status, a type, or a count

The name guess is used only when DataDios has read the whole table and found no value in the column: fewer than 100 rows were read and none holds a value. It is not used when:

  • the sample could not be read (a timeout or an error),
  • the table has more than 1,000,000 rows or (PostgreSQL only) holds more than 1 GiB of data (counting long text stored outside the row, not indexes), so it was read through a sample,
  • the sample came back full (100 rows), because more rows exist than were read.

In those cases the column stays unlabelled. A table that was empty at its last profile is classified again as soon as it has rows, so the values replace a name guess once data arrives.

A small table that already has rows can still have a column with no values. That column also gets the name label, and the label stays until the table's columns change or DataDios is upgraded to a version that changes classification: values that arrive later do not replace it.

A label that comes from the name is marked name:<TYPE> in the profile's signals and carries half the minimum confidence. In the catalog it looks the same as a label from values.

After an upgrade that changes how columns are classified, DataDios classifies every profiled table again once, on its next profile, so labels can change for tables you profiled before.

The shipped name hints​

Hint wordLabel
emailEMAIL_ADDRESS
phone, telephonePHONE_NUMBER
ibanIBAN_CODE
ssnUS_SSN
aadhaarIN_AADHAAR
npwpID_NPWP
nik, ktpID_NIK

A hint applies to a column when every word of the hint is in the column name and the name's last word is one of them. Filler words at the end of the name are skipped first: address, addr, number, num and no, so email_address, phone_no and NIK_NUM count as email, phone and nik. code is not a filler, so phone_country_code has no hint. Words are split at underscores, spaces, hyphens, dots, digits and capital letters, so ContactEmail, contact_email and CONTACT EMAIL are the same, and PANNo is pan plus no.

A label also has to be allowed where you run DataDios. PII_COUNTRY_SCOPE is a setting on the deployment, set where your .env or docker-compose file lives (the compose files DataDios ships pass it through). It is a comma-separated list of country prefixes, for example ID or ID,US. Empty (the default) means IN,ID,US, and * keeps every country. Recognizers for a country that is not in the list are not reported, and a hint for such a country is ignored. Recognizers that belong to no country (email, phone, IBAN, credit card, person) always run.

For administrators: add your own column-name words​

Your data may use names the shipped words do not cover, for example legal_id for a national ID number. Point DataDios at a JSON file of extra words with the environment variable PII_NAME_HINTS_FILE. It is set wherever your .env or docker-compose file lives. The compose files DataDios ships (docker-compose-on-prem.yaml, docker-compose-on-prem-internal.yaml, and the testing file) pass it through, and it is empty by default.

SettingDefaultWhat it does
PII_NAME_HINTS_FILE(empty)Path, inside the container, of a JSON file that adds words to DataDios's PII catalog. Empty means the shipped words only.

The file lists the types to add words to. name_alone words label a column that has no values (as the hint words above do). On a column with values they count like keywords, and the values must still match. keywords are the column-name words a type with only a shape check needs:

{
"types": [
{"entity": "ID_NIK", "name_alone": ["legal id"]},
{"entity": "ID_BPJS_KESEHATAN", "keywords": ["jaminan"]}
]
}
  • A phrase with several words applies when every word is in the column name and, for name_alone, the name's last word is one of them, after the filler words above are skipped. So legal id covers CUSTOMER_LEGAL_ID and LEGAL_ID_NO, but not LEGAL_ID_STATUS or LEGAL_ID_CODE.
  • The file can only add words or new types. It cannot remove a shipped word or change how a shipped type is checked.
  • A file in the older format ({"legal_id": "ID_NIK"}) still works: each word is read as a name_alone word of its type, and the server log warns you to rewrite the file in this format.
  • A file that cannot be read, is in neither format, or has an invalid type is skipped with a warning in the server log, and the shipped words still apply.
  • Do not add generic words such as account, card, number, id, no, code, date, address, or bank. They sit on columns that are not personal data (account_id, card_id), and a name hint labels a column even when it holds nothing.
  • The file is read once when the server starts, so restart the server after changing it. A changed file counts as a new classifier version, so every profiled column is classified again on its next profile.

Mount the file into the container and set the variable to its path inside the container.