Skip to contents

Matches a column name against tokens that typically identify a person (name, email, address, date of birth, national id, ip, coordinates, ...) in English and the main European languages. Complements data_check_pii_values(): catches identifying columns whose values look ordinary (e.g. a participant_name free-text field).

Usage

data_check_pii_name(col_name)

Arguments

col_name

the column name

Value

list(problem, message, values)

Details

Matching is WORD-based, not substring-based. The name is split into words on separators and camelCase, and a word must EQUAL a token. Three additions keep real names matching:

  • adjacent words are re-joined and tested ("first_name" -> "firstname"), because the token list holds compounds rather than the bare word "name", which would otherwise match trial_name / file_name / condition_name;

  • the whole separator-free name is tested, so languages that compound without separators still match ("telefoonnummer", "geboortedatum");

  • matching is case-insensitive throughout.

Measured against 2113 real column names and a decoy set of ordinary research vocabulary, this cut false positives from 14 to 2 while missing nothing the previous substring rule caught.

Examples

data_check_pii_name("email")$problem
#> [1] TRUE
data_check_pii_name("rt")$problem
#> [1] FALSE