# Assemble a dashboard

Use this when someone asks for a dashboard, a report with charts, or key figures of a space's
data, and when they ask to change a `*.ivy-dashboard.yaml` file.

## 1. Find the data

- Find the data files the dashboard reads: CSV, TSV, JSON (a list of objects) or Excel. A
  dashboard reads only files of the space; data that lives in another service needs a flow that
  writes it to a file first, so say so instead of inventing a source.
- Read the first rows of each file. Note every column's name exactly as written, and which
  columns are dates, numbers and categories. For Excel, note the sheet and the range or table.

## 2. Choose what to show

Ask yourself what the person decides with it, then pick a few widgets, in this order:

1. Two to four `kpi` widgets first: the totals or averages the person watches, each with a
   `compare` when there is a target or an earlier period.
2. One `line` (or `area`) chart over time, with the date column on `x`.
3. One `bar` or `pie` chart of a category: `pie` only for a handful of parts of a whole.
4. A `table` last, for the rows behind the figures, sorted by what matters most.

Six to eight widgets is enough. Leave out what nobody asked for.

## 3. Write the file

- Name it `<subject>.ivy-dashboard.yaml` next to its data, unless the person names a place.
  Start it with `ivy: dashboard/v1`, a `title` and a one-line `description` that says where the
  data comes from.
- Give each source a short name and the file's path from the top of the space. Make one source
  per shape you need: the raw rows, and a `group_by` with `aggregate` for each summary (by month,
  by region). Sort a time series by its date.
- Widgets fill a 12-column grid in file order. Leave `width` out unless the defaults (kpi 3,
  charts 6, pie 4, table full) leave a row ragged.
- Format money with `{ style: currency, currency: <code>, decimals: 0 }` and large counts with
  `{ style: compact }`; dates by the period they stand for (`{ date: month }`).
- `example.ivy-dashboard.yaml` beside this skill is a complete dashboard over a sales export;
  read it with `read_skill` for the shape of every widget. For a field it doesn't use, read the
  `dashboard-file-reference` help page.

## 4. Check and hand over

- Where you have `check_file`, check the draft with it before saving, and fix every problem it
  reports. Saving the file reports the same problems in any case: fix them and save again until
  it saves without any.
- Tell the person where the file is, as a link, and in one or two sentences what it shows. Say
  which figures you left out and why, if any, and that the dashboard shows the current version of
  its source files.
