17. Data products and data contracts
A data product is data offered as a product: an owner who answers for it, ports through which it is read, and qualities its users can rely on. A data contract writes those promises down in a form machines can check (schema, quality, freshness, terms), versioned so that a change that would break a consumer is caught before it ships.
The clip starts from Harbour Mutual's claims table as it is: a table in a database that several teams read without asking. Step by step it becomes a product: an owner who answers for it, an input port from the claims system, output ports for SQL, files and events, then the qualities a user needs: discoverable, understandable, trustworthy, secure. A contract is attached, with the schema, the quality promises and the freshness. Then six proposed changes meet the contract, and each is classified as a patch, a minor or a major version.
The intuition: from someone's table to everyone's product
Harbour Mutual's claims table is read by the warehouse, the fraud model, the actuaries' spreadsheets and the claims dashboard. None of them asked; all of them depend on it. When the claims system's team renamed a column last spring, three of them broke on the same morning, and each spent a day finding out why.
The table had users but no product thinking: nobody who answered for it, no description of what each column promised, no notice of change. Treating it as a product means giving it what any product has: an owner, a way to find and use it, a description of what it does, and a promise about how it changes. Writing the promise down so a pipeline can check it is a contract.
The theory: products, ports, qualities and contracts
Dehghani defines a data product as the smallest unit of data architecture that can be deployed on its own: the data, the code that produces it, its metadata and its infrastructure, owned by a domain team. It is not just a dataset. It must be usable by people who did not build it, which she breaks down into qualities: discoverable (listed in a catalogue), addressable (a stable, unique address), understandable (documented semantics and examples), trustworthy (stated and measured quality, lineage), natively accessible (readable in the forms its users work in), interoperable (shared identifiers and standards), valuable on its own and secure.
A product has ports. An input port is how data enters (a change feed from the claims system). An output port is how consumers read it: a SQL table, files in the lake, an event stream, an API. Several output ports can serve the same data in different forms, each under the same promises. A discovery port exposes the product's metadata and contract to the catalogue.
A data contract is an agreement between a producer and its consumers, written as a document a machine can validate. The Open Data Contract Standard (ODCS), maintained under the Linux Foundation's Bitol project, gives it a shape: fundamentals (id, name, version, status, owner), the schema (each property with its logical and physical type, required, unique, primary key, classification), quality rules with thresholds, service levels (freshness, retention, availability), the team and its roles, and the terms of use.
{
"apiVersion": "v3.1.0",
"kind": "DataContract",
"id": "dc-claims",
"name": "Claim: claims",
"version": "1.0.0",
"status": "active",
"domain": "Claim",
"dataProduct": "Claim",
"description": {
"purpose": "A loss reported against one policy.",
"usage": "Read by reporting, reserving and the claims assistant through the product's output port."
},
"team": {
"name": "Claim domain",
"members": [
{
"username": "ruud.hendriks@harbourmutual.example",
"name": "Ruud Hendriks",
"role": "owner",
"description": "Claims Director"
}
]
},
"schema": [
{
"name": "claims",
"physicalName": "claims",
"physicalType": "table",
"logicalType": "object",
"description": "A loss reported against one policy.",
"properties": [
{
"name": "claim_id",
"logicalType": "integer",
"physicalType": "integer",
"required": true,
"unique": true,
"primaryKey": true,
"primaryKeyPosition": 1,
"classification": "internal",
"description": "Surrogate key"
},
{
"name": "claim_number",
"logicalType": "string",
"physicalType": "text",
"required": true,
"unique": false,
"classification": "internal",
"description": "claim_number"
},
{
"name": "policy_id",
"logicalType": "integer",
"physicalType": "integer",
"required": true,
"unique": false,
"classification": "internal",
"description": "policy_id"
},
{
"name": "loss_date",
"logicalType": "date",
"physicalType": "date",
"required": true,
"unique": false,
"classification": "internal",
"description": "when the event happened"
},
{
"name": "reported_date",
"logicalType": "date",
"physicalType": "date",
"required": true,
"unique": false,
"classification": "internal",
"description": "when Harbour Mutual heard of it"
},
{
"name": "cause",
"logicalType": "string",
"physicalType": "text",
"required": true,
"unique": false,
"classification": "confidential",
"description": "cause"
},
{
"name": "status",
"logicalType": "string",
"physicalType": "text",
"required": true,
"unique": false,
"classification": "internal",
"description": "open, closed or rejected"
},
{
"name": "reserve",
"logicalType": "number",
"physicalType": "numeric(12,2)",
"required": true,
"unique": false,
"classification": "confidential",
"description": "what the insurer still expects to pay on an open claim"
}
],
"quality": [
{
"id": "rule-reported-after-loss",
"name": "A claim is reported on or after its loss date",
"dimension": "conformity",
"type": "sql",
"query": "SELECT 100.0 * AVG(CASE WHEN COALESCE(reported_date >= loss_date, FALSE) THEN 1 ELSE 0 END) FROM claims",
"mustBeGreaterOrEqualTo": 98,
"unit": "percent",
"severity": "warning"
},
{
"id": "rule-claim-reported-present",
"name": "A claim has a reported date",
"dimension": "completeness",
"type": "sql",
"query": "SELECT 100.0 * AVG(CASE WHEN COALESCE(reported_date IS NOT NULL, FALSE) THEN 1 ELSE 0 END) FROM claims",
"mustBeGreaterOrEqualTo": 99,
"unit": "percent",
"severity": "warning"
},
{
"id": "rule-claim-cause-known",
"name": "A claim's cause is on the loss-cause list",
"dimension": "conformity",
"type": "sql",
"query": "SELECT 100.0 * AVG(CASE WHEN COALESCE(cause IN ('collision', 'theft', 'windscreen', 'storm', 'escape of water', 'fire', 'medical', 'baggage'), FALSE) THEN 1 ELSE 0 END) FROM claims",
"mustBeGreaterOrEqualTo": 99,
"unit": "percent",
"severity": "warning"
},
{
"id": "rule-claim-reserve-range",
"name": "A reserve is between 0 and the large-loss limit of 100,000",
"dimension": "accuracy",
"type": "sql",
"query": "SELECT 100.0 * AVG(CASE WHEN COALESCE(reserve BETWEEN 0 AND 100000, FALSE) THEN 1 ELSE 0 END) FROM claims",
"mustBeGreaterOrEqualTo": 99,
"unit": "percent",
"severity": "warning"
},
{
"id": "rule-claim-reported-on-time",
"name": "A claim is reported within 60 days of the loss",
"dimension": "timeliness",
"type": "sql",
"query": "SELECT 100.0 * AVG(CASE WHEN COALESCE(reported_date - loss_date <= 60, FALSE) THEN 1 ELSE 0 END) FROM claims",
"mustBeGreaterOrEqualTo": 95,
"unit": "percent",
"severity": "warning"
},
{
"id": "rule-claim-number-unique",
"name": "Each claim number is used once",
"dimension": "uniqueness",
"type": "sql",
"query": "SELECT 100.0 * AVG(CASE WHEN COALESCE(NOT EXISTS (SELECT 1 FROM claims o WHERE o.claim_number = claims.claim_number AND o.claim_id <> claims.claim_id), FALSE) THEN 1 ELSE 0 END) FROM claims",
"mustBeGreaterOrEqualTo": 100,
"unit": "percent",
"severity": "error"
},
{
"id": "rule-claim-policy-exists",
"name": "A claim's policy exists",
"dimension": "consistency",
"type": "sql",
"query": "SELECT 100.0 * AVG(CASE WHEN COALESCE(EXISTS (SELECT 1 FROM policies r WHERE r.policy_id = claims.policy_id), FALSE) THEN 1 ELSE 0 END) FROM claims",
"mustBeGreaterOrEqualTo": 100,
"unit": "percent",
"severity": "error"
}
]
}
],
"slaProperties": [
{
"property": "freshness",
"value": 24,
"unit": "h"
},
{
"property": "retention",
"value": 7,
"unit": "y"
}
]
}
Semantic versioning gives the version number a meaning: MAJOR.MINOR.PATCH. A patch changes nothing a consumer relies on (a clearer description). A minor version adds something a consumer may ignore (a new optional column). A major version breaks a promise: a column removed or renamed, a type changed, a required column allowed to be empty, a quality threshold lowered, data delivered later. The rule of thumb: anything that can make a correct consumer fail or silently compute a different answer is breaking.
| Proposed change | Version bump |
|---|---|
| Reword a column's description | patch |
| Add an optional column | minor |
| Rename a column | major |
| Allow a required column to be empty | major |
| Lower a quality promise | major |
| Deliver the data later | major |
Contracts also turn quality into a promise. The thresholds of page 13 become clauses ("at least 99% of claims have a cause from the managed list"), measured at every load, with the result published next to the product.
Why it matters
Contracts move the cost of a change to the moment it is proposed, when it is cheap, instead of the morning three consumers break. For the merger, every product Harbour Mutual and Kestrel share (claims, customers, policies) gets one contract, so both companies' pipelines are held to the same promises.
Products and contracts are also what makes the decentralised operating models of page 18 workable: a domain can own and change its data only if its consumers are protected by a contract.
Where it goes wrong
- A product without an owner. A dataset renamed "product" with nobody to call is still a dataset.
- Contracts as documentation only. A contract that no pipeline checks drifts from the data within a release.
- Everything is minor. Lowering a threshold or delivering later feels harmless to the producer and breaks consumers.
- Versions with no overlap. Replacing version 1 with version 2 on the same day gives consumers no time to move.
- Products cut along systems. A product per source table recreates the source's model; cut products along what consumers need.
Check yourself
Choose an answer to each question, then press Check.
Sources
The works this page draws on, summarised in its own words rather than quoted. Read them for the full argument.
- Z. Dehghani, Data Mesh: Delivering Data-Driven Value at Scale (O'Reilly, 2022)Data as a product, the qualities a product needs, and input, output and discovery ports.
- Bitol project (LF AI & Data Foundation), Open Data Contract Standard, version 3.1.0The contract's sections: fundamentals, schema, quality, service levels, team, roles and terms.
- T. Preston-Werner, Semantic Versioning 2.0.0MAJOR.MINOR.PATCH and what each part promises about compatibility.
- A. Jones, Driving Data Quality with Data Contracts (Packt, 2023)Contracts as an interface between producers and consumers, enforced in the producer's pipeline.
Practise it
The chapters that put this theory to work on Harbour Mutual and Kestrel:
The tools to try it in:
- Contract editor · Write a data contract, validate it, and check whether a proposed change breaks its consumers.
Terms taught here: Data productOutput portData contractOpen Data Contract StandardBreaking changeSemantic versioningService level