# dashboard

Dashboard widgets: kpi/gauge/line/bar over the model's own expressions, sampled at the same instants as the timeseries sampler.

The dashboard: KPI tiles, gauges, time charts and bars over the model's own expression language, shown during playback and in the results. Since v29 also what Present mode shows a person who did not build the model: "inputs", "results", "limits" and "pages"; with no "pages" the definition is generated (`nagasim.dashboard.default_dashboard`). Absent for a model that declares none.

In the model file this key holds an object.

## Typical uses

These sections guard and present a model. `assertions` check that a KPI stays on the right side of a bound. `path_checks` check which blocks entities visit. A `dashboard` defines the tiles, gauges and charts that a viewer sees, and the inputs a viewer may change. Use the first two as tests of a model, and the third for people who did not build it.

## Behaviour and rules

An assertion names a KPI key, an operator and a value. It passes only when the whole confidence interval over its `replications` clears the bound, at the given `confidence`. The operator `==` means inside the value plus or minus `tolerance`. `naga check` runs the assertions, and assertions with the same replication count run together.

A path check has one of four rules. `order` needs an entity to reach a first block before a later one. `never` forbids a block. `at_most` limits the visits. `always` requires that every entity that left through a DISPOSE visited the block. A path check is judged on one traced replication.

A dashboard widget is an expression sampled at the same instants as the time series. Without `pages`, the dashboard that Present mode shows is generated from the model. The `limits` cap what a run started by a viewer may cost.

## Fields

| Field | Type | Required | Default | Unit | Description |
|---|---|---|---|---|---|
| `question` | string |  |  |  | The question the study answers, shown at the top of the viewer (default: the model's title). |
| `widgets` | list of dashboard widget | yes |  |  | The tiles, gauges and charts, each over an expression. |
| `controls` | list of dashboard control |  |  |  | Game-mode controls. |
| `inputs` | list of dashboard input |  |  |  | The values a viewer may change in Present mode before a run. |
| `results` | list of dashboard result |  |  |  | The KPIs Present mode reports first. |
| `limits` | object |  |  |  | What a run on a viewer's behalf may cost. |
| `pages` | list of dashboard page |  |  |  | The pages of the Presenter, each with an activity and its items. |
| `hidden` | list of string |  |  |  | Generated entries the author removed ("input:&lt;path&gt;", "result:&lt;kpi&gt;", "page:&lt;name&gt;"): regenerating never adds them back. |

A field of a nested object is described in the JSON Schema (`naga schema`).

## Example

```json
{"dashboard": {"widgets": [{"name": "clock", "kind": "kpi", "title": "Model time", "expr": "TNOW"}]}}
```

In the Python builder the section is a keyword of `Model`:

```python
from nagasim import build as nb
m = nb.Model(dashboard={'widgets': [{'name': 'clock', 'kind': 'kpi', 'title': 'Model time', 'expr': 'TNOW'}]})
```

## Used in

Bundled models: [Machine agent with repair](../../gallery/agent-based.md), [Berth: shore power](../../gallery/energy.md), [Emergency department: staffing game](../../gallery/games.md), [Supply line: order-rate management game](../../gallery/games.md), [Hub day: electrifying the ground support equipment](../../gallery/logistics.md), [Container terminal: electrification](../../gallery/logistics.md) and 3 more.

Guides: [Experiments](../../experiments.md), [Sharing a model: the browser viewer](../../sharing-a-model.md).

## See also

- [All sections](index.md), [Model file keys](../schema.md), [Model file format](../../model-file-format.md)
