Mask emails for display, and suppress small groups
Task
Mask customers' email addresses for a support screen, then publish survey respondent counts by age band and region with every group under ten suppressed.
Steps
- Save
lab/mask/emails.csvwith headercustomer_id,email_masked, for every customer indata/customers.csv: the address's first character, then***, then the@and the domain. - Count survey respondents in
data/survey.jsonfor each combination of age band and region, and savelab/mask/survey-cells.csvwith headerage_band,region,respondents. - Write every count below 10 as
<10.
Verify
These checks run in a POSIX shell with Python 3: Terminal on macOS or Linux, and on Windows Git Bash (it comes with Git for Windows) or WSL. On Windows, python3 is often a Microsoft Store placeholder that prints “Python was not found”; run alias python3=py in Git Bash first.
grep -c '[*][*][*]@' lab/mask/emails.csv
awk -F, 'NR>1 && $2 !~ /^.[*][*][*]@/' lab/mask/emails.csv | wc -l
awk -F, 'NR>1 && $3=="<10"' lab/mask/survey-cells.csv | wc -l
awk -F, 'NR>1 && $3!="<10" {s+=$3} END {print "shown: "s}' lab/mask/survey-cells.csv
300 masked addresses and 0 left unmasked. 9 of the 20 cells are suppressed, and the published cells show 141 of the 200 respondents. Suppression alone is not enough if totals are published too: 200 minus 141 tells a reader how many are hidden, and a region's total minus its visible cells gives a suppressed cell back.
This is an independent study companion for CompTIA Data+ DA0-002 and is not produced by or endorsed by CompTIA.