Level 3 — Component — Bronze loader (the anonymisation gate)
Level 3 — Component — Bronze loader (the anonymisation gate)
Diagram type: Component Scope: the modules inside the Bronze loader notebook, which is the only path from landing files to Bronze and the only place identifiers are replaced by tokens. Audience: data engineers; the DPO and IT Security reviewing where personal identifiers stop. Structurizr view:
Components-BronzeLoaderin structurizr/workspace.dsl
Overview
Every source lands files; the loader promotes them. Between the two sits the gate: a column with no classification entry fails the run, a PII scan quarantines anything that looks like an identifier outside the classified columns, identifiers are swapped for random tokens obtained from the token vault by batched lookup-or-create, the verbatim payload is rewritten with the tokens before its hash is taken, quasi-identifiers are generalised, and only then does the Delta writer dedupe, stamp provenance and append. Landing files are purged seven days after promotion. The loader runs under the restricted workspace identity, the only identity allowed to call the vault's lookup-or-create.
Diagram
C4Component
title Component diagram for the Bronze loader (Fabric notebook, Python and Spark)
Container(orch, "Orchestrator", "Fabric pipelines", "Runs with the landed window")
ContainerDb(bronze, "lh_bronze", "Fabric Lakehouse", "Landing files; Bronze tables")
ContainerDb(silver, "lh_silver and control", "Fabric Lakehouse", "Classification register; quarantine")
ContainerDb(vault, "Token vault", "Azure SQL, CMK, PIM", "token_map, subject_link")
Container(kv, "Key Vault", "Azure Key Vault", "Vault lookup key")
Container_Boundary(loader, "Bronze loader") {
Component(manifest, "Manifest checker", "Python module", "Pages, rows, cursor_end match manifest.json; rejects truncated windows")
Component(classifier, "Classifier", "Python module", "Loads the register; fails on unclassified columns; routes gate actions")
Component(scanner, "PII scanner", "Python module", "Patterns and heuristics on all string columns; quarantines hits")
Component(tokeniser, "Tokeniser", "Python module, pyodbc, Entra token", "Normalise; batched lookup-or-create; per-run cache; link secondary ids")
Component(rewriter, "Payload rewriter", "Python module", "Tokens replace identifier fields in JSON; free text dropped; hash after rewrite")
Component(generaliser, "Generaliser", "Python module", "IP to country; drop city, postcode, user agent; tokenise cookie and click ids")
Component(writer, "Delta writer", "PySpark module", "Dedupe on version and hash; provenance; append to Bronze")
Component(purger, "Landing purger", "Python module", "Delete landing files 7 days after promotion and on erasure")
}
Rel(orch, manifest, "Runs with the landed window", "notebook activity")
Rel(manifest, bronze, "Reads landing files and manifest.json from", "OneLake")
Rel(manifest, classifier, "Hands verified pages to")
Rel(classifier, silver, "Reads the classification register from", "Delta")
Rel(classifier, scanner, "Hands classified columns to")
Rel(scanner, silver, "Writes quarantine references (landing file, row, check) to", "Delta")
Rel(scanner, tokeniser, "Hands clean records to")
Rel(tokeniser, kv, "Reads the lookup key from", "workspace identity")
Rel(tokeniser, vault, "Looks up or creates tokens for normalised identifiers in", "TDS, batched")
Rel(tokeniser, rewriter, "Hands token assignments to")
Rel(rewriter, generaliser, "Hands rewritten payloads to")
Rel(generaliser, writer, "Hands gated records to")
Rel(writer, bronze, "Dedupes, stamps provenance and appends to", "Spark, Delta")
Rel(writer, purger, "Marks the window promoted for")
Rel(purger, bronze, "Deletes landing files 7 days after promotion in", "OneLake")
Legend
- Component: a Python module imported by the notebook; executed in one session per landed window.
- Order of execution is top to bottom: check, classify, scan, tokenise, rewrite, generalise, write, purge.
- The vault and Key Vault are outside the Fabric boundary (Azure, blue in Structurizr).
Elements
| Element | Type | Technology | Responsibility |
|---|---|---|---|
| Manifest checker | Component | Python module | Page count, row count and cursor_end must match
manifest.json; a truncated=true manifest is
rejected; its run is already failed with the watermark
unchanged, because the adapter halves change_event windows
itself and a truncated manifest means the
min_window_seconds floor was hit (finding C36) |
| Classifier | Component | Python module | Loads the classification register; fails the run on any column without an entry; assigns keep, drop, tokenise, generalise |
| PII scanner | Component | Python module | Regular expressions and heuristics for emails, phones, national ids, IBANs and names over every string column not classified as an identifier; hits go to quarantine with the column name |
| Tokeniser | Component | Python module, pyodbc with an Entra access token |
Lower-cases and trims identifiers; batched lookup-or-create
(thousands per call) against token_map; caches tokens for
the run; links phone and source record ids to the same subject in
subject_link |
| Payload rewriter | Component | Python module | Replaces identifier fields in the verbatim JSON with tokens; drops
or redacts free text per the register; computes
_payload_hash after rewriting |
| Generaliser | Component | Python module | IP address to country; drops city, postcode and user agent; tokenises click ids, drops cookie ids (register-driven); carries consent flags |
| Delta writer | Component | PySpark module | Dedupes on
(source, object, record_id, source_version, payload_hash);
stamps provenance columns; appends to the Bronze table |
| Landing purger | Component | Python module | Deletes landing files 7 days after successful promotion; on erasure, rewrites a subject's records out of files younger than that |
Key relationships
| From | To | Intent | Protocol / Technology |
|---|---|---|---|
| Orchestrator | Manifest checker | Runs with the landed window | Notebook activity |
| Manifest checker | lh_bronze (Files) | Reads landing files and manifest | OneLake |
| Classifier | lh_silver (control) | Reads the classification register | Delta |
| PII scanner | lh_silver (control) | Writes quarantine | Delta |
| Tokeniser | Key Vault | Reads the lookup key | Workspace identity |
| Tokeniser | Token vault | Lookup-or-create tokens | TDS with Entra token, batched |
| Delta writer | lh_bronze (Tables) | Appends tokenised rows with provenance | Spark, Delta |
| Landing purger | lh_bronze (Files) | Deletes landing files | OneLake |
Notable architectural decisions
- The gate is in the loader rather than in each adapter, so the Salesforce copy activity (no code) and any bought connector pass through the same gate (ADR 6).
- Tokens are random values held in the vault, not keyed hashes, so deleting the mapping makes the lake rows unattributable (ADR 6).
- The payload hash is taken after rewriting, so reconciliation hash samples pass the source sample through the same gate before comparing (ADR 5).
Assumptions
- The vault round trip (batched) adds seconds, not minutes, per window at launch volumes; a per-run cache keeps repeated subjects to one lookup.
- The PII scanner's false-positive rate is acceptable because hits are quarantined for review rather than dropped.