Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

DA 5.10, 5.14: Anonymising and pseudonymising in practice

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

60 minutes

Two ways to hide Sam

A researcher wants to study canteen choices. Option one: remove names and emails, and turn ages into bands. Nobody can tell who is who. Option two: swap each name for a code, and keep a secret list that links codes to names.

Both hide Sam. Only one is truly anonymous.

Key words

WordWhat it means
Personal dataInformation about a living person who can be identified.
AnonymisationChanging data so nobody can be identified from it, by anyone.
PseudonymisationSwapping identifiers for codes. A separate key can link them back.
HashingA one-way scramble that turns text into a fixed code.
SaltExtra secret text added before hashing so guesses fail.
BandingReplacing an exact number with a range, such as an age band.
Primary useUsing data for the reason it was first collected.
Secondary useUsing data for a new reason after it was collected.

The cells students fill in are left blank in this preview.

By the end of this lesson

Note

I can anonymise and pseudonymise data in Python, and say which to use for a primary or a secondary use.

Starter: last lesson

Have a go

Starter: last lesson

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Anonymisation

Anonymisation changes data so that nobody can be identified, even with extra effort. If that is true, the data is no longer personal data and data protection law does not apply to it.

Remove direct identifiers. Use bands, not exact values. Hide small groups. Then ask: could someone still work out who it is?

Pseudonymisation

Pseudonymisation swaps a name for a code. Data with codes is still personal data, because the key can link the code back to a person.

Keep the key somewhere else, with tight access. Use a salt when you hash. Without one, an attacker can guess common names and hash them too.

Anonymised or pseudonymised

QuestionAnonymisedPseudonymised
Can it be linked back to a person?NoYes, with the key
Is it personal data?No, if done wellYes
Good forSecondary use, sharing, public reportsWork that needs to link records over time
What to protectCheck nobody can be re-identifiedThe key and the salt

The cells students fill in are left blank in this preview.

Try it: a salted code for a name

Code: python
import hashlib
salt = "x9"
for name in ["Sam", "Alex", "Sam"]:
    code = hashlib.sha256((salt + name).encode()).hexdigest()[0:8]
    print(name, "->", code)

Check: which one?

Have a go

Check: which one?

4 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The lesson goes on

6 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.