🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Data Science & Analytics › Ethics & Privacy in Data Science and Analytics › Lesson 5
TEC-DATA85-10 · Lesson 5 · 14 clock hours · lab

Anonymization, Pseudonymization, and Aggregation Techniques

Objective. Students will apply at least four de-identification techniques — direct identifier removal, generalization, suppression, and k-anonymity — to a provided dataset in Python or R, and measure the resulting re-identification risk and information loss.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

Why De-Identification Matters

Data science work frequently involves personal information: patient records, financial histories, location traces, and more. Publishing or sharing such data without care can expose individuals to discrimination, identity theft, or other harms. Federal law (including HIPAA for health data) and widely adopted frameworks such as NIST SP 800-188 establish that organizations must actively reduce re-identification risk before releasing or analyzing sensitive datasets. De-identification is not just a legal checkbox — it is a professional and ethical responsibility every data analyst carries.

Safety Note: Treat Synthetic Data as Though It Were Real

This lab uses a synthetic dataset, but the habits you build here must transfer to live data environments. When working with real personal data, always follow your organization's data-handling policy: store files on approved systems only, do not copy data to personal devices or accounts, and lock your workstation when stepping away. If you accidentally encounter genuinely sensitive records, report the situation to your supervisor immediately rather than proceeding on your own.

Direct Identifier Removal

Direct identifiers are attributes that, on their own, point to a specific individual: full name, Social Security Number (SSN), exact address, phone number, email, and similar fields. The first and simplest de-identification step is to drop these columns entirely before any analysis or sharing occurs. In pandas, `df.drop(columns=['name','ssn','address'], inplace=True)` removes them from the working DataFrame. Removal alone is usually insufficient — remaining fields can still allow re-identification when combined.

Generalization

Generalization replaces a precise value with a less precise but still useful range or category. Two common examples in health data:

Generalization is a deliberate trade-off: the coarser the value, the lower the re-identification risk, but also the lower the analytical utility.

Suppression

Suppression removes individual records (rows) or specific cells that are so unique they cannot be protected adequately through generalization alone. For example, if only one person in the dataset has a particular combination of age band, ZIP prefix, and diagnosis, no reasonable amount of generalization will hide them. Suppressing that row prevents disclosure at the cost of losing that data point entirely. Track every suppressed record in your lab log so you can report the total information loss accurately.

k-Anonymity

k-Anonymity is a formal privacy model introduced by Latanya Sweeney. A dataset satisfies k-anonymity if every combination of quasi-identifier values appears in at least k records. Quasi-identifiers are fields that are not direct identifiers but can be combined to re-identify someone — age band, ZIP prefix, sex, and diagnosis category are typical examples.

With k = 5, no group of records sharing the same quasi-identifier pattern is smaller than five people. An attacker cannot narrow their guess below one in five. To verify k-anonymity in pandas, you group by all quasi-identifier columns and count the size of each group, then check whether any group has fewer than k records. Groups that fall below the threshold must be fixed through additional generalization or suppression before the dataset is considered safe to share.

Higher values of k offer stronger protection but cause more information loss. Choosing k is itself an ethical and business decision that should be documented.

Measuring Re-Identification Risk and Information Loss

After applying techniques, you need to quantify two things:

1. Re-identification risk: The proportion of records that still fall into a group smaller than your k threshold. Zero records below the threshold means k-anonymity is met.

2. Information loss: Compare key summary statistics on the original and de-identified datasets — for instance, mean age by diagnosis group. A small percentage difference (say, under 5%) suggests acceptable utility loss; a large difference signals that the generalization was too aggressive for the intended analytical purpose.

NIST SP 800-188 provides practical guidance on selecting and documenting these measurements. The ARX Data Anonymization Tool can serve as an independent cross-check: load your de-identified CSV into ARX and confirm that the tool reports k-anonymity as satisfied.

Pseudonymization vs. Anonymization

Pseudonymization replaces direct identifiers with a consistent artificial token (a pseudonym) rather than removing the link entirely. A lookup table kept separately can re-link the token to the real identity. This is useful when a downstream process must later reconnect records to individuals (e.g., longitudinal clinical follow-up). Pseudonymized data is still considered personal data under most privacy frameworks because the link can be restored. True anonymization — where re-identification is not reasonably possible — offers stronger legal protection but is harder to achieve and verify.

Aggregation as a Complementary Technique

Aggregation summarizes data at a group level (counts, means, percentages) rather than releasing individual-level records at all. Releasing only "visit counts by ZIP and month" instead of the underlying rows is inherently safer. However, very small group counts (fewer than five or ten, depending on context) can still reveal individual information, so suppressing or combining small cells is standard practice in published aggregate tables.

Connecting to Credentials

The concepts in this lesson appear across all four credentials in this program. CompTIA Data+ tests data governance and privacy fundamentals. The Google Data Analytics certificate emphasizes ethical handling of data throughout its curriculum. IBM Data Science Professional includes responsible AI and data ethics content. Microsoft PL-300 covers data privacy considerations within Power BI reports. Understanding de-identification positions you to answer exam questions and to act responsibly on the job from day one.

Key terms9

Direct identifierA data field that, by itself, uniquely identifies an individual, such as full name, SSN, or exact address; the first target for removal in any de-identification workflow.
Quasi-identifierA field that does not uniquely identify someone alone but can be combined with other fields to narrow identification, such as age band, ZIP prefix, or sex.
GeneralizationReplacing a precise value with a broader category (e.g., exact age with an age band) to reduce uniqueness while preserving some analytical utility.
SuppressionRemoving a record or cell value entirely because it is too unique to protect through generalization alone; reported as information loss.
k-AnonymityA privacy model requiring that every combination of quasi-identifier values in a dataset appears in at least k records, so no individual can be singled out from fewer than k candidates.
PseudonymizationReplacing direct identifiers with consistent artificial tokens while retaining a separate lookup table that can restore the link; the data remains personal data under most privacy frameworks.
Re-identification riskThe probability or proportion of records in a de-identified dataset that could be linked back to a specific individual using available external information.
Information lossThe reduction in analytical utility caused by de-identification techniques, measured by comparing summary statistics on the original and de-identified datasets.
AggregationReleasing only group-level summaries (counts, means, percentages) rather than individual-level records, reducing but not eliminating disclosure risk for very small groups.

Worked examples4

1. A dataset has 200 records. After generalizing age and ZIP, you group by quasi-identifiers and find the following group sizes: 80 groups have 2 records, 10 groups have 4 records, and 5 groups have 6 records. Does the dataset satisfy k = 5 anonymity, and what percentage of records fail the threshold?
  1. Identify groups below k = 5: groups with 2 records and groups with 4 records both fall below the threshold of 5.
  2. Count records in failing groups: 80 groups × 2 records = 160 records; 10 groups × 4 records = 40 records; total failing = 160 + 40 = 200 records.
  3. Count records in passing groups: 5 groups × 6 records = 30 records.
  4. Check total: 200 failing + 30 passing = 230, but the problem states 200 total records — re-read: the groups sizes are the number of records per group, and there are 80 + 10 + 5 = 95 groups. Recalculate total records: (80 × 2) + (10 × 4) + (5 × 6) = 160 + 40 + 30 = 230 records. The problem description contained an inconsistency; use the calculated total of 230.
  5. Failing records: 160 + 40 = 200. Percentage failing = 200 / 230 × 100 ≈ 86.96%, rounded to 87%.
  6. Conclusion: The dataset does NOT satisfy k = 5 anonymity; approximately 87% of records fall in groups below the threshold and require further generalization or suppression.
Answer: The dataset does not satisfy k = 5 anonymity. Approximately 87% of records (200 out of 230) belong to groups smaller than 5 and must be addressed before the dataset is safe to share.
2. Before de-identification, the mean age of patients in the 'Diabetes' diagnosis group is 54.2 years. After generalization, the mean age computed from the midpoints of the assigned age bands is 55.0 years. What is the percentage difference, and is this within a commonly cited acceptable range of 5%?
  1. Identify original value: 54.2 years.
  2. Identify de-identified value: 55.0 years.
  3. Compute absolute difference: 55.0 − 54.2 = 0.8 years.
  4. Compute percentage difference relative to the original: (0.8 / 54.2) × 100 ≈ 1.476%, rounded to 1.5%.
  5. Compare to the 5% threshold: 1.5% < 5%, so the information loss for this statistic is within the acceptable range.
Answer: The percentage difference is approximately 1.5%, which is well within the commonly cited 5% acceptable information-loss threshold. The generalization of age into bands has minimal impact on this summary statistic.
3. You have a 500-record dataset. After applying k = 5 anonymity, 25 records are suppressed. What percentage of the original records were suppressed, and how many records remain?
  1. Records suppressed: 25.
  2. Original total: 500.
  3. Percentage suppressed: (25 / 500) × 100 = 5%.
  4. Records remaining: 500 − 25 = 475.
Answer: 5% of records were suppressed; 475 records remain in the de-identified dataset.
4. A quasi-identifier group contains records with the values (Age band: 30–39, ZIP prefix: 752, Sex: F). There are 3 such records, which fails k = 5. You can either merge the age band into 30–49 or suppress the 3 records. Merging 30–49 produces a combined group of 8 records. Suppression removes 3 records from a 300-record dataset. Calculate the information loss percentage for suppression and explain why merging is preferable here.
  1. Suppression information loss: 3 records removed from 300 total = (3 / 300) × 100 = 1% of the dataset lost entirely.
  2. Merging age bands: no records are removed; the 3 records join 5 existing records in the broader band, producing a group of 8 ≥ 5, satisfying k = 5.
  3. Assess utility: merged records still contribute to analysis; suppressed records contribute nothing.
  4. Conclusion: merging reduces uniqueness while retaining all 300 records, resulting in lower information loss than suppression for this group.
Answer: Suppression causes 1% record loss (3 of 300). Merging age bands into 30–49 achieves k = 5 with zero record loss and is therefore preferable when the broader band still serves the analytical purpose.

The math in this lesson1

Learners count records in groups below k = 5 to measure k-anonymity suppression.
7.EE.3
In class: Guided coding exercise: instructor-provided Python notebook walks students through removing direct identifiers (name, SSN, exact address), then generalizing quasi-identifiers (exact age → age band, full ZIP → 3-digit ZIP) on the synthetic health dataset; students run each step and record the output in their lab log. · k-Anonymity implementation: students write Python code (using pandas) to verify that every combination of quasi-identifiers in the modified dataset appears at least k=5 times; they identify any records failing the k=5 threshold and apply suppression or further generalization until the threshold is met, documenting each decision. · Utility vs. privacy trade-off analysis: students run three pre-specified summary statistics (mean age by diagnosis group, visit counts by ZIP, insurance type distribution) on both the original and de-identified dataset, compute the percentage difference for each statistic, and write a one-paragraph conclusion about acceptable information loss.
Materials: Jupyter Notebook or RStudio, pandas library, synthetic health-clinic CSV, NIST SP 800-188 de-identification guide, ARX Data Anonymization Tool (open-source, arx.deidentifier.org) for validation cross-check, lab log template
Check: Lab log reviewed for: correct execution of all four techniques with working code, k=5 anonymity achieved and verified, percentage-difference calculations correct, and trade-off paragraph demonstrating reasoned judgment. Pass mark: all four techniques correctly applied and k-anonymity verified; 75% on a 20-point rubric overall.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

Data governance and privacy
1. A dataset contains columns for patient name, SSN, age, ZIP code, and diagnosis. Which column is a direct identifier that should be removed as the first step of de-identification?
Data privacy and de-identification
2. After grouping a de-identified dataset by its quasi-identifiers, an analyst finds a group with only 2 records. The target is k = 5. Which actions could bring this group into compliance? (Select the best answer.)
Data analytics techniques
3. A data analyst replaces exact patient ages with age bands (e.g., 20–29, 30–39). This technique is best described as:
Data governance and ethics
4. Which statement correctly distinguishes pseudonymization from anonymization?
Data analysis and measurement
5. Before de-identification, the visit count for ZIP prefix 752 is 120. After de-identification it is 114. What is the percentage difference relative to the original value?
Data privacy models
6. A dataset satisfies k = 5 anonymity. What does this guarantee?
Data governance standards
7. Which NIST publication provides practical guidance on de-identification of government datasets and is referenced in this lab?
Data privacy and disclosure control
8. An analyst publishing an aggregate report suppresses any cell in a frequency table where the count is fewer than 5. What risk is this practice designed to mitigate?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.