@datama/studio-skill-instructions 1.1.6 → 1.1.7

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 CHANGED
@@ -14,7 +14,7 @@ Linked `references/…` files are read the same way as this one: `python3 script
14
14
  python3 scripts/datama.py build --data rows.json --config '<json>' --out page.html
15
15
  ```
16
16
 
17
- Read the hash in the skill's Studio license section first. Call `get_studio_license` once, with `license_hash` set to that hash, and add `--license '<license>'` with the value it returns. Never call the tool without that argument. Never show that value to the user. Without the tool, without a hash, or when the server refuses the hash, build without `--license` (demo page).
17
+ Read the hash in the skill's Studio license section first. Call `get_studio_license` only when that section contains a hash other than the placeholder, with `license_hash` set to that hash, and add `--license '<license>'` with the value it returns. In the same conversation, call it again when asked to reload the license, and use the new value. Never call the tool without that argument. Never show that value to the user. Without the tool, without a hash, or when the server refuses the hash, build without `--license` (demo page).
18
18
 
19
19
  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.
20
20
  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.
@@ -43,30 +43,50 @@ Column names are exact tokens from the data: never translate, pluralize, rename
43
43
  - `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 `""`.
44
44
  - `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.
45
45
 
46
- **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).
46
+ **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#configuration).
47
47
 
48
48
  **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).
49
49
 
50
- **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)).
50
+ **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.
51
+
52
+ ## Commands
53
+
54
+ | Command | What it does |
55
+ | --- | --- |
56
+ | `python3 scripts/datama.py instructions [references/<file>.md]` | Prints this workflow, or one reference |
57
+ | `python3 scripts/datama.py build --data <file> --config '<json>' [--theme '<json>'] [--license '<token>'] --out page.html` | Builds and checks the page. `--from page.html` edits an existing page |
58
+ | `python3 scripts/datama.py validate page.html` | Checks a page without rebuilding it |
59
+ | `python3 scripts/datama.py settings <topic> [word]` | Lists the settings Studio exposes, then the value of one (below) |
60
+ | `python3 scripts/datama.py source '<regex>' [--context 5]` | Searches the readable Studio build. Last resort, never to invent a key |
51
61
 
52
62
  ## Changing a setting
53
63
 
54
- Every other key of the configuration is a module input. Write only what the request asks. The frequent ones:
55
- - Compare: `view` (`waterfall-default` · `tree-default`), `analysisMethod` (`auto` · `steps` · `dimensions`), `waterfallMeasure`, `stylePreset`, `chartTitle` — [compare.md](references/solutions/compare.md).
56
- - 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).
57
- - Detect: `detectionMethod`, `lastPointsOnlyEnabled` with `lastPointsCount`, `confidence` — [detect.md](references/solutions/detect.md).
58
- - Pivot: `view`, `hierarchyExplorationMethod` (`hierarchy` · `top`), `hierarchyTopLeaves` — [pivot.md](references/solutions/pivot.md).
59
- - Chart details the inputs do not cover (axis, legend, labels, average lines): the `plotter` key — [chart.md](references/chart.md).
60
- - Look (palette, brand colors, background): `--theme '{"colors": {"palette": "modern"}}'`, not the configuration — [theming.md](references/theming.md).
64
+ Every setting, its allowed values and its default are defined by Studio, not by these instructions. Write only the key the request needs. Do not open the JSON yourself: it ships inside `@datama/studio`, and `datama.py settings` opens it. The first line of the output is the file it read.
61
65
 
62
- Anything else: look it up in the **settings registry** of the Studio release the page loads:
66
+ 1. **Find the setting by its description.** Run `settings <topic>` with no word. It prints `name: description` from the index. Keep the name whose description matches the request.
63
67
 
64
- ```bash
65
- python3 scripts/datama.py settings compare|explore|detect|pivot [word] # module inputs and their defaults
66
- python3 scripts/datama.py settings modules|pins|plotter|theme [word] # modules, story pins, chart keys, palettes and presets
67
- ```
68
+ | Request | Topic | Index |
69
+ | --- | --- | --- |
70
+ | Analysis of a solution | `compare` · `explore` · `detect` · `pivot` | `contract/solutions-settings.json` |
71
+ | Colors, palette, style preset, page chrome | `theme` | `contract/ui-settings.json` |
72
+ | Story canvas (padding, card, shadow) | `appearance` | `contract/ui-settings.json` |
73
+ | Axis, legend, margins, bar fills, animations, reference lines | `plotter` | `contract/ui-settings.json` |
74
+
75
+ 2. **Read the value to write.** Run the same command with that name. It prints `default`, `values`, `min` and `max` from `contract/solution/<solution>-settings.json` or `contract/ui/<topic>-settings.json`. Write one of those values. `settings theme <palette>` prints a palette's colors.
76
+
77
+ 3. **Write it where the page reads it.**
78
+
79
+ | Topic | Where | Example |
80
+ | --- | --- | --- |
81
+ | A solution | `--config`, a top-level key (or one module of `modules`) | `{"waterfallMeasure": "Pts_gap"}` |
82
+ | `theme`, `colors.*` | `--theme`, the dotted name as nested keys | `{"colors": {"waterfall": {"Up": "#1E9E6A"}}}` |
83
+ | `theme`, `stylePreset` | `--config`, a Compare module input | `{"stylePreset": "presentation"}` |
84
+ | `appearance` | `--config`, under `appearance` on the story | `{"appearance": {"radius": 12}}` |
85
+ | `plotter` | `--config`, under `plotter`, the dotted name as nested keys | `{"plotter": {"legends": {"position": "bottom"}}}` |
86
+
87
+ On Explore, any `plotter` replaces Explore's default look: add one only for a precise request. For a color-only request, set `colors.palette` and leave `stylePreset` unset.
68
88
 
69
- 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.
89
+ A name that `settings` does not print does not exist: say "configurable in the Datama app, not exposed to this skill", never "Datama cannot do it". When a description does not make the effect clear, `datama.py source` explains it. `settings modules` and `settings pins` list the render modules and the story pins.
70
90
 
71
91
  ## Editing a page
72
92
 
@@ -76,3 +96,4 @@ Rebuild from the page, passing only the keys that change: `--from page.html --co
76
96
 
77
97
  - Never rebuild the chart yourself, add scripts to the page, edit a template, or send the rows anywhere.
78
98
  - 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.
99
+ - Every column name written in a setting (a hierarchy, a clustering metric, an out-of-scope dimension, a what-if KPI) exists verbatim in the data or the equation.
package/README.md CHANGED
@@ -2,4 +2,4 @@
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
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`.
5
+ Published from the `studio-skill` repository on each release tag. The settings are not here: they ship with `@datama/studio` (`contract/solutions-settings.json`, `contract/ui-settings.json` and their value files) and are read with `python3 scripts/datama.py settings`. `contract/page-contract.json` validates the page.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datama/studio-skill-instructions",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Workflow and references of the datama-studio agent skill, read at run time by its scripts/datama.py.",
5
5
  "files": [
6
6
  "INSTRUCTIONS.md",
@@ -84,7 +84,7 @@ Cost per unit, a sum of unit costs:
84
84
  "formula": "[1]+[2]", "totalStepName": "Cost per unit", "totalStepUnit": "€", "context": "Year", "start": ["2024"], "end": ["2025"], "language": "en-US"}
85
85
  ```
86
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)).
87
+ When a drop of the KPI is good news (costs, churn), say so in the summary and swap the rise and drop colors (`settings theme`).
88
88
 
89
89
  ## Checks
90
90
 
@@ -7,7 +7,7 @@ Explains **why** a main KPI changed between two sides (two periods, two segments
7
7
  - "Why did revenue drop?", "compare Q1 vs Q2", "decompose the conversion change", "Mobile vs Desktop", "budget vs actual".
8
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
9
 
10
- ## Minimal
10
+ ## Configuration
11
11
 
12
12
  ```json
13
13
  {"solution": "compare", "metrics": ["Sessions", "Orders", "Revenue"], "context": "Device", "start": ["Desktop"], "end": ["Mobile"],
@@ -16,86 +16,23 @@ Explains **why** a main KPI changed between two sides (two periods, two segments
16
16
 
17
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
18
 
19
+ **Two metric columns of the same rows** (budget vs actual): `comparisons` with `mode: "metric"`. Each pair names one compared measure (`start`, `end`, `name`); the equation is built from the pair names. `startSegment` and `endSegment` label the sides.
20
+
21
+ **A second comparison:** `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.
22
+
23
+ **What-if**, only when asked: `whatIf.scenarios[]` with `name`, `enabled`, `comparison`, `baseline` (`dimension`, `segments`) and `kpis[]`. `kpis[].name` is a step of the equation. `impact` is `{type: "relative", value}` in percent.
24
+
19
25
  ## Business rules
20
26
 
21
27
  - The waterfall explains `totalStepName`: get the market equation right first ([market-equation.md](../market-equation.md)).
22
28
  - 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)).
29
+ - A drop that is good news (costs, churn): say so in the summary, and swap the rise and drop colors (`settings theme`).
24
30
  - Summarize the `Datama comment:` lines; never recompute the drivers from the rows.
25
31
 
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
- ```
32
+ ## Settings
95
33
 
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`).
34
+ `settings compare`, then `settings compare <name>`: see "Changing a setting" in the instructions.
97
35
 
98
36
  ## Checks
99
37
 
100
38
  - 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.
@@ -7,45 +7,21 @@ Finds outliers in a time series: the measure over time with its expected range,
7
7
  - "Find anomalies in daily orders", "which days were unusual", "monitor the last points", "did anything abnormal happen last week".
8
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
9
 
10
- ## Minimal
10
+ ## Configuration
11
11
 
12
12
  ```json
13
13
  {"solution": "detect", "metrics": ["Sessions", "Orders"], "title": "Unusual months in orders", "language": "en-US"}
14
14
  ```
15
15
 
16
- Monitoring the latest points only: add `"lastPointsOnlyEnabled": true, "lastPointsCount": 7`.
17
-
18
16
  ## Business rules
19
17
 
20
18
  - Detection runs on the main KPI and on every step: get the equation right ([market-equation.md](../market-equation.md)).
21
19
  - 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 |
20
+ - The method, the threshold and the window are settings: match their descriptions to the question.
40
21
 
41
- ## Advanced
22
+ ## Settings
42
23
 
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
- ```
24
+ `settings detect`, then `settings detect <name>`: see "Changing a setting" in the instructions. A detection setting shared by every module of the story goes in `"shared"`.
49
25
 
50
26
  ## Checks
51
27
 
@@ -5,78 +5,24 @@ Breaks one or two measures down across one or two dimensions, with an optional c
5
5
  ## When
6
6
 
7
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).
8
+ - A "why did it change" question is Compare. Explore still **shows** a comparison (two periods side by side, deltas): add `context`, `start` and `end`.
9
9
 
10
- ## Minimal
10
+ ## Configuration
11
11
 
12
12
  ```json
13
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"}
14
+ "title": "Sessions by country and channel", "language": "en-US"}
15
15
  ```
16
16
 
17
+ `primary` is the axis, `secondary` the series, `metric1` the main measure. The chart type and its layout come from the settings: their descriptions say which chart answers which question.
18
+
17
19
  ## Business rules
18
20
 
19
21
  - 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
22
 
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
- ```
23
+ ## Settings
78
24
 
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)).
25
+ `settings explore`, then `settings explore <name>`: see "Changing a setting" in the instructions. `chart.category` alone is enough: the build syncs `trace` and `view`.
80
26
 
81
27
  ## Checks
82
28
 
@@ -7,7 +7,7 @@
7
7
  - "Where is conversion the most uneven?", "which dimension explains the most variance in basket size", "show me the KPI tree".
8
8
  - No two sides. A change between two periods is Compare.
9
9
 
10
- ## Minimal
10
+ ## Configuration
11
11
 
12
12
  ```json
13
13
  {"solution": "pivot", "metrics": ["Sessions", "Orders"], "formula": "[2]", "totalStepName": "Conversion rate", "totalStepUnit": "%",
@@ -19,14 +19,10 @@
19
19
  - The tree decomposes `totalStepName`: name the KPI the user asks about ([market-equation.md](../market-equation.md)).
20
20
  - Dispersion is only meaningful on a ratio KPI (conversion, basket, cost per unit); on a pure volume, suggest Explore.
21
21
 
22
- ## Inputs
22
+ ## Settings
23
23
 
24
- All optional. Defaults: `python3 scripts/datama.py settings pivot`.
24
+ `settings pivot`, then `settings pivot <name>`: see "Changing a setting" in the instructions.
25
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 |
26
+ ## Checks
27
+
28
+ - `totalStepName` is a ratio of the equation.
@@ -1,55 +0,0 @@
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.
@@ -1,89 +0,0 @@
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 |