OpenCyber Academy
Bachelor's · Chapter 26 · English
Course code: OCA-095Chapter 26: OCA-095-C026

Chapter 26 — Retention in practice

Open, free learning for anyone who wants to protect people and technology. No account is required to read this text or its worked answers.

Lesson map

Lesson 26 published. Map, example, EX076.

flowchart TD
  N0["Learning outcomes"]
  N1["26.1 Measuring over-retention"]
  N2["Lab — Synthetic loyalty records held past a three-ye"]
  N3["26.2 Results"]
  N4["26.3 Planning deletion"]
  N5["26.4 Evidence and follow-up"]
  N0 --> N1 --> N2 --> N3 --> N4 --> N5
  N5 --> EX["Worked example"]
  EX --> Q["Exercise EX076"]

Logical drawing

flowchart LR
  N0["Learning outcomes"]
  N1["26.1 Measuring over-retention"]
  N2["Lab — Synthetic loyalty records held past a three-ye"]
  N3["26.2 Results"]
  N4["26.3 Planning deletion"]
  N5["26.4 Evidence and follow-up"]
  N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> Q["EX076"]
[Learning outcomes]
    |
    v
[26.1 Measuring over-retention]
    |
    v
[Lab — Synthetic loyalty records held past a three-ye]
    |
    v
[26.2 Results]
    |
    v
[26.3 Planning deletion]
    |
    v
[26.4 Evidence and follow-up]
    |
    v
[Worked example] --> [Exercise EX076]

Learning outcomes

You will (1) measure records held beyond retention; (2) interpret the scale of over-retention; (3) plan safe deletion.

26.1 Measuring over-retention

With the schedule approved, Amara measures how many loyalty records already exceed it. She writes a script that compares each member's last activity date with a reference date and counts members inactive for more than three years. She explains that measuring before deleting matters: it shows the scale of the problem, supports planning and provides a baseline against which the deletion programme can later be checked by auditors or the governance group. The script is short, and the steward can rerun it each quarter without help from the data team.

Lab — Synthetic loyalty records held past a three-year inactivity rule

"""Count synthetic loyalty records held past a 3-year inactivity retention rule (stdlib only)."""
import random, datetime as dt
random.seed(11)
today = dt.date(2026, 6, 30)
last = [today - dt.timedelta(days=random.randint(0, 6*365)) for _ in range(5000)]
over = [d for d in last if (today - d).days > 3*365]
print(f"records 5000; inactive over 3 years {len(over)} ({100*len(over)/5000:.1f}%)")
print(f"oldest last activity {min(last)}")

Run with python3 lab_retention.py. Verified output:

records 5000; inactive over 3 years 2521 (50.4%)
oldest last activity 2020-07-01

26.2 Results

The lab examines five thousand synthetic records with a reference date of 30 June 2026. Of these, 2,521 records, 50.4 percent, have had no activity for more than three years. The oldest last activity is 1 July 2020. Amara notes that about half the member file is being kept beyond the agreed period, which means half the personal data at risk in any breach serves no current purpose under Harbourline's own schedule. Amara presents the finding to the loyalty owner, who agrees that deletion should begin once members have been reminded and given a chance to keep their accounts.

26.3 Planning deletion

Amara plans deletion carefully. She first confirms with finance that no transaction records required for tax are stored only in the loyalty system. She proposes sending inactive members a reminder that their accounts will close unless they use the card, giving them a chance to stay. After the notice period, the steward runs deletion in batches, checking counts before and after. Backups expire through their normal cycle, which is documented in the plan. The governance group approves the plan at its next meeting.

26.4 Evidence and follow-up

Each deletion batch is logged with date, count and approver. After the first quarter, Amara reruns the script and confirms that over-retained records have fallen as planned. She notes one unexpected effect: marketing loses a segment it used for win-back offers, which prompts a discussion about whether win-back campaigns should run before the three-year mark. Dr. Lindqvist explains that good retention practice often reveals business processes built on data that should not exist. Marketing agrees to move win-back offers earlier in the inactivity period.

Worked example

Amara counts 2,521 of 5,000 records (50.4 percent) inactive over three years, plans reminders and batched deletion after confirming tax needs, logs batches and verifies the fall.

Synthetic case. Records are synthetic; outputs come from lab_retention.py.

Errors and limits

Deleting without checking dependencies can remove records still legally required.

Exercises

Worked answers

EX076. 2,521 records, 50.4 percent.

EX077. That no tax-required transaction records exist only in the loyalty system.

EX078. A segment used for win-back offers.