Personal data and privacy

What personal data is, the Data Protection Act 2018, and anonymising a log.

F12.2Technology and societyGCSE15 min

Covers OCR J277 1.6.1 Ethical, legal, cultural and environmental impact · AQA 8525 3.8 Ethical, legal and environmental impacts of digital technology on wider society, including issues of privacy · Edexcel 1CP2 5.2.1 Personal data

Do this lesson in the simulator

Every app you use collects something about you. Some of it you hand over; much of it is gathered while you go about your day. Personal data is protected by law in the UK, and this lesson is about what counts as personal data, what the law demands of anyone who holds it, and how to handle it responsibly in a program.

What counts as personal data?

Personal data is any information that identifies a living person, on its own or joined with something else: name, address, email, photo, location, IP address, or an ID number. Some kinds are special category data and need extra care: health, ethnicity, religion, sexual orientation, biometrics.

Data that identifies nobody is not personal data. "Robot 7 drove 240 cm" is not; "Sam drove 240 cm at 10:15" is.

Nested boxes: all data, personal data inside it, and special category data inside that, with the lesson's examplesall data"Robot 7 drove240 cm"not personal:it identifies nobodypersonal dataidentifies a living person, on its ownor joined with something elsename, address, email, photo,location, IP address, ID number"Sam drove 240 cm at 10:15"special category: extra carehealth, ethnicity, religion,sexual orientation, biometrics
The same distance is not personal data when it is about Robot 7, and is personal data once it is tied to Sam and a time. Special category data sits inside personal data and needs the most care.

The Data Protection Act 2018

The Data Protection Act 2018 is the UK's data protection law, and it works alongside the UK GDPR, which sets out the same principles. Anyone holding personal data must follow its principles. Data must be:

Principle What it means
Lawful, fair and transparent you must have a good reason, and tell people what you collect and why
Used for a stated purpose collected for a specific reason, and not quietly used for another
Adequate but not excessive collect the minimum needed for the job, and no more
Accurate kept correct and up to date, and corrected when wrong
Kept no longer than needed deleted once the reason for holding it has gone
Kept secure protected against loss, theft and misuse, for example by encryption

You also have rights over your own data: to see what is held about you, to have mistakes corrected, to have it erased, and to object to some uses.

Flow from a person to an organisation that collects, keeps and deletes their data, with the person's rights pointing backyouthe personan organisation holding your data mustcollect ita good reason, toldto you; one statedpurpose; the minimumkeep itaccurate and up todate; securedelete itonce the reason forholding it has goneyour rights: to see it, have mistakes corrected, have it erased, object to some uses
The Act follows your data from the moment it is collected to the moment it is deleted, and your rights (green) let you reach in at any point.

Data minimisation in a program

The best protection is not to hold the data at all. A robot logging lesson activity does not need names to work out how far the class drove:

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()

rows = [("Sam Patel", "sam@school.uk", 240), ("Ava Ng", "ava@school.uk", 180)]
for name, email, cm in rows:
    print("full record:", name, email, cm)
# the same answer, with nothing personal kept
print("class total:", sum(cm for _, _, cm in rows), "cm")

Run this in the simulator

Anonymising

Where data must be kept, it can often be anonymised: the identifying parts removed or replaced, so the useful pattern is left but the person is not. Replacing names with student 1, student 2 is enough for a class report, and the report can then be shared safely.

Be careful: data can be re-identified by joining it with something else. An "anonymous" record of one person's exact route home is still that person.

Two anonymised records: a class report that is safe to share, and a route home that points back to one persona class reportstudent 1: 240 cmsafe to sharean "anonymous" record:one person's route home+joined withsomething elsestill thatperson
Removing the name is not always enough. A class distance hides the person; an exact route home, joined with other information, leads straight back to them.

Task: anonymise the log

Each row of log is a name, an email and a distance in centimetres. Print an anonymised line for each, in the form student 1: 240 cm, numbering the students from 1 in the order they appear. Then print records: <n> and total: <n> cm. Nothing in the output may contain a name or an email.

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()

# name, email, distance in cm
log = [
    ("Sam Patel", "sam@school.uk", 240),
    ("Ava Ng", "ava@school.uk", 180),
    ("Jo Reilly", "jo@school.uk", 95),
    ("Kit Hale", "kit@school.uk", 310),
]

Challenges

  1. Print the furthest distance without printing who drove it.
  2. Which principle of the Act does anonymising the log help you follow?
  3. A school keeps every robot log for ten years. Which principle does that break?