Write the production contract before building the capstone.

Define Business Processes, Bus Matrix, Grain, Facts, Dimensions, Metrics, Source Contracts, SLAs, and Security Requirements

Define the AtlasMart capstone from business decisions through grain, metrics, source contracts, service objectives, ownership, and least-privilege requirements.

Intermediate → Advanced165–215 minutesrequirements + bus-matrix capstonecontracts + SLOs + accessLast reviewed: September 2026

Learning outcomes

01

Turn AtlasMart business decisions into an explicit bus matrix, declared fact grains, conformed dimensions, and governed metrics.

02

Freeze source contracts, watermarks, deletion semantics, service objectives, owners, and security boundaries before implementation.

03

Separate logical analytical contracts from physical warehouse or lakehouse choices.

04

Use architecture decision records and a known-limit register so “production-ready” has auditable evidence.

05

Detect the controlled failure in which a technically complete capstone has no owner, no SLO, and no reconciliation contract.

Capstone continuity: production meaning is frozen while operations are exercised

Chapter 30 begins from the accepted AtlasMart state produced by the earlier chapters: 10 paid order lines, 8 orders, 12 units, 820 USD gross revenue, 495 USD cost, and 325 USD gross profit. The accepted source waterline remains 208. The atomic sales grain remains one paid order line identified by (order_id, line_no); gross_revenue_usd.v1 remains the governed paid-line revenue metric in USD with UTC time semantics. CDC, defect, backfill, performance, security, and disaster-recovery exercises run against disposable copies and must reconcile back to this baseline.

Executed local harness and exact scope

The capstone evidence was executed with Python 3.13.5 and SQLite 3.46.1 on synthetic data in UTC. SQLite supplies relational constraints, transactions, indexes, query-plan evidence, and file backup/restore. It does not reproduce distributed shuffle, cloud IAM, managed row policies, autoscaling, object-store catalogs, multi-region DR, or provider billing. Those concepts are represented only as explicit policy fixtures, scheduler/cost calculations, or architecture decisions. No production credentials, personal data, paid services, or network dependencies are required.

1. Problem frame: “production-ready” is a decision, not a screenshot

AtlasMart leadership wants one trusted sales view for finance, merchandising, marketing, and operations. A team can demonstrate tables, dashboards, indexes, and a successful DAG, yet still leave the business exposed if nobody has declared the grain, metric filters, history policy, service objective, source-deletion semantics, access boundary, or incident owner. The capstone therefore starts with a data-product contract: a versioned statement of what the warehouse means, where it comes from, who can use it, how quickly it should become trustworthy, how changes are validated, and how failure is handled.

The capstone is intentionally evidence-driven. Every later implementation choice must trace back to a business process and a consumer need; every claimed guarantee must have a test, measurement, policy record, or explicit non-guarantee.

2. Business processes first: the bus matrix is the scope boundary

A business process is a repeatable business activity that creates analytical events or state. A bus matrix maps those processes to reusable conformed dimensions. It prevents one giant “warehouse table” from mixing incompatible grains while also preventing independent marts from redefining Date, Product, Customer, or Geography differently.

Process Declared fact grain Core measures/state Conformed dimensions Primary consumer decision
Sales one paid order line quantity, revenue, cost, profit Date, Product, Customer, Geography revenue/profit by product, customer, region, day
Inventory one product-location-day snapshot on-hand units Date, Product, Geography stock position and replenishment
Fulfillment one fulfillment line lifecycle milestone timestamps/status Date roles, Product, Customer cycle time, lateness, reopened work

The capstone implementation focuses deeply on Sales while retaining Inventory and Fulfillment in the matrix. That is incremental warehouse delivery: one process can be production-grade without pretending every process shares the same fact grain.

3. Declare grain before columns, metrics, or performance work

AtlasMart Sales uses the sentence: one row in fact_sales represents one paid order line identified by (order_id, line_no) at its event timestamp. That sentence determines uniqueness tests, additive measures, CDC keys, reconciliation, and safe joins. Customer segment is resolved historically through a dimension version; it is not copied into the fact as an ungoverned current attribute.

Boundary case: an order is not an order line

If an analyst groups by order_id, eight orders are observed. If a pipeline accidentally changes the fact to one row per order, the ten-line control disappears and line-level product allocation becomes impossible. Performance tuning that pre-aggregates to order grain is acceptable only as a separately declared acceleration table; it cannot silently replace the atomic fact.

4. Facts, dimensions, history, and semantic metrics are different contracts

Contract AtlasMart capstone Why it exists
Atomic fact fact_sales at one paid order line preserves additive evidence and replay/reconciliation target
Product dimension P100/P200/P300 with descriptive attributes stable analytical descriptors and conformed joins
Customer SCD2 half-open effective windows; one current version reconstructs historical customer segment without overwriting prior context
Revenue measure revenue_usd on atomic fact additive stored value at declared grain
Governed metric gross_revenue_usd.v1 SUM of paid line revenue under versioned time/filter/unit semantics
Inventory snapshot separate periodic fact grain prevents semi-additive inventory state from being mixed with sales events

A measure is a fact-level numeric value. A metric adds aggregation, filters, time semantics, units, ownership, and versioning. A column named revenue_usd does not by itself prevent a dashboard from excluding a channel or shifting timezone boundaries. Chapter 20’s semantic contract therefore remains part of the capstone.

5. Source contract: define identity, ordering, late data, deletes, and replay

The source contract for the local fixture represents an ERP sales feed. Required fields are order_id, line_no, order_ts, customer_id, product_id, channel, status, qty, revenue_usd, and cost_usd. Timestamps are UTC. CDC uses a stable event_id plus monotonic source_seq; explicit delete events are tombstones; the accepted waterline is 208. A transaction commits target changes, seen-event identity, and watermark together.

json
{  "source": "AtlasMart ERP sales",  "waterline": 208,  "timezone": "UTC",  "grain_key": ["order_id", "line_no"],  "duplicate_identity": "stable event_id + source_seq",  "delete_semantics": "explicit CDC tombstone",  "required_fields": ["order_id","line_no","order_ts","customer_id",                      "product_id","channel","status","qty",                      "revenue_usd","cost_usd"]}

This is stronger than “read rows newer than yesterday.” A timestamp-only cursor can miss late updates, and an append-only target cannot represent deletes or corrections. The capstone retains the exact ordering/retry semantics already tested in Chapter 15.

6. Service objectives and ownership make reliability testable

For this teaching fixture, AtlasMart retains the earlier operational objective that once the source-ready signal exists, the certified analytical product should be complete and available within 30 minutes. Completeness is 100% against the source manifest for the certified scope. This is a fixture policy—not a universal warehouse target. Production teams must choose targets from consumer impact, source readiness, operating hours, and cost.

Responsibility Named owner in the capstone Evidence
Source contract sales-source-owner schema/version/waterline/deletion contract
Dimensional model warehouse-model-owner grain statement, DDL, history tests
Metric semantics finance semantic owner metric v1 spec + golden result 820 USD
Pipeline reliability data-platform on-call run IDs, freshness/completeness, runbook
Security policy security administrator access matrix + bypass tests
Consumer readiness finance/marketing/operations data-product owners certification + incident communication path

An owner is not decorative metadata. It is the accountable decision point for definition changes, failed tests, waivers, deprecations, incidents, and retirement.

7. Security requirements: least privilege from raw data to BI export

The capstone uses synthetic identities and an explicit matrix rather than embedded passwords. bi_reader can read governed semantic output but cannot query the atomic fact directly. etl_service can write the fact through the pipeline path but cannot consume BI output. security_admin manages policies. Privileged direct access is exceptional and auditable. A secure dashboard is not sufficient if the same analyst can query raw/staging tables and bypass masking or row policies.

Identity semantic_sales fact_sales customer_pii Write scope
bi_reader read deny deny deny
finance_steward read read masked deny
etl_service deny write deny fact only
security_admin read read unmasked policy only

Technical access controls must be aligned with organization and jurisdiction policy; this lesson does not claim one privacy/retention rule applies everywhere.

8. Architecture decision records turn tradeoffs into reviewable evidence

An architecture decision record (ADR) captures context, choice, evidence, consequences, owner, and rollback. The capstone starts with four: preserve atomic grain/metric v1; materialize a repeated daily-product workload only if benchmarks justify it; isolate interactive and ELT workloads only after queue evidence; and keep hybrid lakehouse/warehouse system-of-record/serving boundaries explicit.

decision record
ADR-30-001  Preserve one-paid-order-line grain and gross_revenue_usd.v1Evidence      control totals + golden metric testsConsequence   physical implementations may change; business meaning may notRollback      revert model/semantic releaseADR-30-002  Materialize daily-product aggregate for repeated BI workloadEvidence      equivalent results + repeatable local benchmarkNon-guarantee local timing does not prove cloud-engine speedupRollback      route query to atomic fact

9. Controlled failure: the “feature checklist” capstone

Wrong approach

The team marks “star schema, CDC, dashboard, security, performance” as complete. No grain sentence exists, nobody owns revenue, the DAG has no freshness/completeness SLO, and the demo uses a hard-coded production credential. Because the dashboard loads, the team calls the capstone production-ready.

Diagnosis: the checklist proves presence of features, not correctness or operability. Nobody can distinguish a legitimate semantic change from drift, prove history after a backfill, identify consumers during an incident, or restore service after corruption.

Repair: require evidence artifacts: bus matrix, grain and metric contracts, source contract, owner matrix, SLOs, access matrix, reconciliation controls, ADRs, runbook, recovery test, benchmark assumptions, cost model, lineage, and a known-limit register. A requirement is complete only when its evidence is reviewable.

10. Local lab: generate and inspect the capstone contract pack

Run the standard-library fixture from a clean directory. The full capstone harness creates bus_matrix.json, source_contract.json, architecture_decisions.json, access_matrix.json, lineage.json, known_limits.json, runbook.md, and evidence_summary.json. The minimum contract assertions are:

python
baseline = (10, 8, 12, 820, 495, 325)assert grain == "one paid order line per (order_id,line_no)"assert source_contract["waterline"] == 208assert metric["name"] == "gross_revenue_usd.v1"assert metric["expected_usd"] == 820assert access["bi_reader"]["fact_sales"] == "deny"assert slo["certified_after_source_ready_minutes"] <= 30assert owners["metric"] == "finance semantic owner"

The assertion values are not universal design values. They are deterministic AtlasMart fixture contracts. Their purpose is to make silent changes fail visibly.

11. Verification checklist

  • Every in-scope business process has a declared grain and conformed-dimension mapping.
  • Atomic control totals and metric v1 values are frozen before implementation changes.
  • Source identity, ordering, delete, late-data, retry, and watermark semantics are explicit.
  • Service objectives name the measured scope and the owner.
  • Access is defined from raw/staging through semantic/BI surfaces; no credential is embedded in lesson code.
  • Every major architecture tradeoff has evidence, rollback, and a known non-guarantee.

12. Production judgment and bridge to Lesson 2

The capstone is now well-defined enough to implement. The deciding question is not “Does AtlasMart have all warehouse features?” but “Can each business decision trace to a declared grain, metric, source contract, service objective, access policy, owner, and verifiable evidence?” Lesson 2 turns those contracts into executable dimensional, history, CDC, quality, orchestration, and semantic state.

Knowledge check

Checkpoint

Why is the bus matrix useful even when the capstone implements Sales first?

Show answer

It preserves enterprise conformance boundaries and shows which dimensions/processes must share meaning without forcing incompatible grains into one table.

Checkpoint

What does waterline 208 mean?

Show answer

It is the accepted source progress marker for the AtlasMart CDC fixture. It is meaningful only together with stable event identity, source ordering, and atomic target+watermark commit semantics.

Checkpoint

Why is a 30-minute target not a universal best practice?

Show answer

It is a teaching fixture SLO derived from this course continuity. Real SLOs depend on consumer impact, source readiness, operating model, and cost.

Checkpoint

Why deny bi_reader direct fact access if the semantic layer is correct?

Show answer

Because direct physical access can bypass governed filters, masking, row policies, or metric definitions and recreate inconsistent analytics.

Authoritative references

Keep knowledge open

Help the academy stay free and grow.

If these tutorials save you time, a small donation supports new lessons, technical review, diagrams, examples, and long-term maintenance.

ETHEthereum / ERC-20 only
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0

Send only Ethereum or ERC-20 compatible assets to this address.