Skip to contents

Scans a column's values for standard PII patterns (email, IP address, SSN, credit-card-like). Reports which pattern matched and how many values, never the matching values themselves (so the report does not leak the PII).

Usage

data_check_pii_values(x, broad_min_frac = 0.3)

Arguments

x

a vector (coerced to character)

broad_min_frac

for broad patterns, the minimum fraction of non-empty values that must match for the column to be flagged (currently unused)

Value

list(problem, message, values) – values is the matched pattern name(s), not the data

Details

All current patterns are specific: they flag on a single validated match, because for disclosure one real identifier is already a problem. A raw regex match is necessary but not sufficient – the credit-card pattern must also pass a Luhn checksum, which keeps ordinary numbers from tripping the flag. (A broad-pattern path with a per-column fraction threshold, broad_min_frac, is retained for future patterns but is currently unused.)

Examples

data_check_pii_values(c("ann@example.org", "bob@example.org", "cy@example.org"))$values
#> [1] "email"
data_check_pii_values(c("512", "640"))$problem
#> [1] FALSE