---
title: "Data contracts"
kind: "explain"
audiences: ["strategist","technical-partner","agent"]
track: "data-model"
date: "2026-10-15"
summary: "Where the lens and the research batch sit in the flow, what each block drives, and how a batch becomes Directory rows."
html_url: /library/learn/data-contracts
markdown_url: /library/learn/data-contracts.md
---

# Data contracts

Where the lens and the research batch sit in the flow, what each block drives, and how a batch becomes Directory rows.

**By the end:** You can place each contract in the flow, read a lens and a batch, and say why every item stays a proposal until a person accepts it.

How your data fits together · 13 min · Advanced

## Where each contract lives in the flow

Two contracts carry a market’s research. The lens says what the market looks at and what a producer may send. The batch carries what the producer found. Follow one batch from the lens to a received copy.

Figure: Where each contract lives in the flow

- **Lens** (Workspace configuration): Lens document, The market’s pin to its lens, Product lenses · imaging, asc, specialty
  - market_lens.v1: One lens per market: node kinds, facts, links and the view block.
- **Treaty read** (Public, product lenses only): imaging, asc, {lens, digest}
  - treaty: What to find, why each fact matters, the rules and our promises.
- **Producer** (Outside the Directory): Research-order run, MCP agent, A file made by hand
  - market_batch.v1: One file: nodes, facts with quotes, links, gaps.
- **Import door** (Preview, then commit): Validate, Match addresses, Preview plan, Attestation
- **Discovery** (Proposals): Batch run, Places, facts, links, Held items
- **Directory** (Accepted): Records, Facts and evidence, Links, Receipts
- **Views and copies** (Read, then frozen): Composed read, Views, Received copy · frozen
  - market_lens.v1: The view block draws the views. A share freezes the lens into the copy.

- Lens → Treaty read: **Publish**. A product lens is served by its fixed key.
- Treaty read → Producer: **Read**. The producer copies the digest and never computes it.
- Producer → Import door: **Send**. The author imports the batch onto a custom market.
- Import door → Discovery: **Stage**. Every item becomes a proposal or a hold. Nothing writes the Directory yet.
- Discovery → Directory: **Accept**. A person’s press. Policy accept is off today: every item stays a proposal until a person accepts it.
- Directory → Views and copies: **Composed read, then share**. Every view reads the result; a share freezes it.

## What each block of a lens drives

A lens names kinds; it never creates one. Each block feeds one part of the product. Flipping a dimension re-cuts every view and changes no data.

Figure: What each block of a lens drives

- `nodes`
- `facts`
- `edges`
- `view.dimensions`
- `view.panels`
- `view.layers`
- `treaty`
- **Import door · what a batch may send**
- **Record pane · Lens rows**
- **Table Operators · Structure**
- **Grouping control · Table columns**
- **Summary and Dashboard panels**
- **Full map · filter by, colour by**
- **Producer · what to find and why**

- nodes → Import door · what a batch may send
- facts → Import door · what a batch may send
- facts → Record pane · Lens rows
- edges → Import door · what a batch may send
- edges → Table Operators · Structure
- view.dimensions → Grouping control · Table columns
- view.panels → Summary and Dashboard panels
- view.layers → Full map · filter by, colour by
- treaty → Producer · what to find and why

## market_lens.v1: the imaging lens

The product imaging lens, version 2, without its treaty and each value’s words.

market_lens.v1 · imaging:

```json
{"contract": "market_lens.v1", "key": "imaging", "label": "Imaging",
 "version": 2,
 "nodes": {"site": "in", "organization": "in", "person": "in"},
 "facts": [
  {"key": "type", "kind": "site_type", "one": true,
   "values": ["imaging", "hospital"]},
  {"key": "modality", "kind": "imaging_modality", "one": false,
   "values": "all"},
  {"key": "status", "kind": "operating_status", "one": true,
   "values": "all"}],
 "edges": ["operates", "parent_of", "practices_at"],
 "view": {"key": "imaging", "label": "Imaging",
  "dimensions": ["site_type", "imaging_modality"],
  "panels": [{"kind": "mix", "dimension": "imaging_modality"},
             {"kind": "matrix", "dimension": "imaging_modality"},
             {"kind": "mix", "dimension": "site_type", "title": "Type"},
             {"kind": "coverage"}],
  "coverage": ["point", "operator", "type", "modality"],
  "layers": {"filter": "imaging_modality", "color": "site_type"}}}
```

- `nodes`: Node kinds in scope: in, reserved or read. A CMS lens reads people and takes none from a batch.
- `facts[].key`: The name a batch uses: type, modality, status.
- `facts[].kind`: The registered fact kind it maps to, such as imaging_modality.
- `facts[].one`: true: one value. false: a set of values.
- `edges`: The link types in scope. A new kind of tie is a contract change.
- `view.dimensions`: The axes every view can cut by.
- `view.panels`: The tiles the views draw, in order.
- `view.layers`: What the map filters by and colours by.

## How a batch becomes Directory rows

Each part of a batch has one place to go. Until an accept, every part waits in Discovery as a proposal.

Figure: How a batch becomes Directory rows

- `nodes[] · site`: name · address · status
- `nodes[] · organization`: name · domains
- `nodes[] · person`: name · nppes.npi
- `facts[]`: kind · value · basis; evidence · quote, url, seen
- `edges[]`: type · from · to · basis
- `ids[]`: web.url · nppes.npi · cms.ccn
- `gaps[]`: what · why
- **Site record**: matched by street, city, state, ZIP5
- **Organization record**: accepts with an accepted link
- **Connections proposal**: only a person accepts it
- **Record facts**: + evidence per quote; status → an operating_status fact
- **Links**: operates · parent_of: stated basis; practices_at: a person accepts
- **Identifier values**: values only, never an identity
- **Batch receipt**: staged · held · dropped · gaps

- nodes[] · site → Site record: address key
- nodes[] · organization → Organization record: domains
- nodes[] · person → Connections proposal: proposal
- facts[] → Record facts: quote → evidence
- edges[] → Links: link
- ids[] → Identifier values: values
- gaps[] → Batch receipt: receipt

A batch carries no coordinate: the server finds each point. A Google place id is refused.

## market_batch.v1: one research batch

One fictional site, one organization, and the link between them.

market_batch.v1 · one site:

```json
{"contract": "market_batch.v1", "batch_ref": "sac-imaging-example",
 "source": {"label": "Sacramento imaging", "producer": "research_order",
            "method": "web_verify"},
 "observed_on": "2026-10-12",
 "lens": {"key": "imaging", "version": 2, "digest": "<sha256 from the treaty read>"},
 "gaps": [{"what": "hospital outpatient imaging",
           "why": "registers under hospital NPIs"}],
 "nodes": [
  {"key": "n01", "kind": "site", "name": "Delta Ridge Imaging · Midtown",
   "address": {"street": "1400 Example Ave", "city": "Sacramento",
               "state": "CA", "zip5": "95816"},
   "status": {"value": "operating"},
   "facts": [{"kind": "modality", "value": "mri", "present": true,
     "basis": "stated", "confidence": 0.9, "quote_check": "exact",
     "evidence": [{"quote": "MRI and CT, Monday to Saturday.",
       "url": "https://deltaridge.example/midtown", "seen": "2026-10-12"}]}]},
  {"key": "o01", "kind": "organization", "name": "Delta Ridge Imaging Group",
   "domains": ["deltaridge.example"]}],
 "edges": [{"type": "operates", "from": "o01", "to": "n01", "basis": "stated",
   "evidence": [{"quote": "Delta Ridge Imaging Group operates three centers.",
     "url": "https://deltaridge.example/locations", "seen": "2026-10-12",
     "quote_check": "words"}]}]}
```

- `batch_ref`: The producer’s own reference. A replay of the same ref changes nothing.
- `lens`: The lens key, version and digest this batch answers.
- `gaps[]`: What the producer knows it did not cover, and why.
- `nodes[].key`: A name inside this file only. Never an identity.
- `nodes[].status`: operating, moved, closed, mobile_only, out_of_scope or not_found.
- `facts[].basis`: stated, derived or estimated. The door holds estimated.
- `facts[].confidence`: 0.9 and above: the page states it plainly. 0.7: derived. 0.5: unsure.
- `facts[].quote_check`: The producer’s own grade: exact, words, unverified or page_unavailable. Shown as “producer says”.
- `edges[].evidence`: The quote that states the link. No quote, no link.

## What the commit accepts by policy

Policy accept is off today. When you press Import, every item stays a proposal until a person accepts it. When the switch is on, the commit accepts each item that meets the rules below, through your own Accept door, and the receipt names each item.

- **A fact**: All four hold: a first-party quote; a quote check passed (exact or words); basis stated; confidence 0.8 or more.
- **A place**: A four-part address, no hold, an operating status that meets the policy, and one more fact that meets it.
- **An organization**: 1 to 8 domains and one quote that names it on its own host.
- **An operates or parent_of link**: Both ends accept, it has a quote, and its basis is stated.
- **Never by policy**: People, practices_at links, derived links, and vocabulary: a new kind, a new fact key or a lens publish.

## What a received copy carries

A share makes a frozen copy. It never refetches, and nothing in it writes the recipient’s Directory.

Figure: What a received copy carries

- **Sacramento imaging** (Your market): Directory records and facts; Book fields and notes; Customer datasets
- **Frozen at share** (Received copy): the lens, as it was; the service-line mapping, as it was; exportable face values, no quotes; the CMS edition, with its date; briefs and scenes you chose
- **Never travels** (Stays with you): Book fields; customer datasets; quotes and evidence; notes

- Sacramento imaging → Frozen at share: share
- Sacramento imaging → Never travels: kept (dashed)

## Related modules

- [The Directory and the data flow](the-directory.md): How data moves from outside sources to your screen, and how the Directory holds it as records, facts and links.
- [CMS data](cms-data.md): How CMS publishes clinicians, organizations and addresses, how an edition folds into your record graph, and how to read the figures.
- [Market graph channels](market-graph-channels.md): mydoclist · the seam between a market report, its sources, the Directory and Book
