# `crm@1` — Sales, proposals, grants, customer support and feedback

Version **1.1.0** · published 2026-12-02 · MIT

CRM records opportunities and their stage changes, commitments due, customer touchpoints, support queues and survey feedback.
A source can populate one area or several. The unused tables stay empty.

| Board | Reads |
|---|---|
| Sales Pipeline | Deals, stage history and activities for funnel conversion, velocity, forecast and stale opportunities |
| Customer Health | Company segment and renewal date, activities, tickets and surveys. Pair with billing identities using an explicit local mapping. |
| Support Desk | Ticket status, priority, topic and response or resolution timestamps |
| NPS & Feedback | Scored responses, source segments or linked company segments, and approved response themes |
| Proposal Pipeline | Proposal deals, close dates, outcomes and follow-up milestones |
| Grant Pipeline | Grant deals, requested and awarded amounts, decisions and application or report deadlines |

## Conventions

- **Identity.** Keys use a source namespace with an account or export scope and an opaque object ID. Use the source ID
  where it is stable. For ID-less data use a deterministic hash of a natural key with a stable duplicate
  occurrence. Keep keys stable across re-imports and row reorder. Link records only using an explicit source relation
  or a local mapping the person supplied. Leave unavailable links empty.
- **Privacy.** Store contact references as scoped opaque IDs or keyed pseudonyms. Keep names, email addresses, phone
  numbers and raw survey, support or activity text in the source. Use coarse roles, topic codes and reviewed themes in
  the database. Both the company and contact on a historical record describe the association at the time of that record.
- **Shared copies blank `companies.name` and `deals.label`.** They are the only free-text names this standard keeps, and
  they stay on the person's computer. `standard.json` lists them under `blank_when_shared`. Every board that pins crm@1
  defines `export_redact(db)` in its `tools/common.py` that sets both to NULL (the static export runs it on its copy
  before anything is written), and uses aggregate survey output when sharing. `tests/test_crm_standard.py` runs each such
  board's `export_redact` on the fixture and fails a board that leaves either column filled.
- **Stage order (1.1).** `deal_stages` lists a pipeline's stages in the team's order (`position` from 1) with what each
  means (open, won, lost) and its default probability, from the CRM's pipeline settings or the person's own list. A
  funnel and stage-to-stage conversion follow `position`. A pipeline with no rows has no known order: a board asks the
  person for one (a board input) and never sorts labels alphabetically as if that were the order.
- **Provenance.** The source, redacted reference and import instant identify every connector-written row. Confidence
  marks inferred classifications and probabilities when the table supports them. Compute `meta.data_hash` from
  stable normalized records sorted by primary key with import timestamps excluded. Use the same input scope for a comparison.
- **Time.** A `*_on` field is the source-local calendar date (`YYYY-MM-DD`), which can differ from the day of a UTC
  timestamp. A `*_at` field is a UTC instant ending in `Z`. Retain date-only inputs as dates. Calculate response and
  resolution times only for records with both required instants.
- **Money.** Amounts and awards are nonnegative major units with their source ISO 4217 currency. Aggregate within a
  currency or convert using a documented external rate. `meta.base_currency` gives the preferred reporting currency.
  A NULL amount, award or probability means it was unavailable. Zero is a recorded value. Probability is a decimal
  between 0 and 1. Forecast rows need an open deal with both an amount and a supported probability.
- **Stages.** `stage` retains the source's label. `state` gives a portable outcome; use `unknown` when the export or
  explicit mapping doesn't establish it. Use separate observed stage transitions for conversion and transition-time
  analysis. A snapshot alone can show the current stage and any source-provided stage start date.
- **Survey themes.** One link per response and approved theme gives a count of distinct responses tagged with that theme.
  Allow several themes on one response. Count only scored responses in the NPS denominator. The conventional
  groups are 0–6 (detractor), 7–8 (passive) and 9–10 (promoter).
- **Missing and unmapped rows.** Use `import_issues` to describe gaps or skipped rows using redacted source references.
  Leave unsupported optional values empty. A board import records an error and preserves the prior database if it
  cannot safely replace it.

## Sources that fill it

| Lane 1 export | Tables the source can fill |
|---|---|
| HubSpot, Pipedrive or Salesforce CSV | Companies, contacts, sales deals, stage changes where exported, activities |
| Proposal tool or spreadsheet CSV | Proposal deals and follow-up milestones |
| Grant spreadsheet CSV | Grant deals, application deadlines, decisions and report milestones |
| Zendesk, Help Scout or Intercom CSV | Tickets, topics and pseudonymous requester links |
| Survey tool CSV | NPS responses and approved theme codes |

This standard describes the normalized contract. Importer support is listed with each board.

## Compatibility

- A board that declares `crm@1 >=1.0` keeps working on later 1.x databases.
- Remixes that add metrics, pages and `x_<owner>_` tables survive each minor.
- A future breaking change uses a new major with a migration and metrics codemod.

## Fields

<!-- fields:begin (generated from schema.sql by spec/build.py; edit the DDL comments) -->

### `meta` (required table)

Metadata for the snapshot.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `key` | TEXT | **yes** | e.g. schema, schema_version, as_of, data_hash, source_built_at, base_currency |
| `value` | TEXT | no | text; as_of is a YYYY-MM-DD date |

### `companies` (required table)

One organization or account as identified by its source.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `company_id` | TEXT | **yes** | stable, namespaced organization id, e.g. crm-csv:fictional:company:1 |
| `name` | TEXT | no | optional organization display name; blanked in every shared copy (blank_when_shared) |
| `segment` | TEXT | no | source or person-assigned segment, e.g. small-team |
| `lifecycle` | TEXT (vocab `company_lifecycles`) | no | lead, customer, former_customer, other or unknown |
| `renewal_on` | TEXT (date) | no | next known renewal date; NULL when unavailable |
| `source` | TEXT | **yes** | connector id, e.g. crm-csv |
| `source_ref` | TEXT | **yes** | opaque object id or redacted file label and row |
| `imported_at` | TEXT (instant) | **yes** | UTC import instant, excluded from the data hash |
| `confidence` | TEXT (vocab `confidence`) | no | how a derived classification was set, if any |

### `contacts` (required table)

One pseudonymous contact, optionally linked to a primary company. Raw personal fields are excluded.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `contact_id` | TEXT | **yes** | namespaced opaque record id or keyed pseudonym; never a name, email or phone |
| `company_id` | TEXT | no | primary company if explicitly associated |
| `role` | TEXT (vocab `contact_roles`) | no | coarse role, e.g. decision_maker |
| `source` | TEXT | **yes** | connector id, e.g. crm-csv |
| `source_ref` | TEXT | **yes** | opaque object id or redacted file label and row |
| `imported_at` | TEXT (instant) | **yes** | UTC import instant, excluded from the data hash |
| `confidence` | TEXT (vocab `confidence`) | no | how an inferred role was set, if any |

### `deals` (required table)

One sale, proposal or grant application. A snapshot may include only the latest stage.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `deal_id` | TEXT | **yes** | stable, namespaced opportunity, proposal or application id |
| `company_id` | TEXT | no | known counterparty or funder, if explicitly associated |
| `contact_id` | TEXT | no | primary contact id, if available and explicitly associated |
| `kind` | TEXT (vocab `deal_kinds`) | **yes** | sale, proposal or grant |
| `label` | TEXT | no | optional reviewed display label with personal details removed; blanked in every shared copy (blank_when_shared) |
| `pipeline` | TEXT | no | source pipeline or grant program label, e.g. small-business-sales |
| `stage` | TEXT | no | current source stage label, preserving the source team's workflow |
| `state` | TEXT (vocab `deal_states`) | **yes** | normalized outcome: open, won, lost or unknown |
| `created_on` | TEXT (date) | no | recorded creation date, when known |
| `stage_changed_on` | TEXT (date) | no | recorded date the current stage began, when known |
| `expected_close_on` | TEXT (date) | no | expected close or decision date, when known |
| `closed_on` | TEXT (date) | no | actual close or decision date, when known |
| `amount` | REAL | no | proposed deal value or grant amount requested, in major units |
| `awarded_amount` | REAL | no | actual grant award when reported on a won grant; zero is permitted |
| `currency` | TEXT (currency) | no | ISO 4217 currency of both amount fields; required if either amount is present |
| `probability` | REAL | no | source or explicitly mapped probability of winning, as a decimal from 0 to 1 |
| `source` | TEXT | **yes** | connector id, e.g. proposals-csv |
| `source_ref` | TEXT | **yes** | opaque object id or redacted file label and row |
| `imported_at` | TEXT (instant) | **yes** | UTC import instant, excluded from the data hash |
| `confidence` | TEXT (vocab `confidence`) | no | how an inferred stage outcome or probability was set, if any |

### `deal_stage_changes`

One observed transition into a deal stage. Snapshot-only sources leave this table empty.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `change_id` | TEXT | **yes** | stable, namespaced stage history event id |
| `deal_id` | TEXT | **yes** | deal whose stage changed |
| `from_stage` | TEXT | no | previous source stage when available |
| `to_stage` | TEXT | **yes** | source stage entered |
| `changed_on` | TEXT (date) | **yes** | source-local day the transition occurred |
| `changed_at` | TEXT (instant) | no | UTC transition instant, when explicitly known |
| `source` | TEXT | **yes** | connector id, e.g. crm-csv |
| `source_ref` | TEXT | **yes** | opaque object id or redacted file label and row |
| `imported_at` | TEXT (instant) | **yes** | UTC import instant, excluded from the data hash |

### `deal_milestones`

One dated milestone attached to a deal, including recurring report deadlines as separate rows.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `milestone_id` | TEXT | **yes** | stable, namespaced milestone id |
| `deal_id` | TEXT | **yes** | deal this milestone belongs to |
| `kind` | TEXT (vocab `milestone_kinds`) | **yes** | follow_up, application_deadline, decision, report_due or other |
| `due_on` | TEXT (date) | **yes** | source-local deadline |
| `completed_on` | TEXT (date) | no | recorded completion date, when known |
| `source` | TEXT | **yes** | connector id, e.g. grants-csv |
| `source_ref` | TEXT | **yes** | opaque object id or redacted file label and row |
| `imported_at` | TEXT (instant) | **yes** | UTC import instant, excluded from the data hash |

### `activities` (required table)

One completed customer interaction or recorded touchpoint; free-form content stays in the source.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `activity_id` | TEXT | **yes** | stable, namespaced activity id |
| `company_id` | TEXT | no | known company, if explicitly associated |
| `contact_id` | TEXT | no | known contact, if explicitly associated |
| `deal_id` | TEXT | no | known opportunity, if explicitly associated |
| `kind` | TEXT (vocab `activity_kinds`) | **yes** | call, email, meeting, message, task or other |
| `occurred_on` | TEXT (date) | **yes** | local calendar day the interaction took place |
| `occurred_at` | TEXT (instant) | no | UTC instant, when explicitly known |
| `source` | TEXT | **yes** | connector id, e.g. crm-csv |
| `source_ref` | TEXT | **yes** | opaque object id or redacted file label and row |
| `imported_at` | TEXT (instant) | **yes** | UTC import instant, excluded from the data hash |

### `tickets` (required table)

One support issue or conversation, suitable for backlog and time-to-respond or resolve metrics.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `ticket_id` | TEXT | **yes** | stable, namespaced support issue id |
| `company_id` | TEXT | no | known company, if explicitly associated |
| `contact_id` | TEXT | no | known requester id, if explicitly associated |
| `status` | TEXT (vocab `ticket_statuses`) | **yes** | open, pending, resolved, closed or unknown |
| `priority` | TEXT (vocab `ticket_priorities`) | no | low, normal, high or urgent |
| `topic` | TEXT | no | coarse source topic code; keep subject lines and message bodies in the source |
| `created_on` | TEXT (date) | **yes** | source-local day the ticket was opened |
| `created_at` | TEXT (instant) | no | UTC instant the ticket was opened, when known |
| `first_response_at` | TEXT (instant) | no | first human reply as a UTC instant, when known |
| `resolved_on` | TEXT (date) | no | source-local day of final resolution, when known |
| `resolved_at` | TEXT (instant) | no | final resolution as a UTC instant, when known |
| `source` | TEXT | **yes** | connector id, e.g. support-csv |
| `source_ref` | TEXT | **yes** | opaque object id or redacted file label and row |
| `imported_at` | TEXT (instant) | **yes** | UTC import instant, excluded from the data hash |
| `confidence` | TEXT (vocab `confidence`) | no | how an inferred classification was set, if any |

### `survey_responses` (required table)

One survey response to an NPS question; anonymous rows and unscored feedback are supported.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `response_id` | TEXT | **yes** | stable, namespaced survey response id |
| `survey_key` | TEXT | **yes** | stable, namespaced survey id, e.g. survey-csv:fictional:s1 |
| `company_id` | TEXT | no | known company, if explicitly associated |
| `contact_id` | TEXT | no | optional opaque respondent id |
| `segment` | TEXT | no | coarse segment from the response, e.g. small-team |
| `responded_on` | TEXT (date) | **yes** | source-local response day |
| `responded_at` | TEXT (instant) | no | UTC response instant, when known |
| `nps_score` | INTEGER | no | integer 0 to 10 on the NPS question; NULL when unanswered |
| `source` | TEXT | **yes** | connector id, e.g. survey-csv |
| `source_ref` | TEXT | **yes** | opaque object id or redacted file label and row |
| `imported_at` | TEXT (instant) | **yes** | UTC import instant, excluded from the data hash |

### `survey_response_themes`

One approved, short theme label per response and theme, with no raw comment text.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `response_id` | TEXT | **yes** | owning response |
| `theme` | TEXT | **yes** | lowercase label using letters, digits, dashes or underscores, e.g. onboarding |
| `source` | TEXT | **yes** | connector id, e.g. survey-csv |
| `source_ref` | TEXT | **yes** | opaque tag record key or redacted file label and row |
| `imported_at` | TEXT (instant) | **yes** | UTC import instant, excluded from the data hash |
| `confidence` | TEXT (vocab `confidence`) | no | manual for a reviewed label; NULL for tags already provided by the source |

### `deal_stages`

The order of a pipeline's stages (1.1), from the CRM's pipeline settings or the person's own list, so a board can draw a funnel in the team's order and count conversion from each stage to the next. A pipeline without rows here has no known order: boards fall back to the board's own input and never sort stage labels alphabetically as if that were it.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `pipeline` | TEXT | **yes** | deals.pipeline, e.g. direct-sales |
| `stage` | TEXT | **yes** | deals.stage label exactly as the source writes it, e.g. Negotiation |
| `position` | INTEGER | **yes** | 1 for the first stage, increasing in the pipeline's order; unique within a pipeline |
| `state` | TEXT (vocab `deal_states`) | **yes** | what reaching the stage means: open, won or lost (vocab deal_states) |
| `probability` | REAL | no | the pipeline's default win probability for the stage, as a decimal from 0 to 1 |
| `source` | TEXT | **yes** | connector id, or inputs for the person's own list |
| `source_ref` | TEXT | **yes** | the settings export or the person's file and row |
| `imported_at` | TEXT | **yes** | UTC import instant, excluded from the data hash |

### `import_issues`

A structured account of what the importer skipped or needs reviewed.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `issue_id` | TEXT | **yes** | stable id |
| `severity` | TEXT (vocab `severities`) | **yes** | info, warn or error |
| `kind` | TEXT | **yes** | issue code, e.g. malformed_row |
| `title` | TEXT | **yes** | short summary with no personal details |
| `detail` | TEXT | **yes** | context using redacted references rather than personal details |
| `source_ref` | TEXT | no | opaque object id or redacted file label and row |
| `handling` | TEXT | **yes** | how the importer handled the issue |

### `annotations`

Notes on metrics and pages. Numbers only through {{metric:...}} placeholders.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `annotation_id` | TEXT | **yes** | stable id |
| `target` | TEXT | **yes** | metric id or page id |
| `kind` | TEXT | **yes** | note, caveat, flag, decision or open_item |
| `body` | TEXT | **yes** | user note text |
| `author` | TEXT | no | person or assistant |
| `source_ref` | TEXT | no | where it came from |
| `created_at` | TEXT (instant) | no | UTC instant |
| `data_hash` | TEXT | no | hash of the cited values when the note was written |
| `status` | TEXT | no | active, stale or retired |

### `overrides`

A person-provided correction to a classified field; source facts remain available.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `override_id` | TEXT | **yes** | stable id |
| `table_name` | TEXT | **yes** | which CRM fact table is being corrected |
| `row_id` | TEXT | **yes** | primary id of the record being corrected |
| `field` | TEXT | **yes** | column the connector allows to be corrected |
| `value` | TEXT | no | replacement value written by the person |
| `source_ref` | TEXT | no | reference to the person's local correction |

### `metric_registry`

The board's named metrics, installed from metrics.sql by the importer.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `metric_id` | TEXT | **yes** | e.g. pipeline.open_by_stage |
| `version` | INTEGER | no | metric version |
| `unit` | TEXT | no | display unit |
| `params` | TEXT | no | supported parameter names |
| `description` | TEXT | no | the metric's description |
| `sql` | TEXT | no | expanded SQL |
| `test` | TEXT | no | the metric's test description |

<!-- fields:end -->

## Vocabularies

Company lifecycles and contact roles classify relationships. Deal kinds and states classify the pipeline and outcome.
Milestone and activity kinds classify due commitments and completed interactions. Ticket statuses and priorities classify
backlog items. Confidence and issue severities use the same meanings as other DashRemix standards. Stage labels,
segments and approved theme codes stay source-specific.

## Developer checks

1.1 adds `deal_stages_valid` (fail; it reads only the new table, so no 1.0 database can fail it).


`checks.yaml` lists the conformance checks. `dashremix spec check path/to/data.db crm@1` runs them after the DDL,
meta key and JSON Schema checks. `fixtures/` supplies a complete fictional dataset.
