@chengxianglibra/dsh-data-analysis 0.1.1 → 0.2.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/README.md +139 -53
- package/cordis.patch.yml +1 -1
- package/lib/bin/environment.js +9 -7
- package/lib/bin/presentation-lint.js +21 -0
- package/lib/bridges.js +2 -2
- package/lib/client/credentials/changes.js +74 -0
- package/lib/client/credentials/create-datasource.js +171 -0
- package/lib/client/credentials/credential-draft.js +42 -0
- package/lib/client/credentials/defaults.js +11 -0
- package/lib/client/credentials/descriptions.js +46 -0
- package/lib/client/credentials/install.js +319 -0
- package/lib/client/credentials/model.js +766 -0
- package/lib/client/credentials/report-publishing.js +96 -0
- package/lib/client/credentials/styles.js +21 -0
- package/lib/client/i18n/context.js +22 -0
- package/lib/client/i18n/copy.js +57 -0
- package/lib/client/i18n/credentials.js +475 -0
- package/lib/client/i18n/host.js +27 -0
- package/lib/client/i18n/navigation.js +41 -0
- package/lib/client/i18n/presentation.js +577 -0
- package/lib/client/i18n/python.js +36 -0
- package/lib/client/i18n/semantic.js +441 -0
- package/lib/client/input-context.js +21 -0
- package/lib/client/python-tool/card.js +35 -0
- package/lib/client/python-tool/execution-error.js +35 -0
- package/lib/client/python-tool/install.js +9 -0
- package/lib/client/python-tool/model.js +101 -0
- package/lib/client/right-tabs/install.js +535 -0
- package/lib/client/right-tabs/live-delivery.js +58 -0
- package/lib/client/right-tabs/navigation.js +47 -0
- package/lib/client/right-tabs/page.js +178 -0
- package/lib/client/right-tabs/styles.js +11 -0
- package/lib/client/rpc.js +5 -0
- package/lib/client/semantic-reference.js +10 -0
- package/lib/client/workspace-header-action.js +24 -0
- package/lib/client/workspace-shortcuts.js +26 -0
- package/lib/client.js +1250 -730
- package/lib/compatibility.js +2 -2
- package/lib/datasource/authoring.js +109 -0
- package/lib/datasource/bridge-programs.js +42 -27
- package/lib/datasource/bridge.js +144 -9
- package/lib/datasource/changes-contract.js +41 -0
- package/lib/datasource/changes.js +49 -0
- package/lib/datasource/configure.js +39 -0
- package/lib/datasource/defaults.js +25 -0
- package/lib/datasource/index.js +4 -2
- package/lib/datasource/python-options.js +21 -0
- package/lib/datasource/python.js +206 -0
- package/lib/datasource/resolver-program.js +112 -0
- package/lib/datasource/rpc.js +150 -0
- package/lib/datasource/service.js +962 -0
- package/lib/datasource/shell-env.js +2 -333
- package/lib/datasource/test.js +25 -51
- package/lib/disclosure/activation.js +19 -7
- package/lib/disclosure/execution-guidance.js +52 -0
- package/lib/disclosure/help.js +4 -1
- package/lib/environment/binding.js +54 -9
- package/lib/environment/runtime.js +120 -108
- package/lib/environment/subprocess.js +6 -1
- package/lib/environment/summary.js +3 -3
- package/lib/environment/workspace.js +23 -1
- package/lib/index.js +1 -1
- package/lib/lifecycle.js +33 -0
- package/lib/plugin-agents.js +154 -0
- package/lib/plugin.js +172 -133
- package/lib/presentation/asset.js +34 -0
- package/lib/presentation/assets/portable.js +606 -0
- package/lib/presentation/assets/static.js +1216 -0
- package/lib/presentation/build/index.js +72 -0
- package/lib/presentation/commit.js +163 -0
- package/lib/presentation/contracts/asset-path.js +9 -0
- package/lib/presentation/contracts/catalog.js +62 -0
- package/lib/presentation/contracts/charts.js +453 -0
- package/lib/presentation/contracts/editing.js +58 -0
- package/lib/presentation/contracts/index.js +663 -0
- package/lib/presentation/contracts/interaction.js +62 -0
- package/lib/presentation/contracts/types.js +15 -0
- package/lib/presentation/contracts/values.js +28 -0
- package/lib/presentation/delivery.js +71 -0
- package/lib/presentation/export-html.js +214 -0
- package/lib/presentation/files.js +82 -0
- package/lib/presentation/index.js +6 -0
- package/lib/presentation/lint.js +46 -0
- package/lib/presentation/projection/files.js +85 -0
- package/lib/presentation/projection/index.js +196 -0
- package/lib/presentation/projection/program.js +137 -0
- package/lib/presentation/projection/sql-code.js +79 -0
- package/lib/presentation/receipt.js +34 -0
- package/lib/presentation/reports.js +219 -0
- package/lib/presentation/rpc.js +186 -0
- package/lib/presentation/tool.js +118 -0
- package/lib/python-execution-contracts.js +1 -0
- package/lib/python-execution.js +232 -0
- package/lib/report-publishing/adapters.js +111 -0
- package/lib/report-publishing/config.js +69 -0
- package/lib/report-publishing/service.js +180 -0
- package/lib/rpc.js +49 -0
- package/lib/semantic-browser/contracts.js +97 -0
- package/lib/semantic-browser/definition.js +64 -0
- package/lib/semantic-browser/program.js +129 -0
- package/lib/semantic-browser/service.js +106 -0
- package/lib/semantic-reference/bridge.js +127 -0
- package/lib/semantic-reference/contracts.js +127 -0
- package/lib/semantic-reference/environment.js +56 -0
- package/lib/semantic-reference/index.js +3 -0
- package/lib/semantic-reference/labels.js +16 -0
- package/lib/semantic-reference/rpc.js +143 -0
- package/lib/semantic-reference/search.js +95 -0
- package/lib/semantic-reference/usage.js +152 -0
- package/lib/tool-lifecycle.js +22 -0
- package/lib/types/bridges.d.ts +2 -2
- package/lib/types/client/credentials/changes.d.ts +9 -0
- package/lib/types/client/credentials/create-datasource.d.ts +7 -0
- package/lib/types/client/credentials/credential-draft.d.ts +14 -0
- package/lib/types/client/credentials/defaults.d.ts +2 -0
- package/lib/types/client/credentials/descriptions.d.ts +1 -0
- package/lib/types/client/credentials/install.d.ts +19 -0
- package/lib/types/client/credentials/model.d.ts +79 -0
- package/lib/types/client/credentials/report-publishing.d.ts +5 -0
- package/lib/types/client/credentials/styles.d.ts +1 -0
- package/lib/types/client/i18n/context.d.ts +17 -0
- package/lib/types/client/i18n/copy.d.ts +806 -0
- package/lib/types/client/i18n/credentials.d.ts +475 -0
- package/lib/types/client/i18n/host.d.ts +16 -0
- package/lib/types/client/i18n/navigation.d.ts +41 -0
- package/lib/types/client/i18n/presentation.d.ts +577 -0
- package/lib/types/client/i18n/python.d.ts +19 -0
- package/lib/types/client/i18n/semantic.d.ts +441 -0
- package/lib/types/client/input-context.d.ts +19 -0
- package/lib/types/client/presentation/ask-dsh.d.ts +5 -0
- package/lib/types/client/presentation/catalog-model.d.ts +24 -0
- package/lib/types/client/presentation/catalog.d.ts +20 -0
- package/lib/types/client/presentation/chart-explorer.d.ts +12 -0
- package/lib/types/client/presentation/chart-geometry.d.ts +30 -0
- package/lib/types/client/presentation/chart-renderer.d.ts +10 -0
- package/lib/types/client/presentation/chart-specials.d.ts +10 -0
- package/lib/types/client/presentation/chart-styles.d.ts +1 -0
- package/lib/types/client/presentation/chart-tooltip.d.ts +13 -0
- package/lib/types/client/presentation/chart-view.d.ts +23 -0
- package/lib/types/client/presentation/context-reference.d.ts +12 -0
- package/lib/types/client/presentation/copy-context.d.ts +5 -0
- package/lib/types/client/presentation/delivery-model.d.ts +75 -0
- package/lib/types/client/presentation/delivery.d.ts +78 -0
- package/lib/types/client/presentation/download.d.ts +2 -0
- package/lib/types/client/presentation/editor-controls.d.ts +12 -0
- package/lib/types/client/presentation/export-menu.d.ts +26 -0
- package/lib/types/client/presentation/export-view.d.ts +63 -0
- package/lib/types/client/presentation/global-filters.d.ts +6 -0
- package/lib/types/client/presentation/host-entry.d.ts +18 -0
- package/lib/types/client/presentation/icons.d.ts +4 -0
- package/lib/types/client/presentation/markdown.d.ts +5 -0
- package/lib/types/client/presentation/model.d.ts +61 -0
- package/lib/types/client/presentation/reader.d.ts +24 -0
- package/lib/types/client/presentation/reference-source.d.ts +9 -0
- package/lib/types/client/presentation/source-code-model.d.ts +17 -0
- package/lib/types/client/presentation/source-code.d.ts +6 -0
- package/lib/types/client/presentation/source-dialog.d.ts +12 -0
- package/lib/types/client/presentation/source-facts.d.ts +20 -0
- package/lib/types/client/presentation/source-format.d.ts +5 -0
- package/lib/types/client/presentation/source-highlight.d.ts +7 -0
- package/lib/types/client/presentation/sources.d.ts +13 -0
- package/lib/types/client/presentation/styles.d.ts +1 -0
- package/lib/types/client/presentation/table.d.ts +16 -0
- package/lib/types/client/presentation/use-element-width.d.ts +5 -0
- package/lib/types/client/python-tool/card.d.ts +2 -0
- package/lib/types/client/python-tool/execution-error.d.ts +3 -0
- package/lib/types/client/python-tool/install.d.ts +2 -0
- package/lib/types/client/python-tool/model.d.ts +20 -0
- package/lib/types/client/right-tabs/install.d.ts +18 -0
- package/lib/types/client/right-tabs/live-delivery.d.ts +8 -0
- package/lib/types/client/right-tabs/navigation.d.ts +17 -0
- package/lib/types/client/right-tabs/page.d.ts +36 -0
- package/lib/types/client/right-tabs/styles.d.ts +2 -0
- package/lib/types/client/rpc.d.ts +3 -0
- package/lib/types/client/semantic-reference.d.ts +4 -0
- package/lib/types/client/workspace-header-action.d.ts +7 -0
- package/lib/types/client/workspace-shortcuts.d.ts +15 -0
- package/lib/types/client.d.ts +9 -124
- package/lib/types/compatibility.d.ts +3 -3
- package/lib/types/datasource/authoring.d.ts +35 -0
- package/lib/types/datasource/bridge.d.ts +43 -4
- package/lib/types/datasource/changes-contract.d.ts +18 -0
- package/lib/types/datasource/changes.d.ts +15 -0
- package/lib/types/datasource/configure.d.ts +7 -0
- package/lib/types/datasource/defaults.d.ts +7 -0
- package/lib/types/datasource/index.d.ts +8 -5
- package/lib/types/datasource/python-options.d.ts +9 -0
- package/lib/types/datasource/python.d.ts +19 -0
- package/lib/types/datasource/resolver-program.d.ts +6 -0
- package/lib/types/datasource/rpc.d.ts +5 -0
- package/lib/types/datasource/service.d.ts +155 -0
- package/lib/types/datasource/shell-env.d.ts +0 -29
- package/lib/types/datasource/test.d.ts +6 -29
- package/lib/types/disclosure/activation.d.ts +2 -1
- package/lib/types/disclosure/execution-guidance.d.ts +6 -0
- package/lib/types/disclosure/help.d.ts +1 -1
- package/lib/types/environment/binding.d.ts +5 -1
- package/lib/types/environment/errors.d.ts +1 -1
- package/lib/types/environment/runtime.d.ts +5 -5
- package/lib/types/environment/types.d.ts +15 -3
- package/lib/types/environment/workspace.d.ts +1 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/lifecycle.d.ts +8 -0
- package/lib/types/plugin-agents.d.ts +27 -0
- package/lib/types/plugin.d.ts +14 -24
- package/lib/types/presentation/asset.d.ts +6 -0
- package/lib/types/presentation/build/index.d.ts +16 -0
- package/lib/types/presentation/commit.d.ts +4 -0
- package/lib/types/presentation/contracts/asset-path.d.ts +2 -0
- package/lib/types/presentation/contracts/catalog.d.ts +27 -0
- package/lib/types/presentation/contracts/charts.d.ts +11 -0
- package/lib/types/presentation/contracts/editing.d.ts +8 -0
- package/lib/types/presentation/contracts/index.d.ts +11 -0
- package/lib/types/presentation/contracts/interaction.d.ts +8 -0
- package/lib/types/presentation/contracts/types.d.ts +255 -0
- package/lib/types/presentation/contracts/values.d.ts +9 -0
- package/lib/types/presentation/delivery.d.ts +3 -0
- package/lib/types/presentation/export-html.d.ts +13 -0
- package/lib/types/presentation/files.d.ts +7 -0
- package/lib/types/presentation/index.d.ts +6 -0
- package/lib/types/presentation/lint.d.ts +13 -0
- package/lib/types/presentation/projection/files.d.ts +2 -0
- package/lib/types/presentation/projection/index.d.ts +20 -0
- package/lib/types/presentation/projection/program.d.ts +2 -0
- package/lib/types/presentation/projection/sql-code.d.ts +2 -0
- package/lib/types/presentation/receipt.d.ts +14 -0
- package/lib/types/presentation/reports.d.ts +10 -0
- package/lib/types/presentation/rpc.d.ts +25 -0
- package/lib/types/presentation/tool.d.ts +12 -0
- package/lib/types/python-execution-contracts.d.ts +10 -0
- package/lib/types/python-execution.d.ts +10 -0
- package/lib/types/report-publishing/adapters.d.ts +6 -0
- package/lib/types/report-publishing/config.d.ts +22 -0
- package/lib/types/report-publishing/service.d.ts +68 -0
- package/lib/types/rpc.d.ts +3 -0
- package/lib/types/semantic-browser/contracts.d.ts +47 -0
- package/lib/types/semantic-browser/definition.d.ts +20 -0
- package/lib/types/semantic-browser/program.d.ts +2 -0
- package/lib/types/semantic-browser/service.d.ts +26 -0
- package/lib/types/semantic-reference/bridge.d.ts +12 -0
- package/lib/types/semantic-reference/contracts.d.ts +54 -0
- package/lib/types/semantic-reference/environment.d.ts +22 -0
- package/lib/types/semantic-reference/index.d.ts +3 -0
- package/lib/types/semantic-reference/labels.d.ts +16 -0
- package/lib/types/semantic-reference/rpc.d.ts +15 -0
- package/lib/types/semantic-reference/search.d.ts +10 -0
- package/lib/types/semantic-reference/usage.d.ts +43 -0
- package/lib/types/tool-lifecycle.d.ts +4 -0
- package/lib/types/workspace-identity.d.ts +6 -0
- package/lib/workspace-identity.js +9 -0
- package/package.json +99 -53
- package/python/presentation-kit/dist/dsh_data_analysis_presentation_kit-1.1.0-py3-none-any.whl +0 -0
- package/skills/dsh-data-analysis-files/SKILL.md +32 -0
- package/skills/dsh-data-analysis-files/references/examples.md +93 -0
- package/skills/dsh-data-analysis-presentation/SKILL.md +28 -0
- package/skills/dsh-data-analysis-presentation/references/chart-examples.md +18 -0
- package/skills/dsh-data-analysis-presentation/references/charts.md +55 -0
- package/skills/dsh-data-analysis-presentation/references/examples/artifact.draft.json +36 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-bins.dataset.json +33 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-boxes.dataset.json +45 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-composition.dataset.json +33 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-funnel.dataset.json +27 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-precision.dataset.json +21 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-series.dataset.json +58 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-shares.dataset.json +33 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-waterfall.dataset.json +44 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts.draft.json +393 -0
- package/skills/dsh-data-analysis-presentation/references/examples/comparison-selected.dataset.json +24 -0
- package/skills/dsh-data-analysis-presentation/references/examples/comparison-summary.dataset.json +22 -0
- package/skills/dsh-data-analysis-presentation/references/examples/comparison.dataset.json +18 -0
- package/skills/dsh-data-analysis-presentation/references/examples/comparison.draft.json +80 -0
- package/skills/dsh-data-analysis-presentation/references/examples/computed-sources.draft.json +42 -0
- package/skills/dsh-data-analysis-presentation/references/examples/computed.dataset.json +12 -0
- package/skills/dsh-data-analysis-presentation/references/examples/computed.draft.json +58 -0
- package/skills/dsh-data-analysis-presentation/references/examples/interaction-detail.dataset.json +30 -0
- package/skills/dsh-data-analysis-presentation/references/examples/interaction-summary.dataset.json +22 -0
- package/skills/dsh-data-analysis-presentation/references/examples/interaction.draft.json +279 -0
- package/skills/dsh-data-analysis-presentation/references/examples/source-only.draft.json +27 -0
- package/skills/dsh-data-analysis-presentation/references/examples/write-charts.py +73 -0
- package/skills/dsh-data-analysis-presentation/references/examples/write-comparison.py +42 -0
- package/skills/dsh-data-analysis-presentation/references/examples/write-computed.py +21 -0
- package/skills/dsh-data-analysis-presentation/references/examples/write-interaction.py +33 -0
- package/skills/dsh-data-analysis-presentation/references/examples.md +44 -0
- package/skills/dsh-data-analysis-presentation/references/export-html.md +7 -0
- package/skills/dsh-data-analysis-presentation/references/interaction.md +56 -0
- package/skills/dsh-data-analysis-presentation/references/narrative.md +37 -0
- package/skills/dsh-data-analysis-presentation/references/publishing.md +3 -0
- package/skills/dsh-data-analysis-presentation/references/schema.md +162 -0
- package/lib/datasource/access.js +0 -60
- package/lib/datasource/credentials.js +0 -24
- package/lib/evidence/bridge-program.js +0 -153
- package/lib/evidence/bridge.js +0 -166
- package/lib/evidence/index.js +0 -2
- package/lib/evidence/sources.js +0 -263
- package/lib/types/datasource/access.d.ts +0 -27
- package/lib/types/evidence/bridge.d.ts +0 -40
- package/lib/types/evidence/index.d.ts +0 -4
- package/lib/types/evidence/sources.d.ts +0 -57
- package/python/report-kit/dist/dsh_data_analysis_report_kit-3.0.0-py3-none-any.whl +0 -0
- package/skills/dsh-data-analysis-report/SKILL.md +0 -57
- package/skills/dsh-data-analysis-report/assets/marivo-artifact.js +0 -113
- package/skills/dsh-data-analysis-report/assets/marivo-session-dag.js +0 -1201
- package/skills/dsh-data-analysis-report/assets/report-data.js +0 -449
package/skills/dsh-data-analysis-presentation/references/examples/interaction-summary.dataset.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"columns": [
|
|
4
|
+
{ "id": "query_count", "label": "query_count", "type": "int64", "nullable": false },
|
|
5
|
+
{ "id": "failed_count", "label": "failed_count", "type": "int64", "nullable": false },
|
|
6
|
+
{ "id": "failure_rate", "label": "failure_rate", "type": "decimal", "nullable": false }
|
|
7
|
+
],
|
|
8
|
+
"rows": [
|
|
9
|
+
["550", "15", "2.73"],
|
|
10
|
+
["330", "6", "1.82"],
|
|
11
|
+
["220", "9", "4.09"],
|
|
12
|
+
["250", "8", "3.20"],
|
|
13
|
+
["150", "3", "2.00"],
|
|
14
|
+
["100", "5", "5.00"],
|
|
15
|
+
["300", "7", "2.33"],
|
|
16
|
+
["180", "3", "1.67"],
|
|
17
|
+
["120", "4", "3.33"]
|
|
18
|
+
],
|
|
19
|
+
"rowCount": 9,
|
|
20
|
+
"limit": 5000,
|
|
21
|
+
"truncated": false
|
|
22
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"title": "查询运行概览 · 全局筛选演示",
|
|
4
|
+
"sources": [],
|
|
5
|
+
"datasets": [
|
|
6
|
+
{
|
|
7
|
+
"id": "summary",
|
|
8
|
+
"kind": "computed",
|
|
9
|
+
"path": "presentation-example/interaction-summary.dataset.json",
|
|
10
|
+
"sourceIds": []
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "detail",
|
|
14
|
+
"kind": "computed",
|
|
15
|
+
"path": "presentation-example/interaction-detail.dataset.json",
|
|
16
|
+
"sourceIds": []
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"blocks": [
|
|
20
|
+
{
|
|
21
|
+
"id": "intro",
|
|
22
|
+
"kind": "markdown",
|
|
23
|
+
"text": "## 两日查询概览\n\n这是合成测试数据,用于验证全局筛选;不代表真实 Trino 查询结果。全量包含 550 次查询、15 次失败。下方可按日期和集群查看预先计算的结果。"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "fixed",
|
|
27
|
+
"kind": "metric",
|
|
28
|
+
"datasetId": "summary",
|
|
29
|
+
"columnId": "query_count",
|
|
30
|
+
"rowIndex": 0,
|
|
31
|
+
"label": "完整快照查询数"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "count",
|
|
35
|
+
"kind": "metric",
|
|
36
|
+
"datasetId": "summary",
|
|
37
|
+
"columnId": "query_count",
|
|
38
|
+
"rowSelection": "slice",
|
|
39
|
+
"label": "当前查询数"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "failed",
|
|
43
|
+
"kind": "metric",
|
|
44
|
+
"datasetId": "summary",
|
|
45
|
+
"columnId": "failed_count",
|
|
46
|
+
"rowSelection": "slice",
|
|
47
|
+
"label": "当前失败数"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "rate",
|
|
51
|
+
"kind": "metric",
|
|
52
|
+
"datasetId": "summary",
|
|
53
|
+
"columnId": "failure_rate",
|
|
54
|
+
"rowSelection": "slice",
|
|
55
|
+
"label": "当前失败率(%)"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"id": "chart",
|
|
59
|
+
"kind": "chart",
|
|
60
|
+
"datasetId": "detail",
|
|
61
|
+
"chart": "bar",
|
|
62
|
+
"x": "category",
|
|
63
|
+
"y": ["query_count"],
|
|
64
|
+
"numericMode": "exact",
|
|
65
|
+
"preparedViews": [
|
|
66
|
+
{
|
|
67
|
+
"id": "horizontal",
|
|
68
|
+
"label": "横向比较",
|
|
69
|
+
"datasetId": "detail",
|
|
70
|
+
"chart": "horizontalBar",
|
|
71
|
+
"x": "category",
|
|
72
|
+
"y": ["query_count"],
|
|
73
|
+
"numericMode": "exact"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "table",
|
|
79
|
+
"kind": "table",
|
|
80
|
+
"datasetId": "detail"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "limitations",
|
|
84
|
+
"kind": "markdown",
|
|
85
|
+
"text": "## 口径说明\n\n失败率由 Python 按当前组合的失败数 / 查询数预先计算,单位为 %。每个筛选组合均有完整快照,阅读器不重新求和或计算比例。"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"interaction": {
|
|
89
|
+
"title": "交互分析",
|
|
90
|
+
"blockIds": ["count", "failed", "rate", "chart", "table"],
|
|
91
|
+
"filters": [
|
|
92
|
+
{
|
|
93
|
+
"id": "day",
|
|
94
|
+
"label": "日期",
|
|
95
|
+
"allOptionId": "any",
|
|
96
|
+
"options": [
|
|
97
|
+
{
|
|
98
|
+
"id": "any",
|
|
99
|
+
"label": "全部"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "mon",
|
|
103
|
+
"label": "周一"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "tue",
|
|
107
|
+
"label": "周二"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"id": "cluster",
|
|
113
|
+
"label": "集群",
|
|
114
|
+
"allOptionId": "any",
|
|
115
|
+
"options": [
|
|
116
|
+
{
|
|
117
|
+
"id": "any",
|
|
118
|
+
"label": "全部"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": "a",
|
|
122
|
+
"label": "甲集群"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "b",
|
|
126
|
+
"label": "乙集群"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"slices": [
|
|
132
|
+
{
|
|
133
|
+
"selection": {
|
|
134
|
+
"day": "any",
|
|
135
|
+
"cluster": "any"
|
|
136
|
+
},
|
|
137
|
+
"datasets": [
|
|
138
|
+
{
|
|
139
|
+
"datasetId": "summary",
|
|
140
|
+
"rowIndices": [0]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"datasetId": "detail",
|
|
144
|
+
"rowIndices": [0, 1]
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"selection": {
|
|
150
|
+
"day": "any",
|
|
151
|
+
"cluster": "a"
|
|
152
|
+
},
|
|
153
|
+
"datasets": [
|
|
154
|
+
{
|
|
155
|
+
"datasetId": "summary",
|
|
156
|
+
"rowIndices": [1]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"datasetId": "detail",
|
|
160
|
+
"rowIndices": [2, 3]
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"selection": {
|
|
166
|
+
"day": "any",
|
|
167
|
+
"cluster": "b"
|
|
168
|
+
},
|
|
169
|
+
"datasets": [
|
|
170
|
+
{
|
|
171
|
+
"datasetId": "summary",
|
|
172
|
+
"rowIndices": [2]
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"datasetId": "detail",
|
|
176
|
+
"rowIndices": [4, 5]
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"selection": {
|
|
182
|
+
"day": "mon",
|
|
183
|
+
"cluster": "any"
|
|
184
|
+
},
|
|
185
|
+
"datasets": [
|
|
186
|
+
{
|
|
187
|
+
"datasetId": "summary",
|
|
188
|
+
"rowIndices": [3]
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"datasetId": "detail",
|
|
192
|
+
"rowIndices": [6, 7]
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"selection": {
|
|
198
|
+
"day": "mon",
|
|
199
|
+
"cluster": "a"
|
|
200
|
+
},
|
|
201
|
+
"datasets": [
|
|
202
|
+
{
|
|
203
|
+
"datasetId": "summary",
|
|
204
|
+
"rowIndices": [4]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"datasetId": "detail",
|
|
208
|
+
"rowIndices": [8, 9]
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"selection": {
|
|
214
|
+
"day": "mon",
|
|
215
|
+
"cluster": "b"
|
|
216
|
+
},
|
|
217
|
+
"datasets": [
|
|
218
|
+
{
|
|
219
|
+
"datasetId": "summary",
|
|
220
|
+
"rowIndices": [5]
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"datasetId": "detail",
|
|
224
|
+
"rowIndices": [10, 11]
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"selection": {
|
|
230
|
+
"day": "tue",
|
|
231
|
+
"cluster": "any"
|
|
232
|
+
},
|
|
233
|
+
"datasets": [
|
|
234
|
+
{
|
|
235
|
+
"datasetId": "summary",
|
|
236
|
+
"rowIndices": [6]
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"datasetId": "detail",
|
|
240
|
+
"rowIndices": [12, 13]
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"selection": {
|
|
246
|
+
"day": "tue",
|
|
247
|
+
"cluster": "a"
|
|
248
|
+
},
|
|
249
|
+
"datasets": [
|
|
250
|
+
{
|
|
251
|
+
"datasetId": "summary",
|
|
252
|
+
"rowIndices": [7]
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"datasetId": "detail",
|
|
256
|
+
"rowIndices": [14, 15]
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"selection": {
|
|
262
|
+
"day": "tue",
|
|
263
|
+
"cluster": "b"
|
|
264
|
+
},
|
|
265
|
+
"datasets": [
|
|
266
|
+
{
|
|
267
|
+
"datasetId": "summary",
|
|
268
|
+
"rowIndices": [8]
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"datasetId": "detail",
|
|
272
|
+
"rowIndices": [16, 17]
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
"locale": "zh-CN"
|
|
279
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"title": "演示:只读来源面板",
|
|
4
|
+
"datasets": [],
|
|
5
|
+
"sources": [
|
|
6
|
+
{
|
|
7
|
+
"id": "analysis",
|
|
8
|
+
"ref": {
|
|
9
|
+
"sessionId": "example-session",
|
|
10
|
+
"artifactRef": "example-artifact"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"blocks": [
|
|
15
|
+
{
|
|
16
|
+
"id": "scope",
|
|
17
|
+
"kind": "markdown",
|
|
18
|
+
"text": "演示草稿:替换实际引用后,查看生成时可恢复的公开来源事实。"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "sources",
|
|
22
|
+
"kind": "source",
|
|
23
|
+
"sourceIds": ["analysis"]
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"locale": "zh-CN"
|
|
27
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""合成图表样例:在分析阶段计算统计量,写入当前 Workspace。"""
|
|
2
|
+
|
|
3
|
+
from dataclasses import asdict
|
|
4
|
+
from decimal import Decimal
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import pandas as pd
|
|
9
|
+
|
|
10
|
+
from dsh_data_analysis_presentation import write_dataset
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
frames = {}
|
|
14
|
+
frames["charts-series"] = pd.DataFrame({
|
|
15
|
+
"period": [f"2026-{i:02d}" for i in range(1, 13)],
|
|
16
|
+
"a": [12., 18., 15., 24., 19., 30., 28., 34., 31., 42., 39., 45.],
|
|
17
|
+
"b": [8., 11., 10., 14., 13., 17., 19., 18., 22., 25., 24., 28.],
|
|
18
|
+
"coordinate": [float(i) for i in range(1, 13)],
|
|
19
|
+
"volume": [float(i * 10) for i in range(1, 13)],
|
|
20
|
+
"segment": ["B" if i % 2 else "A" for i in range(12)],
|
|
21
|
+
})
|
|
22
|
+
denominators = [100., 200., 50.]
|
|
23
|
+
a_values = [60., 60., 40.]
|
|
24
|
+
frames["charts-shares"] = pd.DataFrame({
|
|
25
|
+
"category": ["A", "B", "C"],
|
|
26
|
+
"a": [value / total for value, total in zip(a_values, denominators)],
|
|
27
|
+
"b": [(total - value) / total for value, total in zip(a_values, denominators)],
|
|
28
|
+
"denominator": denominators,
|
|
29
|
+
})
|
|
30
|
+
observations = pd.Series([.2, .8, 1.5, 2., 2.8, 5.])
|
|
31
|
+
bounds = [0., 1., 3., 6.]
|
|
32
|
+
frames["charts-bins"] = pd.DataFrame({
|
|
33
|
+
"bin": ["0–1", "1–3", "3–6"],
|
|
34
|
+
"lower": bounds[:-1], "upper": bounds[1:],
|
|
35
|
+
"frequency": [float(((observations >= lo) & (observations < hi)).sum())
|
|
36
|
+
for lo, hi in zip(bounds[:-1], bounds[1:])],
|
|
37
|
+
})
|
|
38
|
+
summary = []
|
|
39
|
+
for name, values in [("A", [1., 2., 3., 4., 5.]), ("B", [2., 3., 4., 5., 6.])]:
|
|
40
|
+
series = pd.Series(values)
|
|
41
|
+
summary.append([name, series.min(), series.quantile(.25), series.median(),
|
|
42
|
+
series.quantile(.75), series.max()])
|
|
43
|
+
frames["charts-boxes"] = pd.DataFrame(summary, columns=[
|
|
44
|
+
"group", "minimum", "q1", "median", "q3", "maximum"])
|
|
45
|
+
values = [60., 30., 10.]
|
|
46
|
+
frames["charts-composition"] = pd.DataFrame({
|
|
47
|
+
"category": ["A", "B", "C"], "value": values,
|
|
48
|
+
"share": [value / sum(values) for value in values], "rank": [1., 2., 3.],
|
|
49
|
+
})
|
|
50
|
+
stages = [100., 60., 20.]
|
|
51
|
+
frames["charts-funnel"] = pd.DataFrame({
|
|
52
|
+
"stage": ["访问", "注册", "购买"], "value": stages,
|
|
53
|
+
"share": [value / stages[0] for value in stages],
|
|
54
|
+
})
|
|
55
|
+
initial, decreases, increases = 100., -20., 30.
|
|
56
|
+
after_decrease = initial + decreases
|
|
57
|
+
final = after_decrease + increases
|
|
58
|
+
frames["charts-waterfall"] = pd.DataFrame({
|
|
59
|
+
"step": ["期初", "减少", "增加", "期末"],
|
|
60
|
+
"change": [initial, decreases, increases, final],
|
|
61
|
+
"start": [0., initial, after_decrease, 0.],
|
|
62
|
+
"end": [initial, after_decrease, final, final],
|
|
63
|
+
"role": ["start", "delta", "delta", "total"],
|
|
64
|
+
})
|
|
65
|
+
frames["charts-precision"] = pd.DataFrame({
|
|
66
|
+
"label": ["精确值", "缺失", "长小数"],
|
|
67
|
+
"amount": [Decimal("0.1000"), None, Decimal("12345678901234.5678")],
|
|
68
|
+
})
|
|
69
|
+
root = Path("presentation-example")
|
|
70
|
+
root.mkdir(parents=True, exist_ok=True)
|
|
71
|
+
receipts = [asdict(write_dataset(frame, root / f"{name}.dataset.json"))
|
|
72
|
+
for name, frame in frames.items()]
|
|
73
|
+
print(json.dumps(receipts, ensure_ascii=False))
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""仅演示已有数据的比较展示,不是业务分析流程。"""
|
|
2
|
+
|
|
3
|
+
from dataclasses import asdict
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import pandas as pd
|
|
8
|
+
|
|
9
|
+
from dsh_data_analysis_presentation import write_dataset
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
full = pd.DataFrame({
|
|
13
|
+
"category": ["A", "B", "C"],
|
|
14
|
+
"baseline": [100, 80, 20],
|
|
15
|
+
"current": [50, 50, 50],
|
|
16
|
+
})
|
|
17
|
+
full["delta_current_minus_baseline"] = full["current"] - full["baseline"]
|
|
18
|
+
ranked = full.assign(decrease_baseline_minus_current=-full["delta_current_minus_baseline"])
|
|
19
|
+
# 这是 Agent 侧预选:writer 收到两行,truncated=False 不表示原始范围只有两项。
|
|
20
|
+
selected = ranked.sort_values("decrease_baseline_minus_current", ascending=False).head(2)
|
|
21
|
+
other = full.loc[~full["category"].isin(selected["category"])]
|
|
22
|
+
summary = pd.DataFrame([
|
|
23
|
+
{
|
|
24
|
+
"scope": scope,
|
|
25
|
+
"baseline": int(frame["baseline"].sum()),
|
|
26
|
+
"current": int(frame["current"].sum()),
|
|
27
|
+
"delta_current_minus_baseline": int(frame["delta_current_minus_baseline"].sum()),
|
|
28
|
+
}
|
|
29
|
+
for scope, frame in [("全量", full), ("选中 A、B", selected), ("其他 C", other)]
|
|
30
|
+
])
|
|
31
|
+
|
|
32
|
+
output_dir = Path("presentation-example")
|
|
33
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
34
|
+
receipts = [
|
|
35
|
+
asdict(write_dataset(frame, output_dir / filename))
|
|
36
|
+
for filename, frame in [
|
|
37
|
+
("comparison.dataset.json", full),
|
|
38
|
+
("comparison-selected.dataset.json", selected),
|
|
39
|
+
("comparison-summary.dataset.json", summary),
|
|
40
|
+
]
|
|
41
|
+
]
|
|
42
|
+
print(json.dumps(receipts, ensure_ascii=False))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""演示数据:通过 marivo_python 在当前绑定 Workspace 执行。"""
|
|
2
|
+
|
|
3
|
+
from dataclasses import asdict
|
|
4
|
+
from decimal import Decimal
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import pandas as pd
|
|
9
|
+
|
|
10
|
+
from dsh_data_analysis_presentation import write_dataset
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
frame = pd.DataFrame({
|
|
14
|
+
"month": ["2026-01", "2026-02", "2026-03"],
|
|
15
|
+
"count": [12, 18, 9],
|
|
16
|
+
"amount": [Decimal("120.5000"), None, Decimal("90.0000")],
|
|
17
|
+
})
|
|
18
|
+
output = Path("presentation-example/computed.dataset.json")
|
|
19
|
+
output.parent.mkdir(parents=True, exist_ok=True)
|
|
20
|
+
receipt = write_dataset(frame, output, labels={"month": "月份", "count": "数量", "amount": "金额"})
|
|
21
|
+
print(json.dumps(asdict(receipt), ensure_ascii=False))
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""全局筛选的合成测试数据;所有汇总均在 Python 中准备,不代表真实业务。"""
|
|
2
|
+
from dataclasses import asdict
|
|
3
|
+
from decimal import Decimal
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import pandas as pd
|
|
8
|
+
from dsh_data_analysis_presentation import write_dataset
|
|
9
|
+
|
|
10
|
+
# 日期、集群、查询类别、查询数、失败数。
|
|
11
|
+
raw = [
|
|
12
|
+
("mon", "a", "交互查询", 100, 2), ("mon", "a", "批量查询", 50, 1),
|
|
13
|
+
("mon", "b", "交互查询", 80, 4), ("mon", "b", "批量查询", 20, 1),
|
|
14
|
+
("tue", "a", "交互查询", 120, 3), ("tue", "a", "批量查询", 60, 0),
|
|
15
|
+
("tue", "b", "交互查询", 90, 2), ("tue", "b", "批量查询", 30, 2),
|
|
16
|
+
]
|
|
17
|
+
summary, detail = [], []
|
|
18
|
+
for day in ["any", "mon", "tue"]:
|
|
19
|
+
for cluster in ["any", "a", "b"]:
|
|
20
|
+
selected = [r for r in raw if (day == "any" or r[0] == day) and (cluster == "any" or r[1] == cluster)]
|
|
21
|
+
total = sum(r[3] for r in selected)
|
|
22
|
+
failures = sum(r[4] for r in selected)
|
|
23
|
+
summary.append({"query_count": total, "failed_count": failures,
|
|
24
|
+
"failure_rate": (Decimal(failures) * 100 / Decimal(total)).quantize(Decimal("0.01"))})
|
|
25
|
+
for category in ["交互查询", "批量查询"]:
|
|
26
|
+
detail.append({"category": category,
|
|
27
|
+
"query_count": sum(r[3] for r in selected if r[2] == category)})
|
|
28
|
+
output_dir = Path("presentation-example")
|
|
29
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
30
|
+
receipts = [asdict(write_dataset(pd.DataFrame(rows), output_dir / filename)) for filename, rows in [
|
|
31
|
+
("interaction-summary.dataset.json", summary), ("interaction-detail.dataset.json", detail),
|
|
32
|
+
]]
|
|
33
|
+
print(json.dumps(receipts, ensure_ascii=False))
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# 可改写的完整示例
|
|
2
|
+
|
|
3
|
+
这些文件都是**演示内容,不是真实业务结果**。先按任务修改,再用普通文件能力写入当前 Workspace;不要在 Skill 安装目录生成分析产物。带 `example-` 的 Session/Artifact 引用仅演示字段位置,使用时替换为当前 Workspace 中实际取得的精确引用。
|
|
4
|
+
|
|
5
|
+
## 已有 Artifact
|
|
6
|
+
|
|
7
|
+
读取 [artifact.draft.json](examples/artifact.draft.json),替换来源引用、列名和范围。草稿直接选择 Artifact 保存数据,不需要先调用 Python helper。示例使用 table,适用于尚未确认数值列是否适合绘图的已有结果。
|
|
8
|
+
|
|
9
|
+
## computed 数据
|
|
10
|
+
|
|
11
|
+
使用 [write-computed.py](examples/write-computed.py) 了解 helper 的完整用法。通过 `marivo_python` 在绑定 Runtime 执行改写后的代码;示例本身只有演示数据,可用 `datasources: []`。代码把文件写入 Workspace 的 `presentation-example/computed.dataset.json`,与 [computed.draft.json](examples/computed.draft.json) 中的路径一致。父目录由 Python 示例创建。已有 computed 文件可直接使用,无需重新计算。
|
|
12
|
+
|
|
13
|
+
文件分析得到的 pandas DataFrame 或原生 DuckDB `.df()` 结果可直接替换示例数据,无需 Marivo datasource 或语义模型。读取指引见 `dsh-data-analysis-files`;草稿正文说明实际文件名、sheet/字段选择及样本或全量范围,`sourceIds` 无 Artifact 时保持空数组,`codeRefs` 关联生成该数据的实际执行引用。
|
|
14
|
+
|
|
15
|
+
[computed.dataset.json](examples/computed.dataset.json) 是该示例的实际 typed JSON 输出,含精确金额、整数和 null;[computed.draft.json](examples/computed.draft.json) 同时展示单值、趋势、分组、原值表格,未声明来源。需要声明多个 Artifact 来源时参考 [computed-sources.draft.json](examples/computed-sources.draft.json),只增加声明与关联,不提交转换信息。无法恢复的声明来源由 present 标记 unavailable,不删除声明来隐藏缺失。
|
|
16
|
+
|
|
17
|
+
将选定草稿写成 `analysis/presentation.draft.json` 后调用:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{"draft_path":"analysis/presentation.draft.json"}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
一个成功的 `marivo_present` 已完成 reader 构建;离线 HTML 在用户下载时生成;根据 receipt 交付,不能把示例数据解释成用户的真实业务结论。
|
|
24
|
+
|
|
25
|
+
## 比较与抵消项
|
|
26
|
+
|
|
27
|
+
[write-comparison.py](examples/write-comparison.py) 使用完整演示数据:baseline `[100, 80, 20]`、current `[50, 50, 50]`。它仅演示已有数据的展示,不是业务分析流程。可用 `datasources: []` 运行;写出路径与[比较草稿](examples/comparison.draft.json)一致。
|
|
28
|
+
|
|
29
|
+
完整[明细](examples/comparison.dataset.json)保留三项原值与 `current - baseline` 的差值 `[-50, -30, +30]`;[Top 2 数据](examples/comparison-selected.dataset.json)按减少量降序预选 A、B,writer 收到两行,因此 `rowCount: 2` 且 `truncated: false`。[汇总](examples/comparison-summary.dataset.json)保留全量、选中项、其他项的两侧原值与净差。
|
|
30
|
+
|
|
31
|
+
草稿的正文、图和表统一变化方向:全量 200 → 150,净变化 -50(以 baseline 总量 200 为分母,-25%);两项减少量 80,其他项增加 30,抵消后净减少 50。80 / 50 = 160% 是选中减少量与全量净减少的比值,不能称为覆盖率。示例只证明数值关系,没有原因或联合关系证据。
|
|
32
|
+
|
|
33
|
+
## 仅展示来源
|
|
34
|
+
|
|
35
|
+
[全部图形样例](chart-examples.md)另提供 18 类图形、bar/line 变体、预计算数据和探索配置。
|
|
36
|
+
|
|
37
|
+
[source-only.draft.json](examples/source-only.draft.json) 的 datasets 为空,直接用 source block。替换精确引用后提交即可;无须生成 computed 文件、图或虚构单值。
|
|
38
|
+
|
|
39
|
+
## 可选全局筛选与动态 KPI
|
|
40
|
+
|
|
41
|
+
既有 computed 示例不声明筛选,可直接作为固定报告。需要交互时,参考[全局筛选契约](interaction.md)与[双筛选草稿](examples/interaction.draft.json)。
|
|
42
|
+
[生成脚本](examples/write-interaction.py)使用合成测试数据,在 Python 中准备日期 × 集群的九个组合,每个维度均含“全部”。
|
|
43
|
+
脚本生成[指标数据](examples/interaction-summary.dataset.json)和[类别数据](examples/interaction-detail.dataset.json),路径与草稿一致。
|
|
44
|
+
完整范围为 550 次查询、15 次失败;周一甲集群为 150 次查询、3 次失败、2.00% 失败率。区域外指标始终为 550,区域内三个 KPI、图表及表格一起切换。
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# 导出完整 HTML
|
|
2
|
+
|
|
3
|
+
用户要求离线 HTML 文件时,调用 `marivo_export_html({"report_id":"实际 Report ID","build_id":"实际 Build ID","output_path":"reports/analysis.html"})`。从成功 receipt 或已读取报告取得身份;基于固定报告上下文时始终传 `build_id`,仅在用户要求当前版本时省略。路径相对于当前 Workspace,必须为新的 `.html` 文件,可自动创建父目录;已有文件不会覆盖,不能写入 `.dsh-data-analysis`。
|
|
4
|
+
|
|
5
|
+
成功后必须使用返回的实际 `path` 调用原生 `present({ files: [{ path, description: "离线 HTML 报告" }] })`,再给出最终回复;不把 JSON 路径当成 HTML,也不以仅提及路径代替文件交付。若当前 Agent 未提供 `present`,如实报告已导出文件和交付能力缺失,不宣称已生成文件卡片。
|
|
6
|
+
|
|
7
|
+
导出复用已保存快照,不访问 Python 或数据源,不更新报告,不包含未保存编辑或临时筛选。需要先修改内容时,先完成报告保存再导出对应 Build。导出不依赖发布配置,也不生成外部 URL;完整报告保留全部已保存筛选组合,不是数据权限隔离副本。
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# 全局筛选与动态指标
|
|
2
|
+
|
|
3
|
+
## 何时启用
|
|
4
|
+
|
|
5
|
+
由 Agent 根据报告问题和数据条件决定;仅有固定结论、单图或不能形成共同筛选范围时省略 `interaction`。reader 不根据 dataset 自动生成筛选,也不推断跨 dataset 的关系。
|
|
6
|
+
|
|
7
|
+
需要启用时,将所有受影响的 metric/chart/table 连续放入 `blocks`。固定正文、固定 KPI 和 source 放在区外;区内只能有共同响应的组件。每个筛选字段固定,读者对每个字段选择一个值或“全部”,多个字段共同决定唯一组合。没有局部数据行筛选入口。
|
|
8
|
+
|
|
9
|
+
## 声明
|
|
10
|
+
|
|
11
|
+
Draft schemaVersion 2、Document schemaVersion 3 均支持以下可选字段:
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
interaction?: {
|
|
15
|
+
title: string
|
|
16
|
+
blockIds: string[]
|
|
17
|
+
filters: {
|
|
18
|
+
id: string
|
|
19
|
+
label: string
|
|
20
|
+
allOptionId: string
|
|
21
|
+
options: { id: string; label: string }[]
|
|
22
|
+
}[]
|
|
23
|
+
slices: {
|
|
24
|
+
selection: Record<string, string>
|
|
25
|
+
datasets: { datasetId: string; rowIndices: number[] }[]
|
|
26
|
+
}[]
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`blockIds` 唯一、按正文顺序排列且连续。一份报告只有一个区域。`filters` 的顺序决定控件顺序;每个字段至少包含“全部”和一个具体选项。`allOptionId` 明确指出“全部”,显示标签使用“全部”;普通业务值或标签 `all` 没有特殊含义。选项 ID 是稳定标识,不是 reader 执行的表达式或字段名。
|
|
31
|
+
|
|
32
|
+
每个 `selection` 为全部 filter ID 到 option ID 的完整映射。每一种可选组合必须恰好有一个 slice,含多个字段均为“全部”及部分字段为“全部”的组合。初始、重置、重新打开、打印和禁用脚本均采用全“全部”组合。
|
|
33
|
+
|
|
34
|
+
`datasets` 必须覆盖区域内全部组件实际使用的数据集,包括 chart 的全部 `preparedViews`。每个 dataset 恰好一个绑定;`rowIndices` 为该 dataset 原始快照的零起始行索引,不是排序后或分页后的索引。可以跨组合复用行,但同一绑定不能重复索引。表格与图表允许 `[]`,表示明确准备的空结果;不能用遗漏 dataset 代替空结果。
|
|
35
|
+
|
|
36
|
+
## 动态 KPI
|
|
37
|
+
|
|
38
|
+
固定 metric 继续使用 `rowIndex`。区域内 metric 改用 `rowSelection: "slice"`,与 `rowIndex` 互斥:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{"id":"count","kind":"metric","datasetId":"summary","columnId":"query_count","rowSelection":"slice","label":"当前查询数"}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
每种组合对该 dataset 必须唯一选择一行;同一行可包含多个 KPI 的不同列。不要将需要多行的 chart/table 和动态 metric 强行绑定到同一个 dataset。无数据指标显式准备 nullable 单元格 `null`,与数值零区分。
|
|
45
|
+
|
|
46
|
+
先在分析阶段按业务口径计算总计、去重、比率、排名、占比与分母,再构造各组合的展示数据。尤其“全部”必须选择预计算的全量结果,不能把汇总行与明细行一起选择,或期待 reader 累加各组选项。
|
|
47
|
+
|
|
48
|
+
既有行数、dataset 数、Draft/Document/HTML 字节预算仍适用。组合过多时减少字段或选项;不扩张预算、不静默截断、不回退到全量值。Draft 检查结构与引用,投影后检查实际行索引与 KPI 唯一性,失败按诊断修正。
|
|
49
|
+
|
|
50
|
+
## 阅读与编辑
|
|
51
|
+
|
|
52
|
+
区域边界清楚区分固定内容;区域内指标、图表、表格、来源数据预览共同切换。复制上下文包含筛选条件、原始行索引和当前指标值,来源 identity 不变。
|
|
53
|
+
|
|
54
|
+
宿主编辑可改现有呈现字段、区域内部顺序和删除组件,不能跨区域移动或编辑筛选声明。删除最后一个交互组件会移除声明,撤销可恢复。当前选择不保存,不进入下载或浏览器存储;保存的声明和全部组合仍包含在离线 HTML 中。
|
|
55
|
+
|
|
56
|
+
参见[双筛选完整示例](examples.md)。示例为合成数据,不能当成真实业务结果。
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# 叙事与证据检查
|
|
2
|
+
|
|
3
|
+
报告、看板及比较型展示在写草稿前读取本页。按用户问题选信息密度,不要求固定章节、图数或 KPI 数量;以下检查用于表达已有分析,不代替 Runtime Skill 的分析与质量契约。
|
|
4
|
+
|
|
5
|
+
## 保持问题与比较范围
|
|
6
|
+
|
|
7
|
+
逐项对应用户的问题与比较范围:每组比较明确两侧的时间或群体、粒度、单位、方向和比例分母。不同基准分别回答,不能用一个成功比较替代另一个;某分支未取得数据时,在正文说明已回答范围、尚缺证据及其影响。
|
|
8
|
+
|
|
9
|
+
以 `current - baseline` 表示变化时,表头、图例和正文统一该方向;若另用 `baseline - current` 表示减少量,明确命名。发布前从原值核对差值、比例、全量合计与余项,核对文字中的大小、方向和量级;占比的分母不能在正文中悄然换成另一个比较或筛选后子集。
|
|
10
|
+
|
|
11
|
+
## 让结论匹配证据
|
|
12
|
+
|
|
13
|
+
区分观测事实、数值贡献分解、解释与待验证假设。分解能说明哪些项贡献了净变化;原因、角色推断及“排除某原因”的结论需要相应证据,未观察到不能直接当成不存在。两个维度各自的边际分布不能证明它们的联合关系;需要交叉证据才能描述组合群体或共同驱动。
|
|
14
|
+
|
|
15
|
+
把实质限制落实到对应结论的范围和措辞,不能只在末尾加免责声明后仍作强断言。证据不足时交付已支持的答案和明确的未决问题,不让展示文案补造缺失分析。
|
|
16
|
+
|
|
17
|
+
## 说明选取与未展示部分
|
|
18
|
+
|
|
19
|
+
Top N、过滤或预聚合必须说明选取规则、排序方向与覆盖范围。Agent 在传给 writer 前选取的子集,与 writer 因预算截断不同;`rowCount` 和 `truncated` 只描述 writer 收到的输入,`truncated: false` 不证明业务数据全量。
|
|
20
|
+
|
|
21
|
+
当结论涉及全量归因,保留可核对的全量基准和未展示项的净贡献,校验“展示项净变化 + 其他项净变化 = 全量净变化”。部分减少项之和可能超过全量净减少,因为其他项抵消;不要将局部和称为总差或把它与全量净差的比值当成覆盖率。可改写的[比较示例](examples.md#比较与抵消项)展示原值、净差、减少量和抵消量的关系。
|
|
22
|
+
|
|
23
|
+
## 报告
|
|
24
|
+
|
|
25
|
+
先给已经得到的主要结论,再放最能支撑它的数据和比较。结论尚未成立时说明现有证据和缺口,不用图形复杂度替代分析。
|
|
26
|
+
|
|
27
|
+
正文使用 markdown,关键单值用 metric,变化或比较用 line/bar,需要核对原值时用 table。各图表、表格和指标的数据源入口提供精确 Artifact 和公开事实,报告末尾默认不再添加独立的数据源段落或 `source` block;用户明确要求独立来源面板时再添加。保留 dataset 的来源声明与关联;只为当前问题读取必要 Finding,不强制遍历整个 SessionGraph。
|
|
28
|
+
|
|
29
|
+
## 看板
|
|
30
|
+
|
|
31
|
+
先列要回答的运营问题,再选已计算的关键指标、趋势或分组比较。对比区间、分母、单位与目标如果未从分析取得,就明确缺失;不要让展示层补造。metric 指向一格已有数据,不自动计算总计、达成率或同比。
|
|
32
|
+
|
|
33
|
+
用 blocks 顺序表达优先级,适配布局由 reader 决定。这是生成时的数据快照;当前范围、生成时间和实质限制应让读者可见。新的范围或刷新需要新分析和一次新的 present。
|
|
34
|
+
|
|
35
|
+
## 交付说明
|
|
36
|
+
|
|
37
|
+
简要回答问题,附 receipt 的打开/下载入口或 headless 精确路径。说明会影响结论的截断、来源 unavailable、近似绘图或未完成验证。present 的结构与来源读取成功不等于统计正确、业务口径正确或 computed 转换已获验证;只报告已取得的证据。
|