Level 3 — Component — Gold jobs
Level 3 — Component — Gold jobs
Diagram type: Component Scope: the modules inside the Gold jobs (the 15-minute Tier 1 event job and the hourly or nightly star build share them). Audience: data engineers; BI developers who consume the star schema. Structurizr view:
Components-GoldJobin structurizr/workspace.dsl
Overview
The Gold jobs are the only writers of lh_gold. Builders
read Silver (already tokenised at the Bronze gate) and produce dimension
rows, fact rows and business-event rows; every row passes an allow-list
enforcer and the quality gates before the day partition is rebuilt or
the event is inserted if absent. There is no privacy transformation here
any more: identifiers never reached Silver. The jobs execute in the
restricted workspace and write across workspaces into
lh_gold.
Diagram
C4Component
title Component diagram for the Gold jobs (Fabric notebooks, Python and Spark)
Container(orch, "Orchestrator", "Fabric pipelines", "Runs the event job every 15 min; the star build hourly or nightly")
ContainerDb(silver, "lh_silver and control", "Fabric Lakehouse", "Conformed entities; Silver CDF; quarantine")
ContainerDb(gold, "lh_gold", "Fabric Lakehouse", "Star schema; business_event")
Container_Boundary(goldjob, "Gold jobs") {
Component(dims, "Dimension builder", "PySpark module", "Campaigns, accounts, ad hierarchy, stages, owners; SCD1 and SCD2")
Component(facts, "Fact builder", "PySpark module", "Daily performance, conversions, spend, funnel, deal-stage, engagement; replaceWhere by date")
Component(rules, "Business-event rules", "PySpark module, versioned rules", "Important-change catalogue over the Silver change feed; deterministic event_id")
Component(allowlist, "Allow-list enforcer", "PySpark module", "Only allow-listed columns; fails on an unknown column")
Component(quality, "Quality gates", "PySpark module", "Referential integrity, freshness, row-count tolerance; quarantine; write")
Component(maint, "Table maintenance", "PySpark module", "OPTIMIZE with V-Order; VACUUM per policy")
}
Rel(orch, dims, "Runs with touched partitions", "notebook parameters")
Rel(dims, silver, "Reads conformed entities and history from", "Spark, Delta")
Rel(facts, silver, "Reads events, deals and performance rows from", "Spark, Delta")
Rel(rules, silver, "Reads the Silver change feed from", "Delta CDF")
Rel(dims, allowlist, "Passes dimension rows through")
Rel(facts, allowlist, "Passes fact rows through")
Rel(rules, allowlist, "Passes event payloads through")
Rel(allowlist, quality, "Hands allow-listed rows to")
Rel(quality, gold, "Rebuilds date partitions and inserts business events if absent in", "Spark, Delta")
Rel(quality, silver, "Writes quarantine rows to", "Spark, Delta")
Rel(maint, gold, "Runs OPTIMIZE with V-Order and VACUUM on", "Spark SQL")
Legend
- Component: a Python module imported by the notebooks; executed in one Spark session per run.
- Order of execution is left to right: builders, allow-list, quality gates, write, maintenance.
Elements
| Element | Type | Technology | Responsibility |
|---|---|---|---|
| Dimension builder | Component | PySpark module | Conformed dim_* tables; SCD2 for campaign, ad
hierarchy, account, person (by token) |
| Fact builder | Component | PySpark module | fact_* tables at the grains in gold-star-schema.md;
replaceWhere by date within monthly partitions |
| Business-event rules | Component | PySpark module, rule set versioned in Git | Evaluates the catalogue in business architecture;
event_id = hash(event_type, subject_token, source_version, rule_version);
adds rule_version |
| Allow-list enforcer | Component | PySpark module | Writes only columns in gold_v1_allowlist.json; drops
the rest; fails on an unknown column (schema governance, not
privacy) |
| Quality gates | Component | PySpark module | Referential integrity to dimensions (unknown member for orphans), freshness per tier, row-count tolerance; quarantine; final write and insert-if-absent for events |
| Table maintenance | Component | PySpark module | OPTIMIZE with V-Order after each run; VACUUM 30 days on Gold |
Key relationships
| From | To | Intent | Protocol / Technology |
|---|---|---|---|
| Orchestrator | Gold jobs | Runs with touched partitions and mode (incremental, replay) | Notebook parameters |
| Builders | lh_silver | Read conformed rows and the Silver change feed | Spark, Delta, CDF |
| Builders | Allow-list enforcer | Every row passes through | In-process DataFrame |
| Quality gates | lh_gold | Writes partitions and business_event |
Spark, Delta, cross-workspace |
| Quality gates | lh_silver | Quarantine rows | Spark, Delta |
| Table maintenance | lh_gold | OPTIMIZE, VACUUM | Spark SQL |
Notable architectural decisions
- Privacy enforcement moved to the Bronze loader; Gold keeps an allow-list as schema governance (ADR 6).
- Business events are rows written by the same jobs with deterministic
ids, so the change feed on
business_eventis the outbox with no dual write (ADR 7). - Day-level
replaceWhere, never row-level MERGE on facts, so replay and reload are idempotent (ADR 5).
Assumptions
- Rules are evaluated on the Silver change feed, so events reflect
Silver-level changes; a rule needing Gold-level aggregates (for example
spend.pacing_alert,metrics.restated) runs after the fact builder. - The notebooks run in the restricted workspace with write permission
on
lh_goldin the analytics workspace.