AAmit’s LibraryLEARN · PRACTISE · REFLECT
Eight practical digital skills

Worked example: clean and explain a workshop enquiry report

A fictional organiser needs a count of confirmed enquiries and seats. Build a reproducible report before choosing tools or sending messages. This is one small data-and-coding example with planning handoffs to the other digital skills. It does not implement a registration service, campaign, cloud deployment or AI integration.

Prerequisites: read a CSV table and calculate a percentage; optionally use basic Python functions and dictionaries. Allow about 45–60 minutes after the introductory readings. You can complete the arithmetic and handoffs on paper. The optional code uses Python 3's standard library only, with fixed synthetic data held in memory.

1. Define the question and rules

One logical record represents one enquiry, identified by id; an enquiry can request more than one seat. The seven raw rows below are an export snapshot, not a sequence of later updates. Retain an exact duplicate once. A repeated ID with conflicting content needs review, so the code stops rather than choosing a winner. For this exercise, seats must be a positive ASCII whole number for every status; allowed statuses are confirmed, pending and cancelled. Allowed channels are referral, search, social and a blank value meaning unknown.

Quarantine invalid records without guessing a correction. Count seats only for retained confirmed enquiries. Keep the original input and the exclusion record. These rules are deliberately small; a real system would also need a fuller schema, size limits, time/version rules, access controls and reconciliation with its authoritative records.

2. Inspect the seven raw rows

All IDs and values are invented. There are no names, email addresses, contact details or real registrations.

id,channel,status,seats
W101,referral,confirmed,1
W102,search,confirmed,2
W102,search,confirmed,2
W103,search,pending,1
W104,,confirmed,1
W105,social,cancelled,1
W106,referral,confirmed,-1

Try first: identify the duplicate and invalid row, then calculate retained enquiries, confirmed enquiries, confirmed seats and confirmed seats by channel. A blank channel does not mean zero seats.

Worked reconciliation and answer

The third raw row repeats W102 exactly; retain it once. W106 has −1 seats and is quarantined. W104 retains its one confirmed seat with the channel labelled unknown. The reconciliation is 7 raw rows = 5 retained enquiries + 1 duplicate row + 1 quarantined record.

The retained records are W101, W102, W103, W104 and W105. Three are confirmed, one pending and one cancelled. Confirmed seats are 1 + 2 + 1 = 4. By channel: referral 1, search 2, social 0, unknown 1. These totals reconcile to four; pending and cancelled seats are excluded.

Among retained enquiries, the confirmed proportion is 3/5 = 60%. It excludes the quarantined record and describes this tiny snapshot only. No visit/exposure data, observation period or channel costs are supplied, so neither a visitor conversion rate nor a causal campaign comparison can be calculated.

3. Express and check the rule

Read or copy the complete fixed example below into a plain text file such as enquiry_example.py. If an interpreter is already installed, run python3 enquiry_example.py in that file's directory. No installation, file download, account, external package or network request is part of this exercise. The page displays code as text and does not execute it.

"""Fixed synthetic teaching fixture; no network, files, packages or real contacts."""
import csv
from io import StringIO

DATA = """id,channel,status,seats
W101,referral,confirmed,1
W102,search,confirmed,2
W102,search,confirmed,2
W103,search,pending,1
W104,,confirmed,1
W105,social,cancelled,1
W106,referral,confirmed,-1
"""


def report(text):
    reader = csv.DictReader(StringIO(text))
    if reader.fieldnames != ["id", "channel", "status", "seats"]:
        raise ValueError("unexpected columns")
    seen, kept, quarantined = {}, [], []
    raw = duplicates = 0
    for row in reader:
        raw += 1
        if None in row or any(value is None for value in row.values()):
            raise ValueError("unexpected row shape")
        key = row["id"]
        if not key:
            raise ValueError("missing ID")
        if key in seen:
            if row != seen[key]:
                raise ValueError("conflicting ID: " + key)
            duplicates += 1
            continue
        seen[key] = row
        # Teaching policy: seats must be a positive ASCII whole number.
        seats_text = row["seats"]
        valid_seats = bool(seats_text) and all("0" <= c <= "9" for c in seats_text)
        if (not valid_seats or int(seats_text) < 1
                or row["status"] not in {"confirmed", "pending", "cancelled"}
                or row["channel"] not in {"", "referral", "search", "social"}):
            quarantined.append(key)
            continue
        kept.append({**row, "seats": int(seats_text),
                     "channel": row["channel"] or "unknown"})
    confirmed = [row for row in kept if row["status"] == "confirmed"]
    channels = {name: 0 for name in ["referral", "search", "social", "unknown"]}
    for row in confirmed:
        channels[row["channel"]] += row["seats"]
    return {"raw": raw, "duplicates": duplicates, "quarantined": quarantined,
            "retained": len(kept), "confirmed_enquiries": len(confirmed),
            "confirmed_seats": sum(row["seats"] for row in confirmed),
            "confirmed_seats_by_channel": channels}


if __name__ == "__main__":
    print(report(DATA))

Expected output for this fixture

{'raw': 7, 'duplicates': 1, 'quarantined': ['W106'], 'retained': 5, 'confirmed_enquiries': 3, 'confirmed_seats': 4, 'confirmed_seats_by_channel': {'referral': 1, 'search': 2, 'social': 0, 'unknown': 1}}

The official Python CSV documentation explains why CSV fields are initially strings and why conversion needs an explicit rule.

Check more than one case

Review note: check the reported counts against the raw table independently. The conflict policy applies even when one of the conflicting rows would otherwise be invalid. Preserve the error for review rather than publishing a partial report.

4. Carry the evidence into the other skills

  1. Cybersecurity: a report reader receives only aggregate counts. A fictional request for all attendee contact details needs independent verification and a permission decision. There are no such details in this fixture.
  2. UI/UX: sketch a report labelled “3 confirmed enquiries; 4 confirmed seats; 1 quarantined record.” Show the unknown channel, the inclusion rule and a path to review exceptions. For a form prototype, label fields and test keyboard operation and error recovery.
  3. Cloud: keep the exercise local. On paper, estimate the fictional 3-credit base cost from the pathway and assign backup/restoration responsibility. Do not equate a cost estimate with a deployed or recoverable service.
  4. Digital marketing: report 3/5 = 60% among retained enquiries, with the exclusions stated. Search accounts for two confirmed seats in this snapshot. Without exposure, cost and comparable conditions, it is not evidence of the best channel or campaign causation.
  5. AI review: correct the invented draft “Seven enquiries produced six confirmed seats; search caused the strongest demand.” There are seven raw rows, five retained enquiries, three confirmed enquiries and four confirmed seats. The causal claim is unsupported. This is an authored review exercise; no AI output was requested from a service.
  6. No-code: draw trigger → validate → review → update report once, keyed by enquiry ID. Walk through duplicate, conflict, rejection and timeout cards. A rejected or timed-out review does not trigger a confirmed-seat update. Define an explicit approval record before any future external action.

5. Demonstrate and improve

Next exercise: change W104's channel from blank to referral. Predict referral 2, search 2, social 0, unknown 0, with the total still 4, then check it. Separately, propose a versioned-update rule for a later snapshot; do not silently treat a new status as an exact duplicate.

Continue through the eight-skill pathway for the existing chapters, prerequisites and primary further reading.