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

Preview

DA 1.14: Auditing data with checks

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

The age of minus four

A sign-up form accepts an age of minus four. It accepts a room number of "banana". It lets a name stay empty.

A few simple checks would have stopped all three. Auditing means checking that data is clean, correct and useful, both as it goes in and after it is stored.

Key words

WordWhat it meansExample
AuditTo check that data is clean, correct and useful.Review a table each term
ValidationA check that data is sensible and in the right shape.Age must be 11 to 18
VerificationA check that data is the same as the original or was copied correctly.Compare with the paper form
Check digitA digit added to a number, worked out from the others, to catch typing errors.The last digit of 1236
Format checkChecks that data follows a set pattern.Two letters, four digits
Length checkChecks that data is not too short or too long.Exactly 6 characters
Presence checkChecks that a required field is not empty.Name is filled in
Range checkChecks that a number is between two limits.Age from 11 to 18
Lookup tableA list of allowed values to check against.Allowed room names

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

By the end of this lesson

Note

I can name four verification methods and six validation checks, and say which one fits a problem.

Starter: what you already know

Have a go

Starter: what you already know

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.

Four ways to verify

MethodWhat you do
Cross-checkingCompare the data with a second copy or source
Review against external systemsCheck it agrees with the original data held elsewhere
Quality assuranceA planned set of checks, done by a second person
Spell checkFind mistyped words

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

Six ways to validate

CheckWhat it testsExample
PresenceIs it filled in?Name is not empty
RangeIs it between two limits?Age 11 to 18
LengthIs it the right length?Code has 6 characters
FormatDoes it follow the pattern?AB1234
LookupIs it on the allowed list?Room R12
Check digitDoes the last digit fit the others?1236

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

Try it: three checks

Code: python
age = -4
name = ""
room = "banana"
rooms = ["R11", "R12"]

print("Range ok:", age >= 11 and age <= 18)
print("Presence ok:", name != "")
print("Lookup ok:", room in rooms)

# Try it: set age to 15, name to "Sam" and room to "R12", then press Run.

A common mistake

Warning

Many people think a passed validation proves the data is right. Age 17 passes the range check even if the person is 12. Validation only catches the impossible. Verification catches more.

The lesson goes on

2 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.