A former employee still signs in
A designer left Lantern Print on a Tuesday. On Sunday her account was still active, and somebody used it.
The policy said accounts close within one day. Nobody had checked that the policy was followed.
By the end of this lesson
Note
I can test a control against its policy using a sample of evidence.
Key words
| Word | What it means |
|---|---|
| Policy | what leaders require, in plain words |
| Procedure | the steps staff follow to meet a policy |
| Evidence | records that show what really happened |
| Sample | some items picked from all of them to test |
| Exception | one item that broke the rule |
| Nonconformity | an audit finding that a requirement was not met |
The cells students fill in are left blank in this preview.
Starter
Have a go
Starter
3 questionsFrom policy to evidence
| Layer | Lantern Print example |
|---|---|
| Policy | Access ends when somebody leaves |
| Standard | Accounts are disabled within one day of leaving |
| Procedure | HR emails IT on the last day; IT disables the account |
| Evidence | HR's leaving dates and the system's disable dates |
The cells students fill in are left blank in this preview.
An audit compares evidence with the rule
An audit asks whether a control works, not whether it is written down. The auditor takes the rule, gathers evidence and looks for exceptions.
Checking every record by hand takes too long, so auditors test a sample. An internal audit is done by the firm itself; an external one by an outside body.
Try it: how late was one account?
import datetime
left = datetime.date(2026, 7, 21)
disabled = datetime.date(2026, 7, 27)
allowed = 1
late = max(0, (disabled - left).days - allowed)
print("days late:", late)
# Change disabled to the day after leaving and run again.
Make a free account to save your work and track your progress.
Check
Have a go
Check
3 questionsAudit a year of leavers
leavers.py makes a year of 60 leavers from a fixed seed, each with a leaving day and a disable day. audit.py picks a sample of 15, finds the exceptions and gives a result.
Our rule for the result: none is conforms, up to 10 per cent is minor, above that is major.
Write the leavers
docker exec jupyter sh -c "mkdir -p steps && printf '%s\n' 'import datetime' 'import random' '' 'rng = random.Random(137)' 'start = datetime.date(2026, 1, 5)' 'leavers = []' 'for n in range(1, 61):' ' left = start + datetime.timedelta(days=rng.randint(0, 300))' ' delay = rng.choice([0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 6])' ' leavers.append((f\"P{n:03}\", left.isoformat(), (left + datetime.timedelta(days=delay)).isoformat()))' > steps/leavers.py"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Write the audit, part 1
docker exec jupyter sh -c "mkdir -p steps && printf '%s\n' 'import datetime' 'import random' 'import sys' 'from leavers import leavers' '' 'ALLOWED = 1' '' '' 'def days_late(left, disabled):' ' gap = datetime.date.fromisoformat(disabled) - datetime.date.fromisoformat(left)' ' return max(0, gap.days - ALLOWED)' '' '' 'def rating(found, tested):' ' if found == 0:' ' return \"conforms\"' ' return \"minor nonconformity\" if found / tested <= 0.1 else \"major nonconformity\"' '' '' 'tested = leavers' 'if \"all\" not in sys.argv:' ' tested = sorted(random.Random(5).sample(leavers, 15))' 'print(\"leavers in the year:\", len(leavers), \" tested:\", len(tested))' 'late = [(p, left, off, days_late(left, off)) for p, left, off in tested if days_late(left, off)]' 'for p, left, off, days in late:' ' print(f\" {p} left {left}, disabled {off}, days late: {days}\")' > steps/audit.py"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Write the audit, part 2
docker exec jupyter sh -c "printf '%s\n' 'print(\"exceptions:\", len(late), \"of\", len(tested), \" result:\", rating(len(late), len(tested)))' >> steps/audit.py"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Test a sample of 15
docker exec jupyter python3 steps/audit.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Check
Have a go
Check
3 questionsWith data, test the whole population
A sample is a guess about the whole. When the evidence is data, a short program can test every record. Run the audit with all.
The sample found 2 exceptions. The whole year shows how many the sample missed.
Test all 60 leavers
docker exec jupyter python3 steps/audit.py allShown here, not run. Press Start lab to type it into your own lab’s terminal.
A common mistake
Warning
Many people think a written policy means the control works. The policy here was clear, and 12 of 60 accounts still closed late. Only evidence shows what happened, which is why an audit reads records rather than documents.
Assignment: audit the leavers
Dates are strings such as "2026-03-02".
days_late(left, disabled, allowed) returns the days beyond those allowed, never below 0. exceptions(rows, allowed) takes (id, left, disabled) rows and returns the late ids, sorted. rating(found, tested) returns "conforms", "minor nonconformity" (10 per cent or less) or "major nonconformity".
import datetime
def days_late(left, disabled, allowed):
# Dates are "YYYY-MM-DD". Days from leaving to disabling, minus the days allowed, never below 0.
return 0
def exceptions(rows, allowed):
# rows is a list of (id, left, disabled). The ids that were late, sorted.
return []
def rating(found, tested):
# "conforms" when none were found, "minor nonconformity" when found / tested is 0.1 or less,
# "major nonconformity" otherwise.
return ""
Make a free account to save your work and track your progress.
Exit quiz
Have a go