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 check | Label needs | Examples |
|---|---|---|
| A real check (a checksum, a date or a region code) | the values alone | email, credit card, IBAN, Aadhaar, Indonesian NIK, NPWP and NIP |
| A shape only | the values and a word in the column name | US SSN (ssn), PAN (pan), BPJS number (13 digits, bpjs), KK (kk), passport, vehicle plates |
| No value pattern | a word in the column name and a simple value check | religion (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 asid,kode,status,notesorchannelin the name stops this:kode_kotaholds codes andsales_channelholds 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
statusin the column name) or look like addresses: a street word such asJl.,RT,streetorroadwith a number, or two address words.Invoice No 1000is 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,numandnoin a column name do not make a match more certain. They say how a value is written, not what it is. A column calledcontact_numberthat holds phone numbers is labelledPHONE_NUMBERonly when all, or nearly all, of the values read are phone numbers;mobile_phoneorno_hpgets the label as before. - A column whose name has the word
cif,nik,account,acct,rekeningornorekis never labelledPHONE_NUMBER, unless the name also has a phone word. Socif_number, holding 10-digit customer ids, gets no phone label, whilecif_phoneornik_hpholding phone numbers keeps it. The phone words are the ones DataDios's phone checks look for (such asphone,mobile,cell), plustel,telp,hp,nohp,handphone,phonenumberandmobileno. A name such ascif_contactornik_cellnogets no phone label. The words must stand alone:cif_numberandCIF_NUMBERmatchcif,cifnumberdoes not. Dates such as9999-12-31 00:00:00never 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).
| Column | Result | Why |
|---|---|---|
customer_name, mother_name, first_name, nama_lengkap, nama_nasabah, nama_ibu_kandung | PERSON, even when only some of the values read as names | The main word is a person word (customer, mother, nasabah, ibu, ...) |
village, customer_city_name, nama_cabang, nama_desa_nasabah | never PERSON | The 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_name | decided by the values alone, as for any other column | The 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:
| Column | Label | Why |
|---|---|---|
email, user_email, email_address | EMAIL_ADDRESS | The name ends in the hint word email, or in email plus a filler word (see below) |
mobile_phone, phone_number | PHONE_NUMBER | The name ends in the hint word phone, or in phone plus a filler word |
email_status, phone_type, email_count | none | The 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 word | Label |
|---|---|
email | EMAIL_ADDRESS |
phone, telephone | PHONE_NUMBER |
iban | IBAN_CODE |
ssn | US_SSN |
aadhaar | IN_AADHAAR |
npwp | ID_NPWP |
nik, ktp | ID_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: a label for a country outside PII_COUNTRY_SCOPE is not reported, and a
hint for it is ignored. For the setting, the country codes and how to apply it, see
Limit which countries' formats are checked.
The catalog tag each label becomes, such as pii-id-nik, is listed there too.
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.
| Setting | Default | What 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. Solegal idcoversCUSTOMER_LEGAL_IDandLEGAL_ID_NO, but notLEGAL_ID_STATUSorLEGAL_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 aname_aloneword 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, orbank. 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.