{
  "name": "data-model",
  "version": "0.6.1",
  "description": "Concept to table in three layers: concepts, entities and attributes, then databases, schemas, tables, columns, indexes, constraints, views and grants. Seventeen rules keep the model honest, including that every foreign key points at one primary key of the same type and every relational datastore has a database.",
  "license": "Apache-2.0",
  "publisher": "trumly",
  "namespace": "dm",
  "tier": "verified",
  "role": "enrichment",
  "useWhen": "When you need to say what is inside a datastore: the concepts, the entities and attributes, then the databases, schemas, tables, columns and indexes that realise them.",
  "enriches": [
    "datastore"
  ],
  "requires": [
    "core@^1.0.0"
  ],
  "optional": [
    "links@^1.0.0"
  ],
  "includes": [],
  "sha256": "0cd292ed5957cd580d7e895ba123c955a8cee0d6f7543ce95569d5dd49722649",
  "files": [
    [
      "dm--conceptual",
      "---\nid: dm--conceptual\ntype: plane\ntitle: Conceptual\nfields:\n  order: 1\n  pack: data-model@0.6.1\n  stack: Data model\n---\n\nWhat the business talks about, before any structure.\n"
    ],
    [
      "dm--derived-column-handle",
      "---\nid: dm--derived-column-handle\ntype: derived\ntitle: Column handle\nfields:\n  name: column-handle\n  field-name: handle\n  description: A column is named by its table and its own title.\n  template: '{^data-contains/title}.{title}'\n  applies_to:\n    type: data-column\n  enabled: true\n  pack: data-model@0.6.1\n---\n`job_event.job_id`: the table that contains the column, then the column.\n"
    ],
    [
      "dm--derived-constraint-handle",
      "---\nid: dm--derived-constraint-handle\ntype: derived\ntitle: Constraint handle\nfields:\n  name: constraint-handle\n  field-name: handle\n  description: A constraint is named by its kind and the table it constrains.\n  template: '{kind}_{data-constrains/title}'\n  applies_to:\n    type: data-constraint\n  enabled: true\n  pack: data-model@0.6.1\n---\n`unique_job_event`. Add the columns to the constraint's title if one table has several of the same kind.\n"
    ],
    [
      "dm--derived-index-handle",
      "---\nid: dm--derived-index-handle\ntype: derived\ntitle: Index handle\nfields:\n  name: index-handle\n  field-name: handle\n  description: An index is named ix, its table and the column it covers.\n  template: 'ix_{data-indexes/^data-contains/title}_{data-indexes/title}'\n  applies_to:\n    type: data-index\n  enabled: true\n  pack: data-model@0.6.1\n---\n`ix_job_event_job_id`. The `ix` is written into the template, so the handle needs only the index's table and column.\n"
    ],
    [
      "dm--derived-relation-handle",
      "---\nid: dm--derived-relation-handle\ntype: derived\ntitle: Table and view handle\nfields:\n  name: relation-handle\n  field-name: handle\n  description: A table or view is named by its title.\n  template: '{title}'\n  applies_to:\n    type:\n    - data-table\n    - data-view\n  enabled: true\n  pack: data-model@0.6.1\n---\nTitle the table with its real name (`job`) and the handle is the same, so a search for the live table finds it.\n"
    ],
    [
      "dm--link-type-data-constrains",
      "---\nid: dm--link-type-data-constrains\ntype: link-type\ntitle: governs\nfields:\n  description: A constraint applies to a table or to the columns it covers.\n  from:\n  - data-constraint\n  inverse: constrained-by\n  name: data-constrains\n  to:\n  - data-table\n  - data-column\n  label: governs\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--link-type-data-contains",
      "---\nid: dm--link-type-data-contains\ntype: link-type\ntitle: contains\nfields:\n  description: 'Something sits inside another: a database in a server, a column in a table.'\n  from:\n  - data-db-server\n  - data-database\n  - data-schema\n  - data-table\n  - data-entity\n  inverse: contained-by\n  label: contains\n  name: data-contains\n  pack: data-model@0.6.1\n  to:\n  - data-database\n  - data-schema\n  - data-table\n  - data-view\n  - data-proc\n  - data-column\n  - data-index\n  - data-constraint\n  - data-attribute\n---\n"
    ],
    [
      "dm--link-type-data-derives-from",
      "---\nid: dm--link-type-data-derives-from\ntype: link-type\ntitle: derives-from\nfields:\n  description: A view is built from tables or columns.\n  from:\n  - data-view\n  inverse: source-of\n  name: data-derives-from\n  to:\n  - data-table\n  - data-column\n  label: derives-from\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--link-type-data-grants",
      "---\nid: dm--link-type-data-grants\ntype: link-type\ntitle: grants\nfields:\n  description: A grant gives access to an object.\n  from:\n  - data-grant\n  inverse: granted-on\n  name: data-grants\n  to:\n  - data-database\n  - data-schema\n  - data-table\n  - data-view\n  - data-proc\n  label: grants\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--link-type-data-has-many",
      "---\nid: dm--link-type-data-has-many\ntype: link-type\ntitle: has-many\nfields:\n  description: One of these relates to many of those.\n  from:\n  - data-entity\n  - data-table\n  inverse: belongs-to\n  label: has-many\n  name: data-has-many\n  pack: data-model@0.6.1\n  to:\n  - data-entity\n  - data-table\n---\n"
    ],
    [
      "dm--link-type-data-has-one",
      "---\nid: dm--link-type-data-has-one\ntype: link-type\ntitle: has-one\nfields:\n  description: One of these relates to exactly one of those.\n  from:\n  - data-entity\n  - data-table\n  inverse: is-one-of\n  label: has-one\n  name: data-has-one\n  pack: data-model@0.6.1\n  to:\n  - data-entity\n  - data-table\n---\n"
    ],
    [
      "dm--link-type-data-holds",
      "---\nid: dm--link-type-data-holds\ntype: link-type\ntitle: holds\nfields:\n  description: A user holds a grant.\n  from:\n  - data-user\n  inverse: held-by\n  name: data-holds\n  to:\n  - data-grant\n  label: holds\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--link-type-data-indexes",
      "---\nid: dm--link-type-data-indexes\ntype: link-type\ntitle: indexes\nfields:\n  description: An index covers a column.\n  from:\n  - data-index\n  inverse: indexed-by\n  name: data-indexes\n  to:\n  - data-column\n  label: indexes\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--link-type-data-realised-by",
      "---\nid: dm--link-type-data-realised-by\ntype: link-type\ntitle: realised-by\nfields:\n  description: 'A higher level thing carried out one level down: concept to entity, entity to table, attribute\n    to column.'\n  from:\n  - data-concept\n  - data-entity\n  - data-attribute\n  inverse: realises\n  label: realised-by\n  name: data-realised-by\n  pack: data-model@0.6.1\n  to:\n  - data-entity\n  - data-attribute\n  - data-table\n  - data-column\n---\n"
    ],
    [
      "dm--link-type-data-references",
      "---\nid: dm--link-type-data-references\ntype: link-type\ntitle: references\nfields:\n  description: 'A foreign key: this column points at another column.'\n  from:\n  - data-column\n  inverse: referenced-by\n  name: data-references\n  to:\n  - data-column\n  label: references\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--link-type-data-relates-to",
      "---\nid: dm--link-type-data-relates-to\ntype: link-type\ntitle: relates-to\nfields:\n  description: A loose relationship between any two things.\n  from: []\n  inverse: related-to\n  label: relates-to\n  name: data-relates-to\n  pack: data-model@0.6.1\n  to: []\n---\n"
    ],
    [
      "dm--logical",
      "---\nid: dm--logical\ntype: plane\ntitle: Logical\nfields:\n  order: 2\n  pack: data-model@0.6.1\n  stack: Data model\n---\n\nEntities and attributes, independent of any database.\n"
    ],
    [
      "dm--pack",
      "---\nid: dm--pack\ntype: pack\ntitle: Data model\nfields:\n  name: data-model\n  namespace: dm\n  version: 0.6.1\n  description: 'Concept to table in three layers: concepts, entities and attributes, then databases, schemas,\n    tables, columns, indexes, constraints, views and grants. Seventeen rules keep the model honest, including\n    that every foreign key points at one primary key of the same type and every relational datastore has a database.'\n  license: Apache-2.0\n  publisher: trumly\n  role: enrichment\n  default-pattern: starter-data-model\n  starter-patterns:\n  - starter-data-model\n  enriches:\n  - datastore\n  use-when: 'When you need to say what is inside a datastore: the concepts, the entities and attributes,\n    then the databases, schemas, tables, columns and indexes that realise them.'\n  requires:\n  - core@^1.0.0\n  optional:\n  - links@^1.0.0\n---\n"
    ],
    [
      "dm--physical",
      "---\nid: dm--physical\ntype: plane\ntitle: Physical\nfields:\n  order: 3\n  pack: data-model@0.6.1\n  stack: Data model\n---\n\nTables, columns and the database they live in.\n"
    ],
    [
      "dm--rule-attribute-in-entity",
      "---\nid: dm--rule-attribute-in-entity\ntype: rule\ntitle: Attributes belong to an entity\nfields:\n  name: Attributes belong to an entity\n  applies_to:\n    type: data-attribute\n  check:\n    require_link:\n    - dir: in\n      max: 1\n      min: 1\n      node_type: data-entity\n      type: data-contains\n  pack: data-model@0.6.1\n  severity: warn\n  statement: Attributes belong to one entity\n---\n"
    ],
    [
      "dm--rule-column-in-table",
      "---\nid: dm--rule-column-in-table\ntype: rule\ntitle: Columns belong to a table\nfields:\n  name: Columns belong to a table\n  applies_to:\n    type: data-column\n  check:\n    require_link:\n    - dir: in\n      max: 1\n      min: 1\n      node_type: data-table\n      type: data-contains\n  pack: data-model@0.6.1\n  severity: warn\n  statement: Columns belong to one table\n---\n"
    ],
    [
      "dm--rule-concept-becomes-entity",
      "---\nid: dm--rule-concept-becomes-entity\ntype: rule\ntitle: Concepts become entities\nfields:\n  name: Concepts become entities\n  applies_to:\n    type: data-concept\n  check:\n    require_link:\n    - min: 1\n      node_type: data-entity\n      type: data-realised-by\n  pack: data-model@0.6.1\n  severity: info\n  statement: Every concept becomes an entity\n---\n"
    ],
    [
      "dm--rule-constraint-applies",
      "---\nid: dm--rule-constraint-applies\ntype: rule\ntitle: Constraints apply to something\nfields:\n  name: Constraints apply to something\n  applies_to:\n    type: data-constraint\n  check:\n    require_link:\n    - min: 1\n      type: data-constrains\n  severity: warn\n  statement: Every constraint applies to something\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--rule-database-in-server",
      "---\nid: dm--rule-database-in-server\ntype: rule\ntitle: Databases run in servers\nfields:\n  name: Databases run in servers\n  applies_to:\n    type: data-database\n  check:\n    require_link:\n    - dir: in\n      min: 1\n      node_type: data-db-server\n      type: data-contains\n  pack: data-model@0.6.1\n  severity: warn\n  statement: Databases run in servers\n---\n"
    ],
    [
      "dm--rule-database-realises-datastore",
      "---\nid: dm--rule-database-realises-datastore\ntype: rule\ntitle: Databases realise a datastore\nfields:\n  name: Databases realise a datastore\n  statement: Every database details a datastore in the design\n  severity: warn\n  applies_to:\n    type: data-database\n  check:\n    any_of:\n    - require_link:\n        min: 1\n        type: details\n        node_type: datastore\n  pack: data-model@0.6.1\n---\n**Why:** the physical database is how a datastore decision is carried out. Without the link the design cannot say where its data lives.\n\n**Fix:** add a `details` link to the datastore this database is.\n"
    ],
    [
      "dm--rule-datastore-modelled",
      "---\nid: dm--rule-datastore-modelled\ntype: rule\ntitle: Stores have a database\nfields:\n  name: Stores have a database\n  statement: Every relational datastore has a database\n  severity: warn\n  applies_to:\n    type: datastore\n    kind:\n    - relational\n  check:\n    require_link:\n      min: 1\n      type: details\n      dir: in\n      node_type: data-database\n  pack: data-model@0.6.1\n---\n**Why:** the design says there is a relational store; the data model should say where its tables live.\n\n**Fix:** add a database and `details` the datastore from it.\n"
    ],
    [
      "dm--rule-entity-built",
      "---\nid: dm--rule-entity-built\ntype: rule\ntitle: Entities are built as tables\nfields:\n  name: Entities are built as tables\n  applies_to:\n    type: data-entity\n  check:\n    require_link:\n    - min: 1\n      node_type: data-table\n      type: data-realised-by\n  pack: data-model@0.6.1\n  severity: info\n  statement: Every entity is built as a table\n---\n"
    ],
    [
      "dm--rule-fk-references-pk",
      "---\nid: dm--rule-fk-references-pk\ntype: rule\ntitle: Foreign keys reference a key\nfields:\n  name: Foreign keys reference a key\n  applies_to:\n    foreign_key: true\n    type: data-column\n  check:\n    require_link:\n    - max: 1\n      min: 1\n      node_fields:\n        primary_key: true\n      node_type: data-column\n      same_fields:\n      - data_type\n      type: data-references\n  severity: warn\n  statement: Foreign key columns reference one primary key\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--rule-index-covers-column",
      "---\nid: dm--rule-index-covers-column\ntype: rule\ntitle: Indexes cover a column\nfields:\n  name: Indexes cover a column\n  applies_to:\n    type: data-index\n  check:\n    require_link:\n    - min: 1\n      node_type: data-column\n      type: data-indexes\n  severity: warn\n  statement: Every index covers a column\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--rule-names-fit-limit",
      "---\nid: dm--rule-names-fit-limit\ntype: rule\ntitle: Names fit the database limit\nfields:\n  name: Names fit the database limit\n  statement: A table, view, index or constraint name fits PostgreSQL's 63-byte identifier limit\n  severity: warn\n  applies_to:\n    type:\n    - data-table\n    - data-view\n    - data-index\n    - data-constraint\n  check:\n    field_is:\n      handle:\n        max_bytes: 63\n        optional: true\n  pack: data-model@0.6.1\n---\n**Why:** PostgreSQL cuts an identifier longer than 63 bytes, so two long names can end up the same. The limit is in bytes, not characters: accented letters take more than one.\n\nThe check reads each object's calculated `handle`, so it only measures a name the model can work out. A column's handle includes its table (`job_event.job_id`), so columns are left out: it is the column name alone that has the limit. Lower the number in a copy of this rule for another engine.\n"
    ],
    [
      "dm--rule-object-name-fits",
      "---\nid: dm--rule-object-name-fits\ntype: rule\ntitle: Object names fit the limit\nfields:\n  name: Object names fit the limit\n  statement: A column, schema or database name is at most 63 bytes\n  severity: warn\n  applies_to:\n    type:\n    - data-column\n    - data-schema\n    - data-database\n  check:\n    field_is:\n      title:\n        max_bytes: 63\n  pack: data-model@0.6.1\n---\n**Why:** PostgreSQL cuts identifiers longer than 63 bytes, so two long names can collapse into one, and accented letters take more than one byte. These objects are named by their title (tables, views, indexes and constraints are checked on their calculated name).\n\n**Fix:** shorten the title.\n"
    ],
    [
      "dm--rule-schema-in-database",
      "---\nid: dm--rule-schema-in-database\ntype: rule\ntitle: Schemas live in a database\nfields:\n  name: Schemas live in a database\n  applies_to:\n    type: data-schema\n  check:\n    require_link:\n    - dir: in\n      max: 1\n      min: 1\n      node_type: data-database\n      type: data-contains\n  pack: data-model@0.6.1\n  severity: warn\n  statement: Schemas live in a database\n---\n"
    ],
    [
      "dm--rule-table-in-schema",
      "---\nid: dm--rule-table-in-schema\ntype: rule\ntitle: Tables live in a schema\nfields:\n  name: Tables live in a schema\n  applies_to:\n    type: data-table\n  check:\n    require_link:\n    - dir: in\n      max: 1\n      min: 1\n      node_type: data-schema\n      type: data-contains\n  pack: data-model@0.6.1\n  severity: warn\n  statement: Tables live in a schema\n---\n"
    ],
    [
      "dm--rule-table-pk",
      "---\nid: dm--rule-table-pk\ntype: rule\ntitle: Tables have a primary key\nfields:\n  name: Tables have a primary key\n  applies_to:\n    type: data-table\n  check:\n    require_link:\n    - min: 1\n      node_fields:\n        primary_key: true\n      node_type: data-column\n      type: data-contains\n  pack: data-model@0.6.1\n  severity: warn\n  statement: Every table has a primary key\n---\n"
    ],
    [
      "dm--rule-table-realises-entity",
      "---\nid: dm--rule-table-realises-entity\ntype: rule\ntitle: Tables realise an entity\nfields:\n  name: Tables realise an entity\n  statement: Every table realises an entity\n  severity: warn\n  applies_to:\n    type: data-table\n  check:\n    require_link:\n      min: 1\n      type: data-realised-by\n      dir: in\n      node_type: data-entity\n  pack: data-model@0.6.1\n---\n**Why:** a table with no entity behind it has no stated meaning, and the logical model drifts from the database.\n\n**Fix:** link the entity to the table with `data-realised-by`.\n"
    ],
    [
      "dm--rule-view-from-table",
      "---\nid: dm--rule-view-from-table\ntype: rule\ntitle: Views are built from tables\nfields:\n  name: Views are built from tables\n  applies_to:\n    type: data-view\n  check:\n    require_link:\n    - min: 1\n      node_type: data-table\n      type: data-derives-from\n  severity: info\n  statement: Every view is built from a table\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-attribute",
      "---\nid: dm--type-data-attribute\ntype: type\ntitle: attribute\nfields:\n  description: A logical attribute of an entity.\n  fields:\n  - kind: choice\n    name: data_type\n    required: true\n    values:\n    - text\n    - number\n    - boolean\n    - date\n    - timestamp\n    - identifier\n    - binary\n  - kind: boolean\n    name: mandatory\n  name: data-attribute\n  plane: dm--logical\n  shape: circle 2d\n  label: attribute\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-column",
      "---\nid: dm--type-data-column\ntype: type\ntitle: data-column\nfields:\n  description: A column of a table.\n  fields:\n  - kind: choice\n    name: data_type\n    required: true\n    values:\n    - text\n    - integer\n    - decimal\n    - boolean\n    - date\n    - timestamp\n    - uuid\n    - json\n    - binary\n  - kind: boolean\n    name: nullable\n  - kind: boolean\n    name: primary_key\n  - kind: boolean\n    name: foreign_key\n  label: column\n  name: data-column\n  plane: dm--physical\n  shape: circle 2d\n  pack: data-model@0.6.1\n---\n\n**Names:** the title is the name, in snake case and singular (`customer_id`). A foreign key column is the referenced table in the singular plus `_id`. Booleans start with `is_` or `has_`; timestamps end with `_at`. 63 characters is the PostgreSQL identifier limit.\n"
    ],
    [
      "dm--type-data-concept",
      "---\nid: dm--type-data-concept\ntype: type\ntitle: data-concept\nfields:\n  description: 'A business idea at the conceptual level: a thing the organisation talks about, with no\n    structure yet.'\n  fields: []\n  label: concept\n  name: data-concept\n  plane: dm--conceptual\n  shape: cloud 2d\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-constraint",
      "---\nid: dm--type-data-constraint\ntype: type\ntitle: data-constraint\nfields:\n  description: 'A rule the database enforces on a table or columns: unique, check, not null or default.'\n  fields:\n  - kind: choice\n    name: kind\n    required: true\n    values:\n    - unique\n    - check\n    - not-null\n    - default\n  - kind: text\n    name: expression\n  label: constraint\n  name: data-constraint\n  plane: dm--physical\n  shape: hexagon 2d\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-database",
      "---\nid: dm--type-data-database\ntype: type\ntitle: data-database\nfields:\n  description: A database on a server.\n  fields: []\n  label: database\n  name: data-database\n  plane: dm--physical\n  shape: database up\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-db-server",
      "---\nid: dm--type-data-db-server\ntype: type\ntitle: data-db-server\nfields:\n  description: A database server or instance that hosts databases.\n  fields: []\n  label: db-server\n  name: data-db-server\n  plane: dm--physical\n  shape: octagon 2d\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-entity",
      "---\nid: dm--type-data-entity\ntype: type\ntitle: data-entity\nfields:\n  description: 'A logical entity: a thing with attributes and relationships, independent of any database.'\n  fields: []\n  label: entity\n  name: data-entity\n  plane: dm--logical\n  shape: square 2d\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-grant",
      "---\nid: dm--type-data-grant\ntype: type\ntitle: data-grant\nfields:\n  description: A permission given to a user on an object.\n  fields: []\n  label: grant\n  name: data-grant\n  plane: dm--physical\n  shape: shield 2d\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-index",
      "---\nid: dm--type-data-index\ntype: type\ntitle: data-index\nfields:\n  description: An index on one or more columns of a table.\n  fields:\n  - kind: boolean\n    name: unique\n  label: index\n  name: data-index\n  plane: dm--physical\n  shape: triangle 2d\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-proc",
      "---\nid: dm--type-data-proc\ntype: type\ntitle: data-proc\nfields:\n  description: A stored procedure or function.\n  fields: []\n  label: proc\n  name: data-proc\n  plane: dm--physical\n  shape: chevron 2d\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-schema",
      "---\nid: dm--type-data-schema\ntype: type\ntitle: data-schema\nfields:\n  description: A namespace of tables, views and procedures inside a database.\n  fields: []\n  label: schema\n  name: data-schema\n  plane: dm--physical\n  shape: folder 2d\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-table",
      "---\nid: dm--type-data-table\ntype: type\ntitle: data-table\nfields:\n  description: A physical table.\n  fields: []\n  label: table\n  name: data-table\n  plane: dm--physical\n  shape: square 2d\n  pack: data-model@0.6.1\n---\n\n**Names:** the title is the name, in snake case (`work_orders`). Choose singular or plural and keep to it across the model; the ops example uses singular (`job`). 63 characters is the PostgreSQL identifier limit; lower it for other engines.\n"
    ],
    [
      "dm--type-data-user",
      "---\nid: dm--type-data-user\ntype: type\ntitle: data-user\nfields:\n  description: A database user or role.\n  fields: []\n  label: user\n  name: data-user\n  plane: dm--physical\n  shape: person 2d\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "dm--type-data-view",
      "---\nid: dm--type-data-view\ntype: type\ntitle: data-view\nfields:\n  description: A stored query presented as a table.\n  fields: []\n  label: view\n  name: data-view\n  plane: dm--physical\n  shape: document 2d\n  pack: data-model@0.6.1\n---\n"
    ],
    [
      "examples/ops-api-data/acceptance-criterion-jobs-listed",
      "---\nid: acceptance-criterion-jobs-listed\ntype: acceptance-criterion\ntitle: Jobs listed\nplane: def--requirements\nfields:\n  given: A job has just changed state\n  when: Ops staff open the job list\n  then: The job and its new state are shown within 60 seconds\n  method: test\n---\n"
    ],
    [
      "examples/ops-api-data/actor-ops-staff",
      "---\nid: actor-ops-staff\ntype: actor\ntitle: Ops staff\nplane: def--capabilities\nlinks:\n  - type: uses\n    to: component-ops-api\n---\n"
    ],
    [
      "examples/ops-api-data/attr-event-happened",
      "---\nid: attr-event-happened\ntype: data-attribute\ntitle: happened\nplane: dm--logical\nfields:\n  data_type: timestamp\n  mandatory: true\n---\n\n"
    ],
    [
      "examples/ops-api-data/attr-event-state",
      "---\nid: attr-event-state\ntype: data-attribute\ntitle: state\nplane: dm--logical\nfields:\n  data_type: text\n  mandatory: true\n---\n\n"
    ],
    [
      "examples/ops-api-data/attr-job-state",
      "---\nid: attr-job-state\ntype: data-attribute\ntitle: state\nplane: dm--logical\nfields:\n  data_type: text\n  mandatory: true\n---\n\n"
    ],
    [
      "examples/ops-api-data/attr-job-updated",
      "---\nid: attr-job-updated\ntype: data-attribute\ntitle: updated\nplane: dm--logical\nfields:\n  data_type: timestamp\n  mandatory: true\n---\n\n"
    ],
    [
      "examples/ops-api-data/capability-view-job-status",
      "---\nid: capability-view-job-status\ntype: capability\ntitle: View job status\nplane: def--capabilities\nfields:\n  statement: view the current status of every job\n  scope: in\n  priority: must\n  status: proposed\nlinks:\n  - type: performed-by\n    to: actor-ops-staff\n  - type: derives-from\n    to: goal-timely-visibility\n---\n"
    ],
    [
      "examples/ops-api-data/col-event-happened",
      "---\nid: col-event-happened\ntype: data-column\ntitle: happened\nplane: dm--physical\nfields:\n  data_type: timestamp\n  nullable: false\n---\n\n"
    ],
    [
      "examples/ops-api-data/col-event-id",
      "---\nid: col-event-id\ntype: data-column\ntitle: id\nplane: dm--physical\nfields:\n  data_type: uuid\n  primary_key: true\n  nullable: false\n---\n\n"
    ],
    [
      "examples/ops-api-data/col-event-job",
      "---\nid: col-event-job\ntype: data-column\ntitle: job_id\nplane: dm--physical\nfields:\n  data_type: uuid\n  foreign_key: true\n  nullable: false\nlinks:\n- type: data-references\n  to: col-job-id\n---\n\n"
    ],
    [
      "examples/ops-api-data/col-event-state",
      "---\nid: col-event-state\ntype: data-column\ntitle: state\nplane: dm--physical\nfields:\n  data_type: text\n  nullable: false\n---\n\n"
    ],
    [
      "examples/ops-api-data/col-job-id",
      "---\nid: col-job-id\ntype: data-column\ntitle: id\nplane: dm--physical\nfields:\n  data_type: uuid\n  primary_key: true\n  nullable: false\n---\n\n"
    ],
    [
      "examples/ops-api-data/col-job-state",
      "---\nid: col-job-state\ntype: data-column\ntitle: state\nplane: dm--physical\nfields:\n  data_type: text\n  nullable: false\n---\n\n"
    ],
    [
      "examples/ops-api-data/col-job-updated",
      "---\nid: col-job-updated\ntype: data-column\ntitle: updated\nplane: dm--physical\nfields:\n  data_type: timestamp\n  nullable: false\n---\n\n"
    ],
    [
      "examples/ops-api-data/component-ops-api",
      "---\nid: component-ops-api\ntype: component\ntitle: Ops API\nplane: dsn--design\nfields:\n  kind: service\n  owner: Platform\n  status: planned\nlinks:\n  - type: satisfies\n    to: requirement-list-jobs\n  - type: writes\n    to: datastore-ops-db\n  - type: runs-in\n    to: environment-production\n---\n\nServes the list of jobs and their status to operations staff.\n"
    ],
    [
      "examples/ops-api-data/concept-job-event",
      "---\nid: concept-job-event\ntype: data-concept\ntitle: Job event\nplane: dm--conceptual\nlinks:\n- type: data-realised-by\n  to: entity-job-event\n---\n\n"
    ],
    [
      "examples/ops-api-data/concept-job",
      "---\nid: concept-job\ntype: data-concept\ntitle: Job\nplane: dm--conceptual\nlinks:\n- type: data-realised-by\n  to: entity-job\n- type: data-relates-to\n  to: concept-job-event\n---\n\n"
    ],
    [
      "examples/ops-api-data/constraint-event-unique",
      "---\nid: constraint-event-unique\ntype: data-constraint\ntitle: One event per job and moment\nplane: dm--physical\nfields:\n  kind: unique\nlinks:\n- type: data-constrains\n  to: table-job-event\n---\nA job cannot record two events at the same instant.\n"
    ],
    [
      "examples/ops-api-data/database-ops",
      "---\nid: database-ops\ntype: data-database\ntitle: ops\nplane: dm--physical\nlinks:\n- type: details\n  to: datastore-ops-db\n- type: data-contains\n  to: schema-public\n---\n\n"
    ],
    [
      "examples/ops-api-data/datastore-ops-db",
      "---\nid: datastore-ops-db\ntype: datastore\ntitle: Ops db\nplane: dsn--design\nfields:\n  kind: relational\n  owner: Platform\n---\n\nHolds every job and its latest status.\n"
    ],
    [
      "examples/ops-api-data/entity-job-event",
      "---\nid: entity-job-event\ntype: data-entity\ntitle: Job event\nplane: dm--logical\nlinks:\n- type: data-contains\n  to: attr-event-state\n- type: data-contains\n  to: attr-event-happened\n- type: data-realised-by\n  to: table-job-event\n---\n\n"
    ],
    [
      "examples/ops-api-data/entity-job",
      "---\nid: entity-job\ntype: data-entity\ntitle: Job\nplane: dm--logical\nlinks:\n- type: data-contains\n  to: attr-job-state\n- type: data-contains\n  to: attr-job-updated\n- type: data-has-many\n  to: entity-job-event\n- type: data-realised-by\n  to: table-job\n---\n\n"
    ],
    [
      "examples/ops-api-data/environment-production",
      "---\nid: environment-production\ntype: environment\ntitle: Production\nplane: dsn--design\nfields:\n  code: prd\n  kind: production\n---\n\nThe live system that operations staff use.\n"
    ],
    [
      "examples/ops-api-data/example",
      "---\nid: example\ntype: example\ntitle: Jobs, concept to table\nfields:\n  title: Jobs, concept to table\n  description: Job and Job event as concepts, then entities and attributes, then the managed Postgres server, the ops database, tables, columns, a foreign key, an index, a constraint and a view.\n  use: starter\n  requires:\n  - data-model\n  - core\n---\n"
    ],
    [
      "examples/ops-api-data/goal-timely-visibility",
      "---\nid: goal-timely-visibility\ntype: goal\ntitle: Timely ops visibility\nplane: def--intent\nfields:\n  statement: Operations staff see the state of every job within a minute.\n  status: proposed\nlinks:\n  - type: measured-by\n    to: metric-status-freshness\n---\n"
    ],
    [
      "examples/ops-api-data/increment-live-status",
      "---\nid: increment-live-status\ntype: increment\ntitle: Live job status\nplane: pln--plan\nfields:\n  status: planned\nlinks:\n  - type: enables\n    to: capability-view-job-status\n---\n\nThe first slice: staff can see live job status.\n"
    ],
    [
      "examples/ops-api-data/index-event-job",
      "---\nid: index-event-job\ntype: data-index\ntitle: events by job\nplane: dm--physical\nfields:\n  unique: false\nlinks:\n- type: data-indexes\n  to: col-event-job\n---\n\n"
    ],
    [
      "examples/ops-api-data/metric-status-freshness",
      "---\nid: metric-status-freshness\ntype: metric\ntitle: Job status age\nplane: def--intent\nfields:\n  kind: success\n  unit: seconds\n  direction: lower-is-better\n  target: 60\n  how-measured: Age of the newest status for each job, sampled every minute\n---\n"
    ],
    [
      "examples/ops-api-data/overview",
      "---\nid: overview\ntype: overview\ntitle: Ops API\nplane: abt--about\nfields:\n  purpose: A status API so operations staff can see what every job is doing.\n  audience: The build team and operations staff\n  owner: Platform\n  stage: design\n---\n"
    ],
    [
      "examples/ops-api-data/requirement-list-jobs",
      "---\nid: requirement-list-jobs\ntype: requirement\ntitle: List jobs\nplane: def--requirements\nfields:\n  statement: The system shall list every job with its current status.\n  kind: functional\n  priority: must\n  status: proposed\nlinks:\n  - type: verified-by\n    to: acceptance-criterion-jobs-listed\n  - type: derives-from\n    to: capability-view-job-status\n---\n"
    ],
    [
      "examples/ops-api-data/schema-public",
      "---\nid: schema-public\ntype: data-schema\ntitle: public\nplane: dm--physical\nlinks:\n- type: data-contains\n  to: table-job\n- type: data-contains\n  to: table-job-event\n- type: data-contains\n  to: view-latest-status\n---\n\n"
    ],
    [
      "examples/ops-api-data/server-ops",
      "---\nid: server-ops\ntype: data-db-server\ntitle: Managed Postgres\nplane: dm--physical\nlinks:\n- type: data-contains\n  to: database-ops\n---\n\n"
    ],
    [
      "examples/ops-api-data/table-job-event",
      "---\nid: table-job-event\ntype: data-table\ntitle: job_event\nplane: dm--physical\nlinks:\n- type: data-contains\n  to: col-event-id\n- type: data-contains\n  to: col-event-job\n- type: data-contains\n  to: col-event-state\n- type: data-contains\n  to: col-event-happened\n---\n\n"
    ],
    [
      "examples/ops-api-data/table-job",
      "---\nid: table-job\ntype: data-table\ntitle: job\nplane: dm--physical\nlinks:\n- type: data-contains\n  to: col-job-id\n- type: data-contains\n  to: col-job-state\n- type: data-contains\n  to: col-job-updated\n---\n\n"
    ],
    [
      "examples/ops-api-data/team-dev",
      "---\nid: team-dev\ntype: team\ntitle: Dev\nplane: pln--plan\nfields:\n  kind: agent\n  focus: Implements work packages for review\n---\n\nAn AI agent that writes code and hands it to people to review.\n"
    ],
    [
      "examples/ops-api-data/team-platform",
      "---\nid: team-platform\ntype: team\ntitle: Platform\nplane: pln--plan\nfields:\n  kind: human\n  focus: Builds and runs the platform\n---\n\nThe people who own the system.\n"
    ],
    [
      "examples/ops-api-data/view-latest-status",
      "---\nid: view-latest-status\ntype: data-view\ntitle: latest_job_status\nplane: dm--physical\nlinks:\n- type: data-derives-from\n  to: table-job\n---\n\n"
    ],
    [
      "examples/ops-api-data/work-package-build-status-api",
      "---\nid: work-package-build-status-api\ntype: work-package\ntitle: Build status API\nplane: pln--plan\nfields:\n  status: planned\nlinks:\n  - type: owned-by\n    to: team-dev\n  - type: reviewed-by\n    to: team-platform\n  - type: delivers\n    to: component-ops-api\n  - type: part-of\n    to: increment-live-status\n---\n\nBuild the service that lists job status.\n"
    ],
    [
      "examples/ops-api-data/work-package-provision-database",
      "---\nid: work-package-provision-database\ntype: work-package\ntitle: Provision database\nplane: pln--plan\nfields:\n  status: planned\nlinks:\n  - type: owned-by\n    to: team-platform\n  - type: delivers\n    to: datastore-ops-db\n  - type: part-of\n    to: increment-live-status\n---\n\nCreate the operations database.\n"
    ],
    [
      "patterns/starter-data-model/attribute",
      "---\nid: attribute\ntype: data-attribute\ntitle: name\nplane: dm--logical\nfields:\n  data_type: text\n  mandatory: true\n---\nOne fact about the thing.\n"
    ],
    [
      "patterns/starter-data-model/concept",
      "---\nid: concept\ntype: data-concept\ntitle: Thing\nplane: dm--conceptual\nlinks:\n- type: data-realised-by\n  to: entity\n---\nThe idea in plain words. Rename it to what you store, such as Job.\n"
    ],
    [
      "patterns/starter-data-model/database",
      "---\nid: database\ntype: data-database\ntitle: app\nplane: dm--physical\nlinks:\n- type: data-contains\n  to: schema\n---\nOne database on the server.\n"
    ],
    [
      "patterns/starter-data-model/entity",
      "---\nid: entity\ntype: data-entity\ntitle: Thing\nplane: dm--logical\nlinks:\n- type: data-contains\n  to: attribute\n- type: data-realised-by\n  to: table\n---\nThe concept with its attributes.\n"
    ],
    [
      "patterns/starter-data-model/key",
      "---\nid: key\ntype: data-column\ntitle: id\nplane: dm--physical\nfields:\n  data_type: uuid\n  primary_key: true\n  nullable: false\n---\nEvery table needs a primary key.\n"
    ],
    [
      "patterns/starter-data-model/name",
      "---\nid: name\ntype: data-column\ntitle: name\nplane: dm--physical\nfields:\n  data_type: text\n  nullable: false\n---\nThe attribute as a column.\n"
    ],
    [
      "patterns/starter-data-model/pattern",
      "---\nid: pattern\ntype: pattern\ntitle: Starter data model\nfields:\n  title: Starter data model\n  description: One concept taken all the way to a table, with its entity, attribute, server, database, schema and key column. Add it for each thing you store, then rename and extend.\n  use: starter\n  requires:\n  - data-model\n  root: concept\n  prefix: data\n---\n"
    ],
    [
      "patterns/starter-data-model/schema",
      "---\nid: schema\ntype: data-schema\ntitle: public\nplane: dm--physical\nlinks:\n- type: data-contains\n  to: table\n---\nA namespace for tables.\n"
    ],
    [
      "patterns/starter-data-model/server",
      "---\nid: server\ntype: data-db-server\ntitle: Database server\nplane: dm--physical\nlinks:\n- type: data-contains\n  to: database\n---\nThe engine that runs the database. Link the database to the datastore it realises with `details`.\n"
    ],
    [
      "patterns/starter-data-model/table",
      "---\nid: table\ntype: data-table\ntitle: thing\nplane: dm--physical\nlinks:\n- type: data-contains\n  to: key\n- type: data-contains\n  to: name\n---\nThe entity as a table. Rename it to the entity's name in snake case.\n"
    ]
  ]
}
