Data platform¶
Three source feeds are ingested, validated and merged into a lakehouse, where a batch engine cleans and curates the data through bronze, silver and gold zones before a warehouse serves it to dashboards and an API. Four scenarios: the nightly batch, a bad record, a self-serve query and a backfill.
Static images¶
The same diagram in the built-in contrast theme (diagr build --theme contrast), in the site's light or dark
scheme.
Views¶
This diagram has views: parts of it built as their own images and pages, next to the whole diagram's.
Ingestion¶
ingestion: written as data-platform-ingestion-light.svg, data-platform-ingestion-dark.svg and data-platform-ingestion.html.
Self-serve queries¶
serving: written as data-platform-serving-light.svg, data-platform-serving-dark.svg and data-platform-serving.html.
Source¶
version: 1
title: Data platform
description: >-
Three source feeds are ingested, validated and merged into a lakehouse, where a batch engine cleans and curates
the data through bronze, silver and gold zones before a warehouse serves it to dashboards and an API. Four
scenarios: the nightly batch, a bad record, a self-serve query and a backfill.
grid: {col: 200, row: 150}
# One source feed: where the data comes from, ingestion and validation, and what a feed does in a run.
components:
feed:
params: {name: {required: true}, source: {required: true}, format: JSON, version: "3"}
groups:
feed:
title: $name
sub: $format
nodes:
src: {icon: file, title: $source}
ingest: {icon: upload, title: Ingest}
check: {icon: check, title: Validate, sub: schema v$version}
edges:
src -> ingest: pull
ingest -> check: records
# Called with the feeds they run on, side by side: 'pull orders clicks stock'.
actions:
pull: [flow src -> ingest]
validate: [flow ingest -> check 800ms done]
instances:
orders: {component: feed, in: ingestion, with: {name: Orders, source: Order DB, format: CDC}}
clicks: {component: feed, in: ingestion, with: {name: Clickstream, source: Web events}}
stock: {component: feed, in: ingestion, with: {name: Inventory, source: ERP export, format: CSV, version: "1"}}
nodes:
bus: {junction: true}
quarantine: {icon: folder, title: Quarantine, sub: bad records, hidden: true}
oncall: {icon: mail, title: On-call, sub: paged on errors}
app: {icon: browser, title: Web app, layer: last}
analyst: {icon: user, title: Analyst, layer: last}
groups:
ingestion: {title: Ingestion}
account:
title: Data platform
sub: one cloud account
groups:
lakehouse:
title: Lakehouse
tone: teal
groups:
bronze:
title: Bronze
sub: raw
tone: orange
nodes:
raw: {icon: lake, title: Raw tables}
silver:
title: Silver
sub: clean
tone: neutral
nodes:
clean: {icon: database, title: Clean tables}
gold:
title: Gold
sub: curated
tone: amber
nodes:
marts: {icon: layers, title: Data marts}
nodes:
spark: {icon: cube, title: Batch engine, cells: [dedupe, join, enrich, aggregate]}
serving:
title: Serving
tone: violet
nodes:
api: {icon: api, title: Metrics API}
warehouse: {icon: database, title: Warehouse, stack: 2}
dashboards: {icon: chart, title: Dashboards, sub: refreshed daily}
governance:
title: Governance
tone: green
nodes:
catalog: {icon: folder, title: Catalog, sub: lineage and owners}
access: {icon: lock, title: Access control}
edges:
orders/check -> bus:
clicks/check -> bus:
stock/check -> bus:
bus -> raw: land
clicks/check -> quarantine: {label: rejected, hidden: true}
quarantine -> oncall: {label: alert, hidden: true}
raw -> spark: read
spark -> clean: write
clean -> marts: model
marts -> warehouse: publish
api -> warehouse: reads
app -> api: metrics
warehouse <-> dashboards: [data, {label: query, dashed: true}]
analyst -> dashboards: opens
catalog --> spark: lineage
access --> warehouse: grants
app --> clicks/src: click events
scenarios:
nightly:
title: Nightly batch
ready: Press Play to run the nightly batch.
end: Fresh data is on the dashboards.
steps:
- Pull the feeds:
at: orders/src
text: All three feeds are pulled at once.
do: [pull orders clicks stock]
- Validate:
at: orders/check
text: Each feed checks its records against the feed's schema.
do: [validate orders clicks stock]
- Land in bronze:
at: raw
text: The validated records are merged and landed as raw tables.
do: [draw (orders/check clicks/check stock/check) -> bus, draw bus -> raw, done raw]
- Clean and curate:
at: spark
text: The batch engine deduplicates, joins, enriches and aggregates, writing clean tables.
do: [activate spark, draw raw -> spark, cells spark, draw spark -> clean, done spark clean]
- Publish:
at: marts
text: The data marts are rebuilt and published to the warehouse.
do: [flow clean -> marts -> warehouse done]
- Refresh the dashboards:
at: dashboards
do: [draw warehouse -> dashboards, dashboards.sub: refreshed 02:14, done dashboards]
bad-record:
title: Bad record
trigger: {at: oncall, label: Send a bad record}
ready: Press Send a bad record to follow one through validation.
end: The record was fixed and loaded.
steps:
- Validation fails:
at: clicks/check
text: A click event arrives without a session id and fails the schema check.
do: [flow clicks/src -> clicks/ingest -> clicks/check, fail clicks/check, clicks/check.sub: missing session_id]
- Quarantine it:
at: quarantine
text: The record is set aside instead of blocking the feed.
# Drawing the hidden edge brings it and the quarantine out.
do: [draw clicks/check -> quarantine, quarantine.sub: 1 record]
- Page on-call:
at: oncall
do: [draw quarantine -> oncall, run oncall 1200ms]
- Fix and retry:
at: clicks/check
text: The fixed record goes through validation again.
do:
- activate clicks/check
- repeat 2:
- clicks/check.sub: retry $i of 2
- wait 800ms
- clicks/check.sub: schema v3
- done clicks/check
- draw clicks/check -> bus
- draw bus -> raw
query:
title: Self-serve query
trigger: {at: analyst, label: Run a query}
ready: Press Run a query to follow one question.
end: Answer on screen.
steps:
- Open a dashboard:
at: analyst
do: [flow analyst -> dashboards -> warehouse]
- Check access:
at: access
text: The warehouse checks the analyst's grants before running the query.
focus: [warehouse, access]
do: [draw access -> warehouse, wait 1000ms]
- Answer:
at: warehouse
do: [activate warehouse 1200ms, draw warehouse -> dashboards, done warehouse dashboards, analyst.sub: answer in 1.2 s]
backfill:
title: Backfill
trigger: {at: spark, label: Backfill}
ready: Press Backfill to reprocess the last three days.
end: Three days reprocessed.
steps:
- Reprocess day by day:
at: spark
text: The batch engine rereads each day's raw tables and rewrites the clean ones.
do:
- activate spark
- repeat 3:
- raw.sub: day $i of 3
- draw raw -> spark
- cells spark
- draw spark -> clean
- done spark
- Record lineage:
at: catalog
do: [draw catalog -> spark, catalog.sub: backfill recorded, done catalog]
# Parts of the diagram built as their own images and pages: data-platform-ingestion and data-platform-serving.
# Each view is placed again on its own, closing up around what it keeps.
views:
ingestion: {title: Ingestion, include: [ingestion, bus]}
serving: {title: Self-serve queries, include: [serving, analyst, access], scenarios: [query]}