Data Architecture (Phase C)
Data Architecture (Phase C)
Decisions: ADR 2 layering, ADR 5 integrity, ADR 6 personal data. This document holds the mutable detail.
Layer contracts in one table
| Bronze | Silver | Gold | |
|---|---|---|---|
| Purpose | Immutable log of what each source said, when | Typed current state and history per entity, conformed | Star schema for analysis; tokenised; the published contract |
| Write pattern | Append only | MERGE (current) and SCD2 (history) by source version | Rebuild per date with replaceWhere;
business_event inserted if absent on a deterministic
id |
| Readers | Silver jobs, reconciliation, erasure | Gold jobs, reconciliation, Data Engineering | Semantic models, SQL endpoint, relay, downstream |
| Personal data | Tokens only; the landing files before the gate hold identifiers for ≤ 7 days | Tokens only | Tokens only |
| Schema policy | Schema-on-read, additive | Contract in Git | Versioned, allow-listed columns |
| Retention | Mirrors the source's retention; engagement events at most 3 years (data classification, DPO to confirm) | As Bronze | Person-level facts 3 years, aggregates kept (same proposal); time travel 30 days |
| Delta settings | CDF off; VACUUM 7 d | CDF on; VACUUM 7 d | CDF on business_event only; VACUUM 30 d; log retention
90 d; V-Order |
| Spark write profile | Write-heavy: V-Order off, auto-compaction on, large file targets, partition by ingest date | Balanced: V-Order on, adaptive execution, partition by business date, Z-order on filter columns | Read-heavy: V-Order on, optimised writes with 1 GB bins, Z-order on filter columns, pre-aggregated measures |
| Physical home | lh_restricted.bronze schema |
lh_restricted.silver and
lh_restricted.control schemas |
lh_gold.gold schema (one schema-enabled lakehouse per
workspace, ADR
2) |
Standard provenance columns
Present on every table in every layer unless noted.
| Column | Type | Meaning |
|---|---|---|
_source |
string | salesforce, hubspot,
google_ads, … (from the source registry) |
_object |
string | Source object or report name |
_batch_id |
string | Run id of the extraction that produced the row |
_window_key |
string | Deterministic window of the extraction |
_extracted_at |
timestamp (UTC) | When the adapter received the row |
_source_version |
string or timestamp | The source's own version marker (SystemModstamp,
hs_lastmodifieddate, report date) |
_op |
string | upsert, delete, snapshot,
cdc_create, cdc_update,
cdc_delete, webhook_nudge |
_payload |
string | Bronze only: JSON of the record as received, with identifier fields replaced by vault tokens at the gate |
_payload_hash |
string | SHA-256 of the tokenised _payload for dedupe and
reconciliation (a source sample is passed through the gate before
comparison) |
_mode |
string | incremental, historical,
reload, replay |
_built_at, _gold_schema_version |
timestamp, string | Gold only |
Partitioning and layout
- Bronze: partitioned by
_source,_object,_ingest_date. Landing files underFiles/landing/{source}/{object}/[customer={id}/]{yyyy}/{MM}/{dd}/{run_id}/(folder date = UTC date of the window start, integration contracts) are the only lake location with direct identifiers; they are deleted 7 days after successful promotion and are the first target of the erasure runbook (ADR 6). - Silver current-state tables: no partition for small entities;
monthly on
_source_versionfor events. - Gold facts: monthly partitions on date; dimensions unpartitioned.
Time, keys and versions
- All timestamps stored in UTC; source time zones recorded in the
source registry; Gold
dim_datecarries the reporting calendar. - Business keys per entity are defined in the domain model. Silver surrogate keys are
derived from
(source, source_id); Person, user and click keys in every layer are the random vault tokens assigned at the Bronze gate (ADR 6). - Version precedence in Silver MERGE: higher
_source_versionwins; on equal versions, later_extracted_atwins; identical payload hash is a no-op.
Data quality gates (per promotion)
| Check | Bronze → Silver | Silver → Gold |
|---|---|---|
| Schema matches contract (additive drift allowed in Bronze only) | ✔ | ✔ |
| Business key not null and unique per version | ✔ | ✔ |
| Referential integrity (campaign exists for performance row, person exists for engagement) | — | ✔ (orphans → dim_* unknown member, counted) |
| Freshness within tier | ✔ | ✔ |
| Row-count delta vs previous run within tolerance | ✔ | ✔ |
| Anonymisation gate (landing → Bronze): every column classified, identifiers tokenised, PII scan clean | ✔ (hard fail, before any Bronze write) | — |
| Allow-list: no non-allow-listed column reaches Gold | — | ✔ (hard fail) |
| Duplicates after MERGE | ✔ | — |
Failures write references to the offending rows (landing file, row
number, check name, column; never the payload) to
control.quarantine, and block only the affected
partition.
Integrity and audit mechanisms (summary)
| Concern from the brief | Mechanism | Where |
|---|---|---|
| Failures and retries | Backoff with Retry-After; circuit breaker; cursors
committed per page |
Adapters, control tables |
| Duplicate data | Bronze dedupe on version and hash; Silver MERGE; Gold day-level
rebuild; deterministic event_id for consumers |
ADR 5 |
| Partial processing | Window is landed or not; watermark advances only after
full window |
Ledger |
| Missed changes | Polling is the truth; daily reconciliation counts; deletion sweeps; Google Ads trailing windows | ADR 3, ADR 5 |
| Recovery and reprocessing | Reload by window from source; replay from Bronze; time travel to compare | ADR 5 |
| Completeness evidence | control.reconciliation_result history; row counts per
layer per run |
Control schema |
| Lineage | Fabric lineage view; _batch_id on every row; Purview if
adopted |
Platform |
| Access audit | Workspace membership reviews; Fabric audit log for restricted workspace | Governance |
Backup and recovery
- OneLake provides regional storage redundancy; Bronze is the recovery source for Silver and Gold (replay).
- The token vault (Azure SQL Database) has its own geo-redundant backup with a short retention agreed with the DPO; losing the vault would make every token unattributable, which is safe for privacy and catastrophic for identity joins, so its backup is tested quarterly.
- Code, notebooks, pipelines and semantic models are in Git; environments are reproducible from IaC.
- Recovery objectives (assumed): RPO of one scheduling interval per freshness tier: 1 hour for Tier 1 and Tier 2 objects (the last polling window), 1 day for Tier 3, 1 week for Tier 4 true-ups; a lost window is re-pulled from the source on the next run, so the loss is freshness, not data. RTO 4 hours for the platform in region (redeploy from Git and replay); 1 business day for regional loss without the optional Bronze export (technology architecture).
- Optional: nightly export of Bronze to a second region's storage account if the business requires cross-region recovery (cost noted in technology architecture).