◇ OpenCyber Academy
Bachelor's · Chapter 8 · English

Chapter 8 — Programming II

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

Chapter 8 — Programming II

Lesson map

Lesson 08 published. Map, example, EX022.

flowchart TD
  N0["Learning outcomes"]
  N1["8.1 Combining sources"]
  N2["8.2 Functions and tests"]
  N3["8.3 The monthly report"]
  N4["Synthesis"]
  N0 --> N1 --> N2 --> N3 --> N4
  N4 --> EX["Worked example"]
  EX --> Q["Exercise EX022"]

Logical drawing

flowchart LR
  N0["Learning outcomes"]
  N1["8.1 Combining sources"]
  N2["8.2 Functions and tests"]
  N3["8.3 The monthly report"]
  N4["Synthesis"]
  N0 --> N1 --> N2 --> N3 --> N4 --> Q["EX022"]
[Learning outcomes]
    |
    v
[8.1 Combining sources]
    |
    v
[8.2 Functions and tests]
    |
    v
[8.3 The monthly report]
    |
    v
[Synthesis]
    |
    v
[Worked example] --> [Exercise EX022]

Learning outcomes

You will (1) build a larger script with functions and tests; (2) combine two data sources; (3) produce a monthly identity report.

8.1 Combining sources

Elena's second-year script combines the HR staff list with the office suite export. Each source names people differently: HR uses employee numbers, the office suite uses email addresses. She writes a function to match them using a mapping table maintained by HR, and reports any person who cannot be matched. Combining sources is where many identity checks go wrong, because a mismatch in naming can make a current employee look like a leaver or hide a real leaver behind a slightly different spelling.

8.2 Functions and tests

The script is organised into functions: read HR, read accounts, match, analyse and report. Each has tests using small synthetic files where Elena knows the right answer, including awkward cases such as a person who changed surname and an account with capital letters in the email. Tests run before each monthly use. When Greenhill changes its export format, a failing test warns Elena immediately, instead of the report quietly producing wrong numbers that someone might act on. New awkward cases are added as tests whenever they appear in real data.

8.3 The monthly report

The report lists accounts without a current employee, staff without multi-factor authentication by team, accounts unused for ninety days and administrator accounts. Each list includes counts and percentages with bases, and the report header gives export dates and script version. Elena sends it to the IT lead, who decides actions. She avoids changing accounts herself: her role is to provide accurate evidence. The report becomes the baseline against which later improvements are measured during her capstone. Each month's report is stored with the previous ones for comparison.

Worked example

The combined script matches 138 of 140 staff automatically; two unmatched names are resolved with HR, one a surname change and one a typo.

Synthetic case. Sources, names and counts are synthetic.

Errors and limits

Matching people by display name instead of a stable identifier mistakes surname changes for leavers.

Exercises

Synthesis

Carefully matched sources, tested functions and a clear monthly report make identity evidence dependable.

Continue studying — chapter 08 of 40

← Chapter 07 (draft) · Course chapter index · Chapter 09 (draft) →