@datama/studio-skill-instructions 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTRUCTIONS.md +76 -0
- package/README.md +4 -2
- package/package.json +19 -5
- package/references/chart.md +55 -0
- package/references/market-equation.md +93 -0
- package/references/solutions/compare.md +101 -0
- package/references/solutions/detect.md +52 -0
- package/references/solutions/explore.md +84 -0
- package/references/solutions/pivot.md +32 -0
- package/references/theming.md +89 -0
package/INSTRUCTIONS.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Datama Studio
|
|
2
|
+
|
|
3
|
+
Delivers a standalone HTML page rendering Datama Studio **stories** (one question each, holding one or more analyses). The dataset is inlined in the page; Datama computes in the browser.
|
|
4
|
+
|
|
5
|
+
Linked `references/…` files are read the same way as this one: `python3 scripts/datama.py instructions references/<file>.md`. Read one only when the request needs it.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. **Pick the solution.** Two sides ("2024 vs 2025", "before/after", "why did X drop") → `compare`. A breakdown or a chart across dimensions → `explore`. Unusual points over time → `detect` (needs a date column). Where a KPI is the most uneven, no comparison → `pivot`. Comparison and breakdown together, or unclear → `compare`.
|
|
10
|
+
2. **Save the dataset to a file once, as you received it**: a JSON array, a connector result holding a `rows` array, JSON Lines or CSV. One flat row per segment, the same columns on every row. Metrics are plain numbers (`null` when missing, never `"1 200 €"`); dates use one format per column, ISO `YYYY-MM-DD` preferred. Give raw counts, not precomputed ratios: the market equation computes them. Over ~20 000 rows, aggregate along the dimensions that matter first.
|
|
11
|
+
3. **Write the configuration** (below), then **build**:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
python3 scripts/datama.py build --data rows.json --config '<json>' --out page.html
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
It prints `true`, a summary line and `Warning:` lines (then, for a licensed page, `Datama comment:` and the comments the page shows), or `Validation failed:` with one fix per line: apply them and run it again. Warnings do not block: fix those that touch the request. Never fill `assets/studio-output-template.html` by hand.
|
|
18
|
+
4. **Deliver** the page: an HTML Artifact with `capabilities: {downloads: true}` on Claude, a full-height iframe Frame on Dust (if the Frame blocks the CDN, the `.html` file to open in a browser), Canvas or the file on ChatGPT, the file in the workspace on Cursor and Claude Code.
|
|
19
|
+
5. **Summarize.** When the build printed `Datama comment:`, sum up those comments in the user's words: they are the analysis the page shows. Otherwise say in a few lines what each story analyses. Never produce a breakdown of your own from the rows.
|
|
20
|
+
|
|
21
|
+
A request to compare or analyse data needs nothing more than this file: build with the defaults, then offer the changes below.
|
|
22
|
+
|
|
23
|
+
## Configuration
|
|
24
|
+
|
|
25
|
+
Write only the choices that need judgement, as one flat JSON object. The build derives the rest (dimensions, story, pins, module, steps, formula).
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{"solution": "compare", "metrics": ["Sessions", "Orders", "Revenue"], "context": "Quarter",
|
|
29
|
+
"start": ["Q1"], "end": ["Q2"], "totalStepName": "Revenue", "totalStepUnit": "€",
|
|
30
|
+
"title": "Pourquoi le CA a baissé au T2", "language": "fr-FR"}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Column names are exact tokens from the data: never translate, pluralize, rename or re-case them.
|
|
34
|
+
|
|
35
|
+
**`language`, always:** `fr-FR` when the user writes in French, `de-DE` in German, `es-ES` in Spanish, otherwise `en-US`. It sets the language of the generated titles, comments and labels, not of the data. **`title`:** the user's question, in their language.
|
|
36
|
+
|
|
37
|
+
**`metrics`, ordered.** Studio turns them into steps `metrics[0]`, then `<metrics[i]> per <metrics[i-1]>`, multiplied together, so a change is explained by each link of the chain.
|
|
38
|
+
- Which: the ones the user names; otherwise every raw numeric column, without precomputed ratios or averages (`rate`, `avg`, `%`, `ROAS`, `CTR`, `AOV`, …) unless asked for. One metric is fine: the change is then explained by segments only.
|
|
39
|
+
- Order: the business flow. Web: sessions → product views → add to cart → checkout → orders → revenue. Acquisition: cost → impressions → clicks → sessions → conversions → revenue. Subscription: expirations → renewals → revenue. Otherwise: column order.
|
|
40
|
+
- Custom equation, only when the meaning requires it: `steps` (each `{"numerator", "denominator"}`, named `"<numerator> per <denominator>"`) and `formula` over step indices `[1]`…`[N]`. Cost per unit: `[1]+[2]+[3]` over `Cost_x / Units` steps. NPS: `([1]-[2])*100` over `Promoters / Answers`, `Detractors / Answers`. Details: [market-equation.md](references/market-equation.md).
|
|
41
|
+
- `totalStepName`: the KPI computed, in business words (`Revenue`, `ROAS`, `NPS`), never a step name like `Revenue per Orders`. `totalStepUnit`: `"€"` for money, `"%"` for a percentage, otherwise `""`.
|
|
42
|
+
- `dimensions` defaults to every other column; set it to leave columns out, or to keep a numeric label (year, store id, zip code) out of the metrics.
|
|
43
|
+
|
|
44
|
+
**Comparison** (Compare; optional in the other solutions). `context` is the dimension holding the two sides. `start` is the reference side (before, A), `end` the side explained (after, B): values as written in the data (`["2024"]`, several merged on one side: `["Desktop", "Tablet"]`), or `[first, last]` each on a date column. Without `context`: the older half of the first date column against the newer half. Rolling periods: `"relative": true`, indices from the most recent date, `"start": [13, 7], "end": [6, 0]`. Two metric columns (budget vs actual), a second comparison, a what-if simulation: [compare.md](references/solutions/compare.md#advanced).
|
|
45
|
+
|
|
46
|
+
**Filters**, only when asked: `"filters": [{"column": "Country", "operator": "in", "value": ["France"]}]`, every clause kept (AND). Operators: `in` / `not` a list of values, `like` a text, `gte` / `lte` / `after` / `before` a bound, `between` `[low, high]` (inclusive).
|
|
47
|
+
|
|
48
|
+
**Several analyses.** `"modules": [{"solution": "compare"}, {"solution": "explore", "primary": "Country", "secondary": "Comparison Dimension"}]` stacks analyses in one story, sharing its comparison, filters and equation (`"displayMode": "slide"`: one per slide). `"stories": [{…}, {…}]` adds one tab per question; each story takes the top-level keys and overrides them. A module input every module of the story must share (drill-down hierarchy, detection method, analysis method) goes in `"shared": {…}` instead of the module. Story look: `"appearance"` ([theming.md](references/theming.md#story-canvas-appearance)).
|
|
49
|
+
|
|
50
|
+
## Changing a setting
|
|
51
|
+
|
|
52
|
+
Every other key of the configuration is a module input. Write only what the request asks. The frequent ones:
|
|
53
|
+
- Compare: `view` (`waterfall-default` · `tree-default`), `analysisMethod` (`auto` · `steps` · `dimensions`), `waterfallMeasure`, `stylePreset`, `chartTitle` — [compare.md](references/solutions/compare.md).
|
|
54
|
+
- Explore: `primary` (axis dimension), `secondary` (series dimension, or `"Comparison Dimension"` for Start vs End), `metric1` / `metric2` / `metric3` (a metric, a step name, or with a comparison `"<measure> Δ"` / `"<measure> % Change"`), `chart.category` (`bar` · `line` · `area` · `combo` · `mekko` · `scatter`), `chart.layout` (`clustered` · `stacked` · `percent` · `overlay`) — [explore.md](references/solutions/explore.md).
|
|
55
|
+
- Detect: `detectionMethod`, `lastPointsOnlyEnabled` with `lastPointsCount`, `confidence` — [detect.md](references/solutions/detect.md).
|
|
56
|
+
- Pivot: `view`, `hierarchyExplorationMethod` (`hierarchy` · `top`), `hierarchyTopLeaves` — [pivot.md](references/solutions/pivot.md).
|
|
57
|
+
- Chart details the inputs do not cover (axis, legend, labels, average lines): the `plotter` key — [chart.md](references/chart.md).
|
|
58
|
+
- Look (palette, brand colors, background): `--theme '{"colors": {"palette": "modern"}}'`, not the configuration — [theming.md](references/theming.md).
|
|
59
|
+
|
|
60
|
+
Anything else: look it up in the **settings registry** of the Studio release the page loads:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
python3 scripts/datama.py settings compare|explore|detect|pivot [word] # module inputs and their defaults
|
|
64
|
+
python3 scripts/datama.py settings modules|pins|plotter|theme [word] # modules, story pins, chart keys, palettes and presets
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
A setting absent from the registry does not exist: say "configurable in the Datama app, not exposed to this skill", never "Datama cannot do it". Only when the registry lists a setting without making its effect clear, search the Studio source as a last resort: `python3 scripts/datama.py source '<regex>' [--context 5]` (the readable build of `@datama/studio`). Use it to understand a value, never to invent a key.
|
|
68
|
+
|
|
69
|
+
## Editing a page
|
|
70
|
+
|
|
71
|
+
Rebuild from the page, passing only the keys that change: `--from page.html --config '{"view": "tree-default"}'`, `--config '{"solution": "explore", "primary": "Country"}'`, or `--from page.html --theme '{"colors": {"palette": "ocean"}}'`. On a page with several stories, a top-level key changes every story; `"stories": [{}, {"view": "tree-default"}]` changes the second only.
|
|
72
|
+
|
|
73
|
+
## Rules
|
|
74
|
+
|
|
75
|
+
- Never rebuild the chart yourself, add scripts to the page, edit a template, or send the rows anywhere.
|
|
76
|
+
- If the metrics, the comparison axis or the data do not fit the request (no date column for Detect, a single segment for Compare), ask before building.
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @datama/studio-skill-instructions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Workflow of the `datama-studio` agent skill. The installed skill prints it with `python3 scripts/datama.py instructions`, and one reference with `python3 scripts/datama.py instructions references/<file>.md`.
|
|
4
|
+
|
|
5
|
+
Published from the `studio-skill` repository on each release tag. The settings registry is not here: it ships with `@datama/studio` (`contract/settings-registry.json`) and is read with `python3 scripts/datama.py settings`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@datama/studio-skill-instructions",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Workflow and references of the datama-studio agent skill, read at run time by its scripts/datama.py.",
|
|
5
|
+
"files": [
|
|
6
|
+
"INSTRUCTIONS.md",
|
|
7
|
+
"README.md",
|
|
8
|
+
"references"
|
|
9
|
+
],
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"datama",
|
|
15
|
+
"studio",
|
|
16
|
+
"agent-skill"
|
|
17
|
+
],
|
|
18
|
+
"author": "Datama",
|
|
19
|
+
"license": "UNLICENSED"
|
|
20
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Tuning the chart of a module (`plotter`)
|
|
2
|
+
|
|
3
|
+
Every Studio module draws with Plotter. The `plotter` key of the configuration (saved on the module slot as `configuration.plotter`) is a **partial** chart configuration deep-merged over the defaults. Use it for precise chart requests the module inputs do not cover: axis, legend, labels, padding, average lines.
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{"solution": "compare", "metrics": ["Orders", "Revenue"], "context": "Year", "start": ["2024"], "end": ["2025"],
|
|
7
|
+
"plotter": {"reverse": true, "legends": {"display": true}}}
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Rules
|
|
11
|
+
|
|
12
|
+
- Write only the keys that change. Every valid key, its type and its default: `python3 scripts/datama.py settings plotter [word]`. A key not listed there does not exist and is rejected.
|
|
13
|
+
- Prefer module inputs first: Compare `stylePreset`, `chartTitle`, `waterfallValueLabels`, `view`; Explore `chart.*`. They are tested together with the solution layout.
|
|
14
|
+
- Explore: any non-empty `plotter` is read as a saved chart and skips Explore's default look (preset, value labels on bars). Add one only when needed.
|
|
15
|
+
- Keys owned by the solution layout (`layout`, `views`, `traces`, `customViews`) are rebuilt by the module; leave them out.
|
|
16
|
+
- Never store pixel positions or computed values.
|
|
17
|
+
|
|
18
|
+
## Frequent requests
|
|
19
|
+
|
|
20
|
+
| Request | `plotter` |
|
|
21
|
+
| ------------------------------------- | --------------------------------------------------------------------------- |
|
|
22
|
+
| Horizontal bars / swap axes | `{"reverse": true}` |
|
|
23
|
+
| Show the legend at the bottom | `{"legends": {"display": true, "position": "bottom"}}` |
|
|
24
|
+
| Hide the measure axis | `{"axis": {"y": {"hidden": true}}}` |
|
|
25
|
+
| Compact numbers on axis ticks (K / M) | `{"axis": {"ticks": {"texts": {"format": {"compact": true}}}}}` |
|
|
26
|
+
| Two decimals on axis ticks | `{"axis": {"ticks": {"texts": {"format": {"decimals": 2}}}}}` |
|
|
27
|
+
| Bigger chart margins | `{"plot": {"padding": {"top": 30, "right": 20, "bottom": 30, "left": 20}}}` |
|
|
28
|
+
| No bar gradient | `{"bars": {"gradient": {"display": false}}}` |
|
|
29
|
+
| Bar value labels | `{"bars": {"labels": {"display": true}}}` |
|
|
30
|
+
| Hide the waterfall connectors | `{"waterfall": {"links": {"display": false}}}` |
|
|
31
|
+
| Bigger header title | `{"header": {"title": {"size": 22}}}` |
|
|
32
|
+
| No animations | `{"behaviors": {"transitionDuration": 0}}` |
|
|
33
|
+
|
|
34
|
+
## Average and value lines (Explore)
|
|
35
|
+
|
|
36
|
+
A dotted reference line at an average, or at one element value, labelled past the end of the plot. Add one only when the user asks ("add the average line"). On Compare, gaps between bars use the module input `waterfallDifferenceArrows` ([compare.md](solutions/compare.md#advanced)).
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{"plotter": {"annotations": {"valueLines": [
|
|
40
|
+
{"id": "average-sessions", "trace": "Sessions", "kind": "average"},
|
|
41
|
+
{"id": "average-tablet", "trace": "Sessions", "kind": "average", "series": "Tablet"}
|
|
42
|
+
]}}}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
| Key | Value | Meaning |
|
|
46
|
+
| -------- | ----------------------- | ------------------------------------------------------------------------------------- |
|
|
47
|
+
| `id` | string | Unique id |
|
|
48
|
+
| `trace` | string | The measure name |
|
|
49
|
+
| `kind` | `"average"` · `"value"` | Mean of the plotted elements (stack totals when stacked), or the value of one element |
|
|
50
|
+
| `series` | string | `average` of one series only (one value of the `secondary` dimension) |
|
|
51
|
+
| `key` | string | `value` lines: stable id of the anchor element |
|
|
52
|
+
|
|
53
|
+
## Table view
|
|
54
|
+
|
|
55
|
+
Every chart also offers a table view (`table.enabled`, default on). Its columns, pagination and styling live under `plotter.table`; leave them to the solution unless the user asks for a table change.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Market equation: metrics, steps, formula, main KPI
|
|
2
|
+
|
|
3
|
+
The market equation explains a main KPI as a chain of steps (volumes and ratios). Compare decomposes a change along it, Explore and Detect plot its steps, Pivot builds its KPI tree from it. Getting it right is what makes the analysis read as business.
|
|
4
|
+
|
|
5
|
+
## Automatic or explicit
|
|
6
|
+
|
|
7
|
+
- **Automatic** (only `metrics`): step 1 is the first metric, step i is `<metric i> per <metric i-1>`, formula = product of every step, main KPI = last metric. Order and restrict `metrics` to control it. This covers funnels, the most frequent case.
|
|
8
|
+
- **Explicit** (`steps` + `formula`): when the formula is not a plain product (sum of costs, NPS, branching funnel), when a step divides by a column that is not the previous metric, or when the user names a KPI the last metric is not.
|
|
9
|
+
- `totalStepName` / `totalStepUnit`: write them in both cases, they name what the page explains.
|
|
10
|
+
|
|
11
|
+
## Metric scope
|
|
12
|
+
|
|
13
|
+
- Metric columns only, with their exact names (never pluralize, translate, rename or re-case).
|
|
14
|
+
- The user names metrics → only those. Otherwise every raw numeric metric.
|
|
15
|
+
- Leave out precomputed rates, ratios and averages unless asked for (`rate`, `ratio`, `avg`, `mean`, `%`, `ROAS`, `CPA`, `CPC`, `CTR`, `CVR`, `AOV`, `ROI`, `NPS`): the equation recomputes them from raw counts, and a ratio summed over segments is wrong.
|
|
16
|
+
- A numeric column that is a label (year, store id) is a dimension: list `dimensions` explicitly.
|
|
17
|
+
|
|
18
|
+
## Metric order
|
|
19
|
+
|
|
20
|
+
Business flow first, upstream to downstream:
|
|
21
|
+
|
|
22
|
+
- Web: `sessions → product views → add to cart → checkout → orders → revenue`
|
|
23
|
+
- Acquisition: `cost → impressions → clicks → sessions → leads → conversions → revenue`
|
|
24
|
+
- Subscription: `expirations → renewals → revenue`
|
|
25
|
+
- Retail: `visitors → tickets → items → revenue`
|
|
26
|
+
|
|
27
|
+
Without a clear flow: numeric sequence in the names, then column order. Never invent a metric.
|
|
28
|
+
|
|
29
|
+
## Steps
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{"numerator": "Orders", "denominator": "Sessions", "unit": "%"}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
| Key | Rule |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `numerator` | Metric column (required) |
|
|
38
|
+
| `denominator` | Metric column, or omitted for a volume step |
|
|
39
|
+
| `name` | Optional. Default: the numerator for a volume step, `"<numerator> per <denominator>"` for a ratio step. Keep that naming: Explore measures and what-if KPIs refer to it |
|
|
40
|
+
| `unit` | Optional: `"€"` (or the currency the user implies) for money, `"%"` only for a true rate. Never inside `name` |
|
|
41
|
+
|
|
42
|
+
A denominator may be a column that is not a step (answers for NPS, units for a unit cost): keep it in `metrics` so it exists in the source.
|
|
43
|
+
|
|
44
|
+
## Formula
|
|
45
|
+
|
|
46
|
+
`formula` uses 1-based step indices, never column names: `"[1]"`, `"[1]*[2]*[3]"` (product), `"[1]+[2]+[3]"` (sum), `"([1]-[2])*100"` (NPS), `"[1]*[2]*([3]*[4]+(1-[3])*[5])"` (branching). Reference only existing indices; when unsure, use the product of every step.
|
|
47
|
+
|
|
48
|
+
## Main KPI
|
|
49
|
+
|
|
50
|
+
- `totalStepName`: what the formula computes, in business words. Priority: the KPI the user names → the KPI the formula implies (`ROAS` for cost → revenue, `NPS`, `Cost per unit`) → the last metric. Never a step name like `"Revenue per Orders"`.
|
|
51
|
+
- `totalStepUnit`: `"€"` for money, `"%"` for a percentage KPI, otherwise `""`. `totalStepEmoji`: optional, one emoji.
|
|
52
|
+
- Rewrite both whenever the steps or the formula change.
|
|
53
|
+
|
|
54
|
+
## Examples
|
|
55
|
+
|
|
56
|
+
E-commerce funnel, automatic:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{"solution": "compare", "metrics": ["Sessions", "Orders", "Revenue"], "context": "Year", "start": ["2024"], "end": ["2025"],
|
|
60
|
+
"totalStepName": "Revenue", "totalStepUnit": "€", "title": "Why did revenue change in 2025?", "language": "en-US"}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Acquisition, ROAS: the automatic steps without the cost volume, so each funnel stage explains its share of the ROAS change (`[1]` is `Cost`, `[2]` `Impressions per Cost`, …, `[6]` `Revenue per Orders`):
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{"solution": "compare", "metrics": ["Cost", "Impressions", "Clicks", "Sessions", "Orders", "Revenue"],
|
|
67
|
+
"formula": "[2]*[3]*[4]*[5]*[6]", "totalStepName": "ROAS", "totalStepUnit": "",
|
|
68
|
+
"context": "Year", "start": ["2024"], "end": ["2025"], "language": "en-US"}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
NPS, a difference of two shares of the same denominator:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{"solution": "compare", "metrics": ["Promoters", "Detractors", "Answers"],
|
|
75
|
+
"steps": [{"numerator": "Promoters", "denominator": "Answers"}, {"numerator": "Detractors", "denominator": "Answers"}],
|
|
76
|
+
"formula": "([1]-[2])*100", "totalStepName": "NPS", "totalStepUnit": "", "context": "Year", "start": ["2024"], "end": ["2025"], "language": "en-US"}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Cost per unit, a sum of unit costs:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{"solution": "compare", "metrics": ["Product_cost", "Shipping_cost", "Units"],
|
|
83
|
+
"steps": [{"numerator": "Product_cost", "denominator": "Units", "unit": "€"}, {"numerator": "Shipping_cost", "denominator": "Units", "unit": "€"}],
|
|
84
|
+
"formula": "[1]+[2]", "totalStepName": "Cost per unit", "totalStepUnit": "€", "context": "Year", "start": ["2024"], "end": ["2025"], "language": "en-US"}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
When a drop of the KPI is good news (costs, churn), say so in the summary and swap the rise and drop colors ([theming.md](theming.md#custom-colors-palette-custom)).
|
|
88
|
+
|
|
89
|
+
## Checks
|
|
90
|
+
|
|
91
|
+
- Every column of `metrics` and `steps` exists in the data.
|
|
92
|
+
- `formula` references existing step indices only.
|
|
93
|
+
- `totalStepName` is a business KPI name, `totalStepUnit` matches it.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Compare (`compare.waterfall`)
|
|
2
|
+
|
|
3
|
+
Explains **why** a main KPI changed between two sides (two periods, two segments): a waterfall from Start to End where each bar is a driver (market-equation step, segment mix, segment performance), plus a generated title and comment.
|
|
4
|
+
|
|
5
|
+
## When
|
|
6
|
+
|
|
7
|
+
- "Why did revenue drop?", "compare Q1 vs Q2", "decompose the conversion change", "Mobile vs Desktop", "budget vs actual".
|
|
8
|
+
- `start` is the reference (before, budget, A), `end` the side explained (after, actual, B). Without a comparison, Studio compares the older half of the first date column with its newer half.
|
|
9
|
+
|
|
10
|
+
## Minimal
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{"solution": "compare", "metrics": ["Sessions", "Orders", "Revenue"], "context": "Device", "start": ["Desktop"], "end": ["Mobile"],
|
|
14
|
+
"totalStepName": "Revenue", "totalStepUnit": "€", "title": "Mobile vs Desktop: what explains the revenue gap?", "language": "en-US"}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Two date periods: `"context": "Date", "start": ["2025-01-01", "2025-01-31"], "end": ["2025-02-01", "2025-02-28"]`. Periods of the same length make the clearest analysis. Every dimension left in the data is a drill-down axis: drop (`dimensions`) those that make no business sense.
|
|
18
|
+
|
|
19
|
+
## Business rules
|
|
20
|
+
|
|
21
|
+
- The waterfall explains `totalStepName`: get the market equation right first ([market-equation.md](../market-equation.md)).
|
|
22
|
+
- Both sides must hold rows after filters; a filter on the comparison dimension can empty one side.
|
|
23
|
+
- A drop that is good news (costs, churn): say so in the summary, swap the colors ([theming.md](../theming.md#custom-colors-palette-custom)).
|
|
24
|
+
- Summarize the `Datama comment:` lines; never recompute the drivers from the rows.
|
|
25
|
+
|
|
26
|
+
## Inputs
|
|
27
|
+
|
|
28
|
+
All optional. Defaults: `python3 scripts/datama.py settings compare`. Change only what the request asks.
|
|
29
|
+
|
|
30
|
+
| Key | Values | Meaning |
|
|
31
|
+
| --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `view` | `"waterfall-default"` · `"tree-default"` | Waterfall of drivers, or tree of cards decomposing the KPI dimension by dimension |
|
|
33
|
+
| `analysisMethod` | `"auto"` · `"steps"` · `"dimensions"` | `auto` picks the most interesting; `steps` starts from the equation steps, then segments; `dimensions` starts from segments, then steps |
|
|
34
|
+
| `waterfallMeasure` | `"Impact"` · `"Pts_gap"` | Bar value: contribution to the KPI (in `totalStepUnit`), or gap in points (rate steps) |
|
|
35
|
+
| `Split_Mix_and_Perf` | `"Auto"` · `"Always"` · `"Never"` | Split each segment bar into mix (share shift) and performance (rate change) |
|
|
36
|
+
| `separateCovariance` | `"Never"` · `"Auto"` · `"Always"` | Isolate the interaction between steps in a "Covariance" bar (`Auto`: above `separateCovarianceThreshold`, %) |
|
|
37
|
+
| `covarianceWarningThreshold` | number 0–100 | Above it, the page warns the two sides may not be comparable |
|
|
38
|
+
| `mixPerfCovariance` | `"pro-rata"` · `"performance"` · `"mix"` | Who carries the mix × performance cross term |
|
|
39
|
+
| `waterfallOpenBarByDefault` | boolean, default `true` | Drill into the main bars on load |
|
|
40
|
+
| `waterfallExpandDepth` / `waterfallExplorationDepth` | `1` · `2` · `3` | How deep a drilled bar opens / dimension levels explored automatically |
|
|
41
|
+
| `waterfallCommentThreshold` | number (points), default `1` | Minimum impact for a segment to be cited: higher = shorter comment |
|
|
42
|
+
| `segment_complement` | `"Variation relative to avg"` · `"Variation %"` · `"Nothing"` | Text after each segment name |
|
|
43
|
+
| `waterfallValueLabels` | boolean, default `true` | Value on each bar; `false` on a dense waterfall |
|
|
44
|
+
| `waterfallGroupEquationSteps` | boolean | Also fold small step bars into "Remaining" |
|
|
45
|
+
| `chartTitle` / `chartSubtitle` | string, default `""` | Bands above the chart, verbatim, in the user's language. Empty = the generated insight speaks |
|
|
46
|
+
| `stylePreset` | `datama.py settings theme stylePreset` | One-key look (shapes, typography, comment placement); applies its palette too |
|
|
47
|
+
| `clusteringThreshold` | number 0–100 (%), default `2` | Segments under this share of `metricForClustering` grouped into "Other" |
|
|
48
|
+
| `clusteringMethod` | `"threshold"` · `"tail"` | Group by share threshold, or keep the top segments and group the tail |
|
|
49
|
+
| `clusteringBins` | integer 2–20, default `5` | Bins for numeric dimensions |
|
|
50
|
+
| `metricForClustering` | metric column | Metric weighing the segments (default: the first metric) |
|
|
51
|
+
| `dimensionsHierarchy` | `[{"name": "Country", "level": 0, "pinned": false}, {"name": "City", "level": 1, "pinned": false}]` | Drill-down order (parent before child) |
|
|
52
|
+
| `hierarchicalMix` | boolean | Measure each level's mix against its parent (with `dimensionsHierarchy`); `clusteringAtParentLevel` (default `true`) rebuilds "Other" inside every parent |
|
|
53
|
+
| `outOfScopeDimensions` | dimension names | Segments present on one side only (new stores, closed products) grouped in an "Out of scope" block; `outOfScopeLabel`, `outOfScopeAddComparablePillar` (default `true`) |
|
|
54
|
+
| `hierarchyExplorationMethod` | `"hierarchy"` · `"top"` | Tree view: expand along the dimension order, or pick the most contributing leaves (`hierarchyTopLeaves`, default `4`) |
|
|
55
|
+
| `treeCardMainKpiRatio` / `treeCardSubKpiRatio` / `treeCardTitleRatio` | `0.75` · `1` · `1.25` | Tree view: font size of the card headline / sub lines / title |
|
|
56
|
+
|
|
57
|
+
## Advanced
|
|
58
|
+
|
|
59
|
+
**Like-for-like** (stores, products present on both sides only): `"outOfScopeDimensions": ["City"]`.
|
|
60
|
+
|
|
61
|
+
**Drill-down by hierarchy**, shared by every module of the story:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{"solution": "compare", "metrics": ["Sessions", "Orders", "Revenue"], "context": "Year", "start": ["2024"], "end": ["2025"],
|
|
65
|
+
"shared": {"dimensionsHierarchy": [{"name": "Country", "level": 0, "pinned": false}, {"name": "City", "level": 1, "pinned": false}], "hierarchicalMix": true},
|
|
66
|
+
"totalStepName": "Revenue", "totalStepUnit": "€", "language": "en-US"}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Two metric columns of the same rows** (budget vs actual, forecast vs real): `comparisons` with `mode: "metric"`. Each pair names one compared measure; the equation is built from the pair names.
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{"solution": "compare", "metrics": ["Revenue_budget", "Revenue"],
|
|
73
|
+
"comparisons": [{"mode": "metric", "pairs": [{"start": "Revenue_budget", "end": "Revenue", "name": "Revenue"}], "startSegment": "Budget", "endSegment": "Actual"}],
|
|
74
|
+
"title": "Revenue vs budget", "language": "en-US"}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Explicit sides, or a second comparison** (Start vs End twice, side by side): `comparisons` holds one entry per comparison, the first is the primary one. Each side is `{"column", "operator", "value"}`, the same column on both sides: `between [first, last]` for a date or numeric range, `in [values]` otherwise. Layout: `splitOrientation` (`horizontal` · `vertical`), `splitDisplayMode` (`grouped` · `overlay`), `waterfallMergeOnCommonBars`.
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{"solution": "compare", "metrics": ["Sessions", "Orders", "Revenue"], "comparisons": [
|
|
81
|
+
{"mode": "dimension", "start": {"column": "Year", "operator": "in", "value": ["2024"]}, "end": {"column": "Year", "operator": "in", "value": ["2025"]}},
|
|
82
|
+
{"mode": "dimension", "start": {"column": "Device", "operator": "in", "value": ["Desktop"]}, "end": {"column": "Device", "operator": "in", "value": ["Mobile"]}}],
|
|
83
|
+
"totalStepName": "Revenue", "totalStepUnit": "€", "language": "en-US"}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**What-if simulation**, only when asked ("what if mobile conversion rose 10 %?"): `kpis[].name` is a step name of the equation, `impact` `relative` in percent.
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{"solution": "compare", "metrics": ["Sessions", "Orders", "Revenue"], "context": "Year", "start": ["2024"], "end": ["2025"],
|
|
90
|
+
"whatIf": {"scenarios": [{"name": "Mobile conversion +10 %", "enabled": true, "comparison": true,
|
|
91
|
+
"baseline": {"name": "", "dimension": "Device", "segments": ["Mobile"]},
|
|
92
|
+
"kpis": [{"name": "Orders per Sessions", "scope": {}, "impact": {"type": "relative", "value": 10}, "pinned": true}]}]},
|
|
93
|
+
"totalStepName": "Revenue", "totalStepUnit": "€", "language": "en-US"}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Subtotals and arrows**, only when asked. `waterfallCustomPillars`: `[{"id": "pillar-eu", "anchorKey": "<bar label>", "position": "before", "label": "Subtotal EU"}]`. `waterfallDifferenceArrows`: `[{"id": "start-vs-end", "fromAnchorKey": "Start", "toAnchorKey": "End", "kind": "total", "mode": "both"}]`, with `kind` `level` (adjacent bars) · `total` · `cagr`, `mode` `percent` · `absolute` · `both`, `direction` `to` · `from` · `both`. Anchors are exact bar labels (segment, step, `Start`, `End`).
|
|
97
|
+
|
|
98
|
+
## Checks
|
|
99
|
+
|
|
100
|
+
- Both sides use the same column and values that exist in it, are not identical, and keep rows after filters.
|
|
101
|
+
- Every name in `dimensionsHierarchy`, `outOfScopeDimensions`, `metricForClustering`, `kpis[].name` exists.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Detect (`detect.anomaly`)
|
|
2
|
+
|
|
3
|
+
Finds outliers in a time series: the measure over time with its expected range, the flagged points, and a table ranking the segments and steps that drive each anomaly.
|
|
4
|
+
|
|
5
|
+
## When
|
|
6
|
+
|
|
7
|
+
- "Find anomalies in daily orders", "which days were unusual", "monitor the last points", "did anything abnormal happen last week".
|
|
8
|
+
- Needs a **date** column at a regular grain (one row per day × segment, for instance) and dozens of periods for a reliable baseline.
|
|
9
|
+
|
|
10
|
+
## Minimal
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{"solution": "detect", "metrics": ["Sessions", "Orders"], "title": "Unusual months in orders", "language": "en-US"}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Monitoring the latest points only: add `"lastPointsOnlyEnabled": true, "lastPointsCount": 7`.
|
|
17
|
+
|
|
18
|
+
## Business rules
|
|
19
|
+
|
|
20
|
+
- Detection runs on the main KPI and on every step: get the equation right ([market-equation.md](../market-equation.md)).
|
|
21
|
+
- One grain per page: never mix days and months in the same column.
|
|
22
|
+
- Pick the method from the question: a sudden change → `variation-volatility`; a business threshold ("below 1 000 orders", "a drop of more than 20 %") → the matching `*-threshold` with `detectionThreshold`; a seasonal series → `forecast`; otherwise the default.
|
|
23
|
+
|
|
24
|
+
## Inputs
|
|
25
|
+
|
|
26
|
+
All optional. Defaults: `python3 scripts/datama.py settings detect`.
|
|
27
|
+
|
|
28
|
+
| Key | Values | Meaning |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| `detectionMethod` | `observed-volatility` · `variation-volatility` · `relative-variation-threshold` · `absolute-variation-threshold` · `absolute-value-threshold` · `forecast` | Volatility of the values, of point-to-point variations, a threshold on the variation (% or value), on the value, or the gap to a forecast |
|
|
31
|
+
| `detectionThreshold` | number | Threshold of the `*-threshold` methods (percent for `relative-variation-threshold`, measure unit otherwise) |
|
|
32
|
+
| `confidence` | number (%), default `95` | Confidence of the volatility and forecast bands |
|
|
33
|
+
| `confidenceInterval` | boolean, default `true` | Draw the expected band |
|
|
34
|
+
| `flagWhenAbove` / `flagWhenBelow` | boolean, default `true` | Flag spikes, drops, or both |
|
|
35
|
+
| `minImpactThreshold` | number, default `0.5` | Minimum impact for a segment to be reported |
|
|
36
|
+
| `lastPointsOnlyEnabled` / `lastPointsCount` | boolean / integer | Evaluate only the most recent points |
|
|
37
|
+
| `segmentChartMode` | `"overlay"` · `"split"` | Selected segments superimposed, or one chart per segment |
|
|
38
|
+
| `displayDenominator` | boolean | Also plot the denominator of a ratio step |
|
|
39
|
+
| `computeMainKpi` | boolean, default `true` | Detect on the main KPI as well as on the steps |
|
|
40
|
+
|
|
41
|
+
## Advanced
|
|
42
|
+
|
|
43
|
+
Drops of more than 20 % only, shared by every module of the story:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{"solution": "detect", "metrics": ["Sessions", "Orders"], "shared": {"detectionMethod": "relative-variation-threshold", "detectionThreshold": 20},
|
|
47
|
+
"flagWhenAbove": false, "language": "en-US"}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Checks
|
|
51
|
+
|
|
52
|
+
- A date column exists and parses as dates (ISO `YYYY-MM-DD`).
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Explore (`explore.dimensions`)
|
|
2
|
+
|
|
3
|
+
Breaks one or two measures down across one or two dimensions, with an optional comparison: bar, line, area, combo, mekko and scatter charts, plus a generated title and comment. Zero settings already give a board-ready chart.
|
|
4
|
+
|
|
5
|
+
## When
|
|
6
|
+
|
|
7
|
+
- "Break down revenue by country", "sessions by device and channel", "orders by week", "conversion rate by country", "distribution of X across Y".
|
|
8
|
+
- A "why did it change" question is Compare. Explore still **shows** a comparison (two periods side by side, deltas).
|
|
9
|
+
|
|
10
|
+
## Minimal
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{"solution": "explore", "metrics": ["Sessions", "Orders", "Revenue"], "primary": "Country", "secondary": "Channel", "metric1": "Sessions",
|
|
14
|
+
"chart.category": "bar", "chart.layout": "stacked", "title": "Sessions by country and channel", "language": "en-US"}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Business rules
|
|
18
|
+
|
|
19
|
+
- A rate or an average is a **step name** of the equation (`"Orders per Sessions"`), never a summed column: order `metrics` so the step exists, or declare it in `steps` ([market-equation.md](../market-equation.md)).
|
|
20
|
+
- `stacked` / `percent` need an additive measure (a volume); a ratio falls back to `clustered`.
|
|
21
|
+
- A trend needs the date as `primary` and a `line`; several series with a `secondary`.
|
|
22
|
+
|
|
23
|
+
## Bindings
|
|
24
|
+
|
|
25
|
+
| Key | Value | Meaning |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| `primary` | dimension, or `"Comparison Dimension"` | D1: the axis. Default: chosen automatically |
|
|
28
|
+
| `secondary` | dimension, `"Comparison Dimension"` or `""` | D2: series (colors, stacks). `""` = none |
|
|
29
|
+
| `metric1` | measure | M1: bars, line, area, mekko height, scatter X |
|
|
30
|
+
| `metric2` | measure or `""` | M2: right-axis line in a combo, mekko width, scatter Y |
|
|
31
|
+
| `metric3` | measure or `""` | M3: bubble area (scatter `bubble`) |
|
|
32
|
+
|
|
33
|
+
A **measure** is, verbatim: a metric column (`"Revenue"`), a step name (`"Orders per Sessions"`, automatic steps included), or, with a comparison, `"<measure> Δ"` / `"<measure> % Change"`. `"Comparison Dimension"` is the Start / End sides: as `secondary`, one bar per period for each D1 value. Without `context`, these measures compare the older half of the dates with the newer half.
|
|
34
|
+
|
|
35
|
+
## Chart
|
|
36
|
+
|
|
37
|
+
`chart.category` alone is enough (the build syncs `trace` and `view`).
|
|
38
|
+
|
|
39
|
+
| Key | Values | Meaning |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `chart.category` | `bar` · `line` · `area` · `combo` · `mekko` · `scatter` | `combo` = M1 bars + M2 line |
|
|
42
|
+
| `chart.layout` | `clustered` · `stacked` · `percent` · `overlay` | Mekko: `clustered` = Bar Mekko (width = share of M2, height = M1), `percent` = Marimekko 100 % |
|
|
43
|
+
| `chart.variant` | `""` · `moves` · `bubble` | Scatter: `moves` = one arrow per segment from Start to End (comparison); `bubble` = M3 area |
|
|
44
|
+
| `chart.comparisonAxis` | `aligned` · `all` | D1 is the compared dimension: one position per pair, or every value colored Start / End / Other |
|
|
45
|
+
| `chart.dualAxis` | `""` · `shared` · `split` | With M2: right axis, or M2 in its own chart below |
|
|
46
|
+
| `chart.metric2Shape` | `""` · `ticks` · `bars` | Shape of M2 on a bar chart |
|
|
47
|
+
| `chart.alignZeros` | boolean, default `true` | Both value axes share the zero |
|
|
48
|
+
| `chart.barOpacity` / `chart.overlapWidth` | number | Bar opacity / front-bar width in `overlay` |
|
|
49
|
+
| `clusteringThreshold` · `clusteringMethod` · `clusteringBins` · `metricForClustering` | as in Compare | Small D1 / D2 values grouped into "Other" |
|
|
50
|
+
|
|
51
|
+
| Ask | Spec |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| Ranking across categories | `bar` + `clustered` |
|
|
54
|
+
| Composition of a total | `bar` + `stacked` (shares: `percent`) |
|
|
55
|
+
| Trend over time | `line`, D1 = date |
|
|
56
|
+
| Volume and rate together | `combo`, M1 = volume, M2 = step name of the rate |
|
|
57
|
+
| Share by two dimensions | `mekko` + `percent` |
|
|
58
|
+
| Size and rate of each segment | `mekko` + `clustered` (M1 = rate, M2 = volume) |
|
|
59
|
+
| Correlation of two measures | `scatter` + `bubble` |
|
|
60
|
+
| How segments moved between two periods | `scatter` + `moves`, with `context` / `start` / `end` |
|
|
61
|
+
| Period vs period per category | `context` / `start` / `end`, `secondary: "Comparison Dimension"`, `bar` + `clustered` |
|
|
62
|
+
|
|
63
|
+
## Advanced
|
|
64
|
+
|
|
65
|
+
Deltas by country between two years:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{"solution": "explore", "metrics": ["Sessions", "Orders", "Revenue"], "context": "Year", "start": ["2024"], "end": ["2025"],
|
|
69
|
+
"primary": "Country", "metric1": "Revenue Δ", "chart.category": "bar", "language": "en-US"}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Volume and conversion rate in one chart:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{"solution": "explore", "metrics": ["Sessions", "Orders"], "primary": "Channel", "metric1": "Sessions", "metric2": "Orders per Sessions",
|
|
76
|
+
"chart.category": "combo", "language": "en-US"}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Axis, legend, labels and average lines: the `plotter` key ([chart.md](../chart.md)). Any `plotter` replaces the default Explore look: add one only for a precise need. Colors: the theme ([theming.md](../theming.md)).
|
|
80
|
+
|
|
81
|
+
## Checks
|
|
82
|
+
|
|
83
|
+
- `primary` / `secondary` are dimensions of the data (or `"Comparison Dimension"`).
|
|
84
|
+
- `metric1` / `metric2` / `metric3` exist verbatim as columns or step names.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Pivot (`pivot.tree`)
|
|
2
|
+
|
|
3
|
+
"Where is my KPI the most dispersed right now?": Pivot scores every dimension on how unevenly the main KPI spreads across its segments, and shows the decomposition as a tree of cards (equation steps, then the most dispersed dimensions).
|
|
4
|
+
|
|
5
|
+
## When
|
|
6
|
+
|
|
7
|
+
- "Where is conversion the most uneven?", "which dimension explains the most variance in basket size", "show me the KPI tree".
|
|
8
|
+
- No two sides. A change between two periods is Compare.
|
|
9
|
+
|
|
10
|
+
## Minimal
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{"solution": "pivot", "metrics": ["Sessions", "Orders"], "formula": "[2]", "totalStepName": "Conversion rate", "totalStepUnit": "%",
|
|
14
|
+
"title": "Where is conversion the most uneven?", "language": "en-US"}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Business rules
|
|
18
|
+
|
|
19
|
+
- The tree decomposes `totalStepName`: name the KPI the user asks about ([market-equation.md](../market-equation.md)).
|
|
20
|
+
- Dispersion is only meaningful on a ratio KPI (conversion, basket, cost per unit); on a pure volume, suggest Explore.
|
|
21
|
+
|
|
22
|
+
## Inputs
|
|
23
|
+
|
|
24
|
+
All optional. Defaults: `python3 scripts/datama.py settings pivot`.
|
|
25
|
+
|
|
26
|
+
| Key | Values | Meaning |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| `view` | `"tree-default"` · `"waterfall-default"` | Tree of cards, or the Compare waterfall when a comparison is set |
|
|
29
|
+
| `hierarchyExplorationMethod` | `"hierarchy"` · `"top"` | Expand along the dimension order, or pick the most contributing leaves |
|
|
30
|
+
| `hierarchyTopLeaves` | integer ≥ 1 | Leaves per node with `top` |
|
|
31
|
+
| `clusteringThreshold` · `clusteringMethod` · `clusteringBins` · `metricForClustering` | as in Compare | Small segments grouped into "Other" |
|
|
32
|
+
| `treeCardMainKpiRatio` / `treeCardSubKpiRatio` / `treeCardTitleRatio` | `0.75` · `1` · `1.25` | Font size of the card headline / sub lines / title |
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Theming: palette, colors, style presets
|
|
2
|
+
|
|
3
|
+
`THEME` (Studio template) is the **look** of the page. It never changes what is computed. Default: `null` (Datama look). Emit a theme only when the user asks for colors, a brand, a background or a "more modern" / "more sober" look.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
var THEME = {"colors": {"palette": "modern"}};
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Every palette, preset and application color key is listed with its exact values by `python3 scripts/datama.py settings theme [word]`. A name absent from that list does not exist.
|
|
10
|
+
|
|
11
|
+
## `colors.palette`: named palette
|
|
12
|
+
|
|
13
|
+
One key answers most requests. Palette slots: 0 net (totals), 1 rise, 2 drop, 3 start, 4 end, then one color per series.
|
|
14
|
+
|
|
15
|
+
| Request | Palette |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| "More modern", "brighter" | `modern` |
|
|
18
|
+
| Slides, projection, cool tones | `ocean` |
|
|
19
|
+
| Warm tones | `sunset` |
|
|
20
|
+
| Datama product look | `datama` |
|
|
21
|
+
| Datama brand greens (follows `datama-primary-hex`) | `brand` |
|
|
22
|
+
| Retro, muted | `vintage` |
|
|
23
|
+
| High-end, dark and gold | `luxury` |
|
|
24
|
+
| Matches an Excel / Office deck | `excel` |
|
|
25
|
+
| Sober, one hue | `monochrome` · `monochromeGray` |
|
|
26
|
+
| Standard series | `default` |
|
|
27
|
+
|
|
28
|
+
## Custom colors (`palette: "custom"`)
|
|
29
|
+
|
|
30
|
+
For brand colors given by the user. Write every slot you need; the named palette is ignored.
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{"colors": {
|
|
34
|
+
"palette": "custom",
|
|
35
|
+
"waterfall": {"net": "#1B2A4A", "Up": "#1E9E6A", "Down": "#D64545"},
|
|
36
|
+
"plots": ["#F2A93B", "#4C6EF5", "#1B2A4A", "#12B886", "#E64980"]
|
|
37
|
+
}}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
| Key | Meaning |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `waterfall.net` | Total bars (Start, End, intermediate pillars) |
|
|
43
|
+
| `waterfall.Up` / `waterfall.Down` | Drivers that raise / lower the main KPI (and positive / negative deltas) |
|
|
44
|
+
| `plots` | Start, End, then one color per series, in order |
|
|
45
|
+
|
|
46
|
+
When a **drop is good news** (costs, churn, complaints), swap the two: `Up` red, `Down` green.
|
|
47
|
+
|
|
48
|
+
## `colors.application`: page chrome
|
|
49
|
+
|
|
50
|
+
Same keys as the in-app Colors editor (`datama.py settings theme application`). Values are `#RRGGBB`.
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{"colors": {
|
|
54
|
+
"palette": "brand",
|
|
55
|
+
"application": {"datama-primary-hex": "#1B2A4A", "datama-secondary-hex": "#F2A93B"},
|
|
56
|
+
"overrideHostBackground": true
|
|
57
|
+
}}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- `datama-primary-hex` drives headings, active states and, with the `brand` palette, the series ramp.
|
|
61
|
+
- `color-bg-light` / `color-bg-dark` only apply with `"overrideHostBackground": true` (dark or colored page background). Without it the background stays transparent.
|
|
62
|
+
|
|
63
|
+
## Style presets (shapes, typography, spacing)
|
|
64
|
+
|
|
65
|
+
A preset is the whole chart look in one key; it also applies its own palette. It is not part of `THEME`:
|
|
66
|
+
|
|
67
|
+
- Compare: module input `"stylePreset": "<key>"` ([solutions/compare.md](solutions/compare.md)).
|
|
68
|
+
- Explore: starts on its own default preset; keep it unless the user asks for a precise chart change.
|
|
69
|
+
|
|
70
|
+
Keys, labels and paired palettes: `datama.py settings theme stylePreset`. "Looks like a deck" → `presentation`; "board-ready, minimal" → `modern`; "product analytics dashboard" → `dashboard`; "corporate Excel" → `excel`. A preset activates its paired palette: for a color-only request, use `THEME` alone and leave the preset untouched.
|
|
71
|
+
|
|
72
|
+
## Story canvas (`appearance`)
|
|
73
|
+
|
|
74
|
+
A story key of the configuration, not part of `THEME`. Omit it for the default flat look. The Datama "slide" card look:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{"appearance": {"paddingY": 20, "paddingX": 24, "modulePaddingY": 16, "modulePaddingX": 16, "background": "#EEF2F2", "border": true, "radius": 12,
|
|
78
|
+
"borderWidth": 1, "borderColor": "#C8D6D6", "shadow": true, "shadowSize": 5, "shadowAlign": "center", "shadowColor": "#000000", "shadowOpacity": 25}}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Colors accept `#rgb`, `#rrggbb`, `rgb(...)`, `rgba(...)` or `transparent`; numbers are pixels, opacity in percent.
|
|
82
|
+
|
|
83
|
+
## Not theming
|
|
84
|
+
|
|
85
|
+
| Ask | Where |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| Chart type, layout, series | Explore chart keys ([solutions/explore.md](solutions/explore.md)) |
|
|
88
|
+
| Axis, legend, labels, padding of a chart | The `plotter` key ([chart.md](chart.md)) |
|
|
89
|
+
| Logo, fonts of the whole app | Configurable in the Datama app, not exposed to this skill |
|