# De-identify a dataset before sharing it

A plan to remove or mask personal data in a dataset while keeping it useful for analysis, including re-identification risk checks.

- Topic: Data & Analysis
- Framework: Few-Shot
- Level: Standard
- Tags: Data & Analytics, Legal, Coding, Analyze, Fill-in Template
- Source: https://www.thinkwithprompt.com/prompts/de-identify-a-dataset-before-sharing-it

## Prompt

```text
Help me de-identify a dataset so it can be shared for analysis without exposing personal information.

**Dataset description and columns:** [PASTE column names, types, and a few masked example values]
**Who will receive it and for what:** [e.g. "external vendor building a churn model", "internal team for a workshop"]
**What analysis must still be possible:** [e.g. "join across tables by customer", "trends by region and age band"]
**Rules that may apply:** [e.g. GDPR, HIPAA, CCPA, internal data policy - or "unsure"]

Steps:
1. Classify each column: direct identifier (name, email, phone, ID numbers), quasi-identifier (date of birth, ZIP/postal code, gender, job title, rare attributes), sensitive attribute (health, finances), or safe.
2. Recommend a treatment per column: drop, pseudonymize with a keyed hash or random token (and keep the key separate), generalize (age bands, 3-digit ZIP, month instead of date), suppress rare values, add noise, or keep.
3. Check re-identification risk from combinations of quasi-identifiers: suggest a k-anonymity threshold and how to find small groups.
4. Check free-text fields and file names for hidden personal data.
5. Explain the trade-off: what analysis is lost by each treatment.
6. List controls for the receiving party: access limits, no attempts to re-identify, deletion date.

Return a column treatment table (Column | Category | Treatment | Analysis impact), code outline in [SQL / Python] to apply it, a re-identification checklist, and a sign-off checklist. This is general guidance, not legal advice: confirm requirements with my privacy or legal team before sharing.
```

## What to fill in

- PASTE column names, types, and a few masked example values
- e.g. GDPR, HIPAA, CCPA, internal data policy - or "unsure"
- SQL / Python

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
