## Field reference JSON Schema: [dashboard.schema.json](https://aancer.ai/dev/schemas/dashboard.schema.json). It has one definition per kind: `dataset`, `model`, `widget`, `dashboard`. Ids match `^[a-z0-9][a-z0-9._-]{0,63}$`; dataset column ids match `^[a-z][a-z0-9_]{0,63}$`. ### Dataset | Field | Type | Required | Rules | |---|---|---|---| | `id` | string | yes | id pattern | | `title` | string | no | at most 120 characters | | `columns` | array | yes | 1 to 200 of `{ id, type, label?, required?, min?, max?, maxLength? }`. Column `id` matches `^[a-z][a-z0-9_]{0,63}$`, unique. `type`: `string`, `number`, `integer`, `boolean`, `date`, `datetime`, `json` | | `key` | string[] | no | up to 8 columns used for upserts | | `retention` | object | yes | at least one of `maxAgeDays` (1 to 3650) and `maxRows` (1 to 5,000,000) | | `personalData` | object | no | `{ classes: string[], subjectColumn?: string or null }`. With classes, `subjectColumn` names a declared column and `seedRows` are not used | | `source` | string | no | `workflow`, `agent`, `chat`, `import`, `pack`, `manual` | | `seedRows` | object[] | no | up to 5000 initial rows | Workflows fill datasets with a Publish step, agents with the dataset tool, and embedded apps through the bridge. ### Model | Field | Type | Required | Rules | |---|---|---|---| | `id` | string | yes | id pattern | | `title` | string | no | at most 120 characters | | `entities` | object | yes | 1 to 3. Each has exactly one of `dataset` (a dataset id) or `connection` (a connection id or `{{param.x}}`). A connection entity needs `query`: one saved SQL statement (no `;`, `--` or `/*`) of at most 4000 characters with `:param` binds, and `params {name: {type: string, number or date, default?}}` | | `dimensions` | object | yes | up to 100 of `{ entity, column, label?, granularity? }`. `granularity`: list of `day`, `week`, `month`, `quarter`, `year` | | `measures` | object | yes | 1 to 100 of `{ entity, agg, column?, label?, format? }`. `agg`: `count`, `sum`, `avg`, `min`, `max`, `distinct`. `format`: `number`, `integer`, `percent`, `currency` | | `filters` | object | no | up to 100 of `{ dimension, op, value?, param?, label? }`. `op`: `eq`, `neq`, `in`, `gt`, `gte`, `lt`, `lte`, `between`, `in_period`, `contains`. Example: `{"dimension": "date", "op": "in_period", "value": "current_month"}` | | `variables` | object | no | up to 50 of `{ type, default?, label? }`. `type`: `string`, `number`, `date` | | `joins` | array | no | up to 3 of `{ id, left: {entity, column}, right: {entity, column}, type }`. `type`: `inner` or `left`. Dataset entities only | Every dataset also gets an automatic model `m-` with every column as a dimension, `count`, and `sum_` and `avg_` for numeric columns. ### Widget | Field | Type | Required | Rules | |---|---|---|---| | `id` | string | yes | id pattern | | `type` | string | yes | `table`, `chart`, `kpi`, `markdown`, `form` | | `title` | string | yes | at most 120 characters | | `source` | object | for table, chart, kpi | `{ model, query }`. See Model query | | `table` | object | no | `{ columns?: [{ field, label?, width?, format? }] (up to 50), pageSize?: 1 to 200 }` | | `chart` | object | for chart | a declarative chart specification (JSON). See Chart rules | | `kpi` | object | for kpi | `{ measure, compare?: { filter, label? }, format?, label? }` | | `markdown` | object | for markdown | `{ text }`, at most 20,000 characters, no scripts | | `form` | object | for form | `{ card, target, onSuccess?: { message? }, personalData?: { classes } }`. See Form widgets | | `interactions` | object | no | cross-filtering: `{ emit?: { dimension }, listen?: boolean }` | | `actions` | array | no | up to 5 buttons. See Widget actions | ### Model query | Field | Rules | |---|---| | `measures` | at least 1 measure id of the model | | `dimensions` | up to 4 dimension ids | | `filters` | named model filters | | `variables` | values for model variables | | `order` | `[{ field, dir: "asc" or "desc" }]` | | `limit` | 1 to 5000 rows, default 500 | | `granularity` | `{ "