@yachaydeep-yd/analytics-contract 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 ADDED
@@ -0,0 +1,12 @@
1
+ # @yachaydeep-yd/analytics-contract
2
+
3
+ El **contrato** del sistema de analítica de la casa: los tipos que el cerebro
4
+ (`yd-analytics`, Python) y la cara (`@yachaydeep-yd/dashboard`, React) comparten. Que
5
+ ambas caras dependan de este paquete es lo que evita que se desincronicen.
6
+
7
+ - `src/index.ts` — tipos TypeScript (espejo de `yd_analytics.schemas`).
8
+ - `schema/*.json` — JSON Schema generado desde los modelos Pydantic
9
+ (`python scripts/gen_schema.py`), para validar en cualquier lenguaje.
10
+
11
+ Versionado con SemVer junto al resto del monorepo. Un cambio incompatible del
12
+ contrato es *major*.
@@ -0,0 +1,115 @@
1
+ type Clase = "uso" | "dominio" | "impacto";
2
+ type Formato = "number" | "money" | "percent" | "impact";
3
+ type Shape = "scalar" | "timeseries" | "category" | "category_wide" | "part_to_whole" | "timeseries_multi" | "distribution" | "correlation" | "matrix" | "funnel" | "table";
4
+ type ChartType = "kpi" | "line" | "area" | "bar" | "bar_h" | "stacked_bar" | "treemap" | "scatter" | "heatmap" | "funnel" | "table" | "graph" | "pie" | "histogram" | "boxplot";
5
+ type FilterOp = "eq" | "in" | "gte" | "lte" | "between";
6
+ interface Measure {
7
+ sql: string;
8
+ }
9
+ interface MetricSpec {
10
+ id: string;
11
+ clase: Clase;
12
+ titulo: string;
13
+ descripcion?: string;
14
+ shape: Shape;
15
+ unidad?: string;
16
+ formato?: Formato;
17
+ fuente: string;
18
+ medida: Measure;
19
+ grano?: string[];
20
+ dim_temporal?: string | null;
21
+ cadencia?: "on-read" | "hourly" | "daily";
22
+ modelo?: Record<string, string> | null;
23
+ roles?: string[];
24
+ /** Para una dimensión cifrada: su columna de índice ciego (blind index). */
25
+ blind_index?: Record<string, string>;
26
+ /** Supresión k-anónima: oculta conteos < k (LOPDP). 0 = desactivado. */
27
+ k_anon?: number;
28
+ version?: string;
29
+ }
30
+ interface Filter {
31
+ field: string;
32
+ op?: FilterOp;
33
+ value: unknown;
34
+ }
35
+ interface MetricQuery {
36
+ metric: string;
37
+ dimensions?: string[];
38
+ grain?: string | null;
39
+ filters?: Filter[];
40
+ params?: Record<string, unknown>;
41
+ limit?: number | null;
42
+ chart_hint?: ChartType | null;
43
+ }
44
+ interface Truncation {
45
+ shown: number;
46
+ total: number;
47
+ grouped_as: string;
48
+ }
49
+ interface MetricResult {
50
+ metric: string;
51
+ shape: Shape;
52
+ unidad: string;
53
+ formato: Formato;
54
+ columns: string[];
55
+ rows: Record<string, unknown>[];
56
+ meta: Record<string, unknown>;
57
+ truncated?: Truncation | null;
58
+ }
59
+ interface Encoding {
60
+ field: string;
61
+ type: "nominal" | "ordinal" | "quantitative" | "temporal";
62
+ format?: Formato;
63
+ }
64
+ interface Interactions {
65
+ emits_filter?: string | null;
66
+ drilldown: string[];
67
+ tooltip: string[];
68
+ }
69
+ interface ChartSpec {
70
+ type: ChartType;
71
+ encoding: Record<string, Encoding>;
72
+ interactions: Interactions;
73
+ series_role: "primary" | "accent" | "neutral";
74
+ note?: string | null;
75
+ }
76
+ interface PanelResponse {
77
+ result: MetricResult;
78
+ chart: ChartSpec;
79
+ }
80
+ interface GraphNode {
81
+ id: string;
82
+ label: string;
83
+ group?: string | null;
84
+ value?: number;
85
+ attrs?: Record<string, unknown>;
86
+ }
87
+ interface GraphEdge {
88
+ source: string;
89
+ target: string;
90
+ weight?: number;
91
+ kind?: string | null;
92
+ }
93
+ interface GraphResult {
94
+ graph: string;
95
+ directed: boolean;
96
+ nodes: GraphNode[];
97
+ edges: GraphEdge[];
98
+ meta?: Record<string, unknown>;
99
+ }
100
+ interface PanelSpec {
101
+ id: string;
102
+ metric: string;
103
+ dimensions?: string[];
104
+ grain?: string | null;
105
+ chartHint?: ChartType | null;
106
+ size?: "sm" | "md" | "lg";
107
+ }
108
+ interface DashboardSpec {
109
+ id: string;
110
+ titulo: string;
111
+ filtrosGlobales: string[];
112
+ paneles: PanelSpec[];
113
+ }
114
+
115
+ export type { ChartSpec, ChartType, Clase, DashboardSpec, Encoding, Filter, FilterOp, Formato, GraphEdge, GraphNode, GraphResult, Interactions, Measure, MetricQuery, MetricResult, MetricSpec, PanelResponse, PanelSpec, Shape, Truncation };
package/dist/index.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@yachaydeep-yd/analytics-contract",
3
+ "version": "0.2.0",
4
+ "description": "Contrato del sistema de analítica de Yachay Deep: tipos TS + JSON Schema.",
5
+ "license": "MIT",
6
+ "author": "Yachay Deep",
7
+ "homepage": "https://analytics.yachaydeep.com",
8
+ "repository": { "type": "git", "url": "git+https://github.com/cvasconezp/yachaydeep-analytics.git", "directory": "packages/contract" },
9
+ "keywords": ["analytics", "contract", "json-schema", "typescript", "yachaydeep"],
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "main": "dist/index.js",
13
+ "module": "dist/index.js",
14
+ "types": "dist/index.d.ts",
15
+ "exports": {
16
+ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
17
+ "./schema/*": "./schema/*"
18
+ },
19
+ "files": ["dist", "schema"],
20
+ "publishConfig": { "access": "public" },
21
+ "scripts": {
22
+ "build": "tsup src/index.ts --format esm --dts --clean",
23
+ "typecheck": "tsc --noEmit",
24
+ "prepublishOnly": "npm run build"
25
+ },
26
+ "devDependencies": {
27
+ "tsup": "^8.0.0",
28
+ "typescript": "^5.5.0"
29
+ }
30
+ }
@@ -0,0 +1,137 @@
1
+ {
2
+ "$defs": {
3
+ "Encoding": {
4
+ "properties": {
5
+ "field": {
6
+ "title": "Field",
7
+ "type": "string"
8
+ },
9
+ "type": {
10
+ "enum": [
11
+ "nominal",
12
+ "ordinal",
13
+ "quantitative",
14
+ "temporal"
15
+ ],
16
+ "title": "Type",
17
+ "type": "string"
18
+ },
19
+ "format": {
20
+ "anyOf": [
21
+ {
22
+ "enum": [
23
+ "number",
24
+ "money",
25
+ "percent",
26
+ "impact"
27
+ ],
28
+ "type": "string"
29
+ },
30
+ {
31
+ "type": "null"
32
+ }
33
+ ],
34
+ "default": null,
35
+ "title": "Format"
36
+ }
37
+ },
38
+ "required": [
39
+ "field",
40
+ "type"
41
+ ],
42
+ "title": "Encoding",
43
+ "type": "object"
44
+ },
45
+ "Interactions": {
46
+ "properties": {
47
+ "emits_filter": {
48
+ "anyOf": [
49
+ {
50
+ "type": "string"
51
+ },
52
+ {
53
+ "type": "null"
54
+ }
55
+ ],
56
+ "default": null,
57
+ "title": "Emits Filter"
58
+ },
59
+ "drilldown": {
60
+ "items": {
61
+ "type": "string"
62
+ },
63
+ "title": "Drilldown",
64
+ "type": "array"
65
+ },
66
+ "tooltip": {
67
+ "items": {
68
+ "type": "string"
69
+ },
70
+ "title": "Tooltip",
71
+ "type": "array"
72
+ }
73
+ },
74
+ "title": "Interactions",
75
+ "type": "object"
76
+ }
77
+ },
78
+ "properties": {
79
+ "type": {
80
+ "enum": [
81
+ "kpi",
82
+ "line",
83
+ "area",
84
+ "bar",
85
+ "bar_h",
86
+ "stacked_bar",
87
+ "treemap",
88
+ "scatter",
89
+ "heatmap",
90
+ "funnel",
91
+ "table",
92
+ "pie",
93
+ "histogram",
94
+ "boxplot"
95
+ ],
96
+ "title": "Type",
97
+ "type": "string"
98
+ },
99
+ "encoding": {
100
+ "additionalProperties": {
101
+ "$ref": "#/$defs/Encoding"
102
+ },
103
+ "title": "Encoding",
104
+ "type": "object"
105
+ },
106
+ "interactions": {
107
+ "$ref": "#/$defs/Interactions"
108
+ },
109
+ "series_role": {
110
+ "default": "primary",
111
+ "enum": [
112
+ "primary",
113
+ "accent",
114
+ "neutral"
115
+ ],
116
+ "title": "Series Role",
117
+ "type": "string"
118
+ },
119
+ "note": {
120
+ "anyOf": [
121
+ {
122
+ "type": "string"
123
+ },
124
+ {
125
+ "type": "null"
126
+ }
127
+ ],
128
+ "default": null,
129
+ "title": "Note"
130
+ }
131
+ },
132
+ "required": [
133
+ "type"
134
+ ],
135
+ "title": "ChartSpec",
136
+ "type": "object"
137
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "properties": {
3
+ "field": {
4
+ "title": "Field",
5
+ "type": "string"
6
+ },
7
+ "op": {
8
+ "default": "eq",
9
+ "enum": [
10
+ "eq",
11
+ "in",
12
+ "gte",
13
+ "lte",
14
+ "between"
15
+ ],
16
+ "title": "Op",
17
+ "type": "string"
18
+ },
19
+ "value": {
20
+ "title": "Value"
21
+ }
22
+ },
23
+ "required": [
24
+ "field",
25
+ "value"
26
+ ],
27
+ "title": "Filter",
28
+ "type": "object"
29
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "properties": {
3
+ "source": {
4
+ "title": "Source",
5
+ "type": "string"
6
+ },
7
+ "target": {
8
+ "title": "Target",
9
+ "type": "string"
10
+ },
11
+ "weight": {
12
+ "default": 1.0,
13
+ "title": "Weight",
14
+ "type": "number"
15
+ },
16
+ "kind": {
17
+ "anyOf": [
18
+ {
19
+ "type": "string"
20
+ },
21
+ {
22
+ "type": "null"
23
+ }
24
+ ],
25
+ "default": null,
26
+ "title": "Kind"
27
+ }
28
+ },
29
+ "required": [
30
+ "source",
31
+ "target"
32
+ ],
33
+ "title": "GraphEdge",
34
+ "type": "object"
35
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "properties": {
3
+ "id": {
4
+ "title": "Id",
5
+ "type": "string"
6
+ },
7
+ "label": {
8
+ "title": "Label",
9
+ "type": "string"
10
+ },
11
+ "group": {
12
+ "anyOf": [
13
+ {
14
+ "type": "string"
15
+ },
16
+ {
17
+ "type": "null"
18
+ }
19
+ ],
20
+ "default": null,
21
+ "title": "Group"
22
+ },
23
+ "value": {
24
+ "default": 1.0,
25
+ "title": "Value",
26
+ "type": "number"
27
+ },
28
+ "attrs": {
29
+ "additionalProperties": true,
30
+ "title": "Attrs",
31
+ "type": "object"
32
+ }
33
+ },
34
+ "required": [
35
+ "id",
36
+ "label"
37
+ ],
38
+ "title": "GraphNode",
39
+ "type": "object"
40
+ }
@@ -0,0 +1,116 @@
1
+ {
2
+ "$defs": {
3
+ "GraphEdge": {
4
+ "properties": {
5
+ "source": {
6
+ "title": "Source",
7
+ "type": "string"
8
+ },
9
+ "target": {
10
+ "title": "Target",
11
+ "type": "string"
12
+ },
13
+ "weight": {
14
+ "default": 1.0,
15
+ "title": "Weight",
16
+ "type": "number"
17
+ },
18
+ "kind": {
19
+ "anyOf": [
20
+ {
21
+ "type": "string"
22
+ },
23
+ {
24
+ "type": "null"
25
+ }
26
+ ],
27
+ "default": null,
28
+ "title": "Kind"
29
+ }
30
+ },
31
+ "required": [
32
+ "source",
33
+ "target"
34
+ ],
35
+ "title": "GraphEdge",
36
+ "type": "object"
37
+ },
38
+ "GraphNode": {
39
+ "properties": {
40
+ "id": {
41
+ "title": "Id",
42
+ "type": "string"
43
+ },
44
+ "label": {
45
+ "title": "Label",
46
+ "type": "string"
47
+ },
48
+ "group": {
49
+ "anyOf": [
50
+ {
51
+ "type": "string"
52
+ },
53
+ {
54
+ "type": "null"
55
+ }
56
+ ],
57
+ "default": null,
58
+ "title": "Group"
59
+ },
60
+ "value": {
61
+ "default": 1.0,
62
+ "title": "Value",
63
+ "type": "number"
64
+ },
65
+ "attrs": {
66
+ "additionalProperties": true,
67
+ "title": "Attrs",
68
+ "type": "object"
69
+ }
70
+ },
71
+ "required": [
72
+ "id",
73
+ "label"
74
+ ],
75
+ "title": "GraphNode",
76
+ "type": "object"
77
+ }
78
+ },
79
+ "properties": {
80
+ "graph": {
81
+ "title": "Graph",
82
+ "type": "string"
83
+ },
84
+ "directed": {
85
+ "default": true,
86
+ "title": "Directed",
87
+ "type": "boolean"
88
+ },
89
+ "nodes": {
90
+ "items": {
91
+ "$ref": "#/$defs/GraphNode"
92
+ },
93
+ "title": "Nodes",
94
+ "type": "array"
95
+ },
96
+ "edges": {
97
+ "items": {
98
+ "$ref": "#/$defs/GraphEdge"
99
+ },
100
+ "title": "Edges",
101
+ "type": "array"
102
+ },
103
+ "meta": {
104
+ "additionalProperties": true,
105
+ "title": "Meta",
106
+ "type": "object"
107
+ }
108
+ },
109
+ "required": [
110
+ "graph",
111
+ "nodes",
112
+ "edges"
113
+ ],
114
+ "title": "GraphResult",
115
+ "type": "object"
116
+ }
@@ -0,0 +1,100 @@
1
+ {
2
+ "description": "Métrica de relación: dos consultas whitelisted (nodos y aristas).",
3
+ "properties": {
4
+ "id": {
5
+ "title": "Id",
6
+ "type": "string"
7
+ },
8
+ "clase": {
9
+ "default": "dominio",
10
+ "enum": [
11
+ "uso",
12
+ "dominio",
13
+ "impacto"
14
+ ],
15
+ "title": "Clase",
16
+ "type": "string"
17
+ },
18
+ "titulo": {
19
+ "title": "Titulo",
20
+ "type": "string"
21
+ },
22
+ "descripcion": {
23
+ "default": "",
24
+ "title": "Descripcion",
25
+ "type": "string"
26
+ },
27
+ "directed": {
28
+ "default": true,
29
+ "title": "Directed",
30
+ "type": "boolean"
31
+ },
32
+ "nodes_from": {
33
+ "title": "Nodes From",
34
+ "type": "string"
35
+ },
36
+ "node_id": {
37
+ "title": "Node Id",
38
+ "type": "string"
39
+ },
40
+ "node_label": {
41
+ "title": "Node Label",
42
+ "type": "string"
43
+ },
44
+ "node_group": {
45
+ "anyOf": [
46
+ {
47
+ "type": "string"
48
+ },
49
+ {
50
+ "type": "null"
51
+ }
52
+ ],
53
+ "default": null,
54
+ "title": "Node Group"
55
+ },
56
+ "edges_from": {
57
+ "title": "Edges From",
58
+ "type": "string"
59
+ },
60
+ "edge_source": {
61
+ "title": "Edge Source",
62
+ "type": "string"
63
+ },
64
+ "edge_target": {
65
+ "title": "Edge Target",
66
+ "type": "string"
67
+ },
68
+ "filterable": {
69
+ "items": {
70
+ "type": "string"
71
+ },
72
+ "title": "Filterable",
73
+ "type": "array"
74
+ },
75
+ "roles": {
76
+ "items": {
77
+ "type": "string"
78
+ },
79
+ "title": "Roles",
80
+ "type": "array"
81
+ },
82
+ "version": {
83
+ "default": "v1",
84
+ "title": "Version",
85
+ "type": "string"
86
+ }
87
+ },
88
+ "required": [
89
+ "id",
90
+ "titulo",
91
+ "nodes_from",
92
+ "node_id",
93
+ "node_label",
94
+ "edges_from",
95
+ "edge_source",
96
+ "edge_target"
97
+ ],
98
+ "title": "GraphSpec",
99
+ "type": "object"
100
+ }
@@ -0,0 +1,115 @@
1
+ {
2
+ "$defs": {
3
+ "Filter": {
4
+ "properties": {
5
+ "field": {
6
+ "title": "Field",
7
+ "type": "string"
8
+ },
9
+ "op": {
10
+ "default": "eq",
11
+ "enum": [
12
+ "eq",
13
+ "in",
14
+ "gte",
15
+ "lte",
16
+ "between"
17
+ ],
18
+ "title": "Op",
19
+ "type": "string"
20
+ },
21
+ "value": {
22
+ "title": "Value"
23
+ }
24
+ },
25
+ "required": [
26
+ "field",
27
+ "value"
28
+ ],
29
+ "title": "Filter",
30
+ "type": "object"
31
+ }
32
+ },
33
+ "properties": {
34
+ "metric": {
35
+ "title": "Metric",
36
+ "type": "string"
37
+ },
38
+ "dimensions": {
39
+ "items": {
40
+ "type": "string"
41
+ },
42
+ "title": "Dimensions",
43
+ "type": "array"
44
+ },
45
+ "grain": {
46
+ "anyOf": [
47
+ {
48
+ "type": "string"
49
+ },
50
+ {
51
+ "type": "null"
52
+ }
53
+ ],
54
+ "default": null,
55
+ "title": "Grain"
56
+ },
57
+ "filters": {
58
+ "items": {
59
+ "$ref": "#/$defs/Filter"
60
+ },
61
+ "title": "Filters",
62
+ "type": "array"
63
+ },
64
+ "params": {
65
+ "additionalProperties": true,
66
+ "title": "Params",
67
+ "type": "object"
68
+ },
69
+ "limit": {
70
+ "anyOf": [
71
+ {
72
+ "type": "integer"
73
+ },
74
+ {
75
+ "type": "null"
76
+ }
77
+ ],
78
+ "default": null,
79
+ "title": "Limit"
80
+ },
81
+ "chart_hint": {
82
+ "anyOf": [
83
+ {
84
+ "enum": [
85
+ "kpi",
86
+ "line",
87
+ "area",
88
+ "bar",
89
+ "bar_h",
90
+ "stacked_bar",
91
+ "treemap",
92
+ "scatter",
93
+ "heatmap",
94
+ "funnel",
95
+ "table",
96
+ "pie",
97
+ "histogram",
98
+ "boxplot"
99
+ ],
100
+ "type": "string"
101
+ },
102
+ {
103
+ "type": "null"
104
+ }
105
+ ],
106
+ "default": null,
107
+ "title": "Chart Hint"
108
+ }
109
+ },
110
+ "required": [
111
+ "metric"
112
+ ],
113
+ "title": "MetricQuery",
114
+ "type": "object"
115
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "$defs": {
3
+ "Truncation": {
4
+ "properties": {
5
+ "shown": {
6
+ "title": "Shown",
7
+ "type": "integer"
8
+ },
9
+ "total": {
10
+ "title": "Total",
11
+ "type": "integer"
12
+ },
13
+ "grouped_as": {
14
+ "default": "Otros",
15
+ "title": "Grouped As",
16
+ "type": "string"
17
+ }
18
+ },
19
+ "required": [
20
+ "shown",
21
+ "total"
22
+ ],
23
+ "title": "Truncation",
24
+ "type": "object"
25
+ }
26
+ },
27
+ "properties": {
28
+ "metric": {
29
+ "title": "Metric",
30
+ "type": "string"
31
+ },
32
+ "shape": {
33
+ "enum": [
34
+ "scalar",
35
+ "timeseries",
36
+ "category",
37
+ "category_wide",
38
+ "part_to_whole",
39
+ "timeseries_multi",
40
+ "distribution",
41
+ "correlation",
42
+ "matrix",
43
+ "funnel",
44
+ "table"
45
+ ],
46
+ "title": "Shape",
47
+ "type": "string"
48
+ },
49
+ "unidad": {
50
+ "title": "Unidad",
51
+ "type": "string"
52
+ },
53
+ "formato": {
54
+ "enum": [
55
+ "number",
56
+ "money",
57
+ "percent",
58
+ "impact"
59
+ ],
60
+ "title": "Formato",
61
+ "type": "string"
62
+ },
63
+ "columns": {
64
+ "items": {
65
+ "type": "string"
66
+ },
67
+ "title": "Columns",
68
+ "type": "array"
69
+ },
70
+ "rows": {
71
+ "items": {
72
+ "additionalProperties": true,
73
+ "type": "object"
74
+ },
75
+ "title": "Rows",
76
+ "type": "array"
77
+ },
78
+ "meta": {
79
+ "additionalProperties": true,
80
+ "title": "Meta",
81
+ "type": "object"
82
+ },
83
+ "truncated": {
84
+ "anyOf": [
85
+ {
86
+ "$ref": "#/$defs/Truncation"
87
+ },
88
+ {
89
+ "type": "null"
90
+ }
91
+ ],
92
+ "default": null
93
+ }
94
+ },
95
+ "required": [
96
+ "metric",
97
+ "shape",
98
+ "unidad",
99
+ "formato",
100
+ "columns",
101
+ "rows"
102
+ ],
103
+ "title": "MetricResult",
104
+ "type": "object"
105
+ }
@@ -0,0 +1,165 @@
1
+ {
2
+ "$defs": {
3
+ "Measure": {
4
+ "description": "Expresión SQL de agregación. Es la ÚNICA parte con SQL libre; se define\nen el registro de casa, nunca llega desde el cliente.",
5
+ "properties": {
6
+ "sql": {
7
+ "title": "Sql",
8
+ "type": "string"
9
+ }
10
+ },
11
+ "required": [
12
+ "sql"
13
+ ],
14
+ "title": "Measure",
15
+ "type": "object"
16
+ }
17
+ },
18
+ "properties": {
19
+ "id": {
20
+ "title": "Id",
21
+ "type": "string"
22
+ },
23
+ "clase": {
24
+ "enum": [
25
+ "uso",
26
+ "dominio",
27
+ "impacto"
28
+ ],
29
+ "title": "Clase",
30
+ "type": "string"
31
+ },
32
+ "titulo": {
33
+ "title": "Titulo",
34
+ "type": "string"
35
+ },
36
+ "descripcion": {
37
+ "default": "",
38
+ "title": "Descripcion",
39
+ "type": "string"
40
+ },
41
+ "shape": {
42
+ "enum": [
43
+ "scalar",
44
+ "timeseries",
45
+ "category",
46
+ "category_wide",
47
+ "part_to_whole",
48
+ "timeseries_multi",
49
+ "distribution",
50
+ "correlation",
51
+ "matrix",
52
+ "funnel",
53
+ "table"
54
+ ],
55
+ "title": "Shape",
56
+ "type": "string"
57
+ },
58
+ "unidad": {
59
+ "default": "conteo",
60
+ "title": "Unidad",
61
+ "type": "string"
62
+ },
63
+ "formato": {
64
+ "default": "number",
65
+ "enum": [
66
+ "number",
67
+ "money",
68
+ "percent",
69
+ "impact"
70
+ ],
71
+ "title": "Formato",
72
+ "type": "string"
73
+ },
74
+ "fuente": {
75
+ "title": "Fuente",
76
+ "type": "string"
77
+ },
78
+ "medida": {
79
+ "$ref": "#/$defs/Measure"
80
+ },
81
+ "grano": {
82
+ "items": {
83
+ "type": "string"
84
+ },
85
+ "title": "Grano",
86
+ "type": "array"
87
+ },
88
+ "dim_temporal": {
89
+ "anyOf": [
90
+ {
91
+ "type": "string"
92
+ },
93
+ {
94
+ "type": "null"
95
+ }
96
+ ],
97
+ "default": null,
98
+ "title": "Dim Temporal"
99
+ },
100
+ "cadencia": {
101
+ "default": "on-read",
102
+ "enum": [
103
+ "on-read",
104
+ "hourly",
105
+ "daily"
106
+ ],
107
+ "title": "Cadencia",
108
+ "type": "string"
109
+ },
110
+ "modelo": {
111
+ "anyOf": [
112
+ {
113
+ "additionalProperties": {
114
+ "type": "string"
115
+ },
116
+ "type": "object"
117
+ },
118
+ {
119
+ "type": "null"
120
+ }
121
+ ],
122
+ "default": null,
123
+ "title": "Modelo"
124
+ },
125
+ "param_defaults": {
126
+ "additionalProperties": true,
127
+ "title": "Param Defaults",
128
+ "type": "object"
129
+ },
130
+ "roles": {
131
+ "items": {
132
+ "type": "string"
133
+ },
134
+ "title": "Roles",
135
+ "type": "array"
136
+ },
137
+ "blind_index": {
138
+ "additionalProperties": {
139
+ "type": "string"
140
+ },
141
+ "title": "Blind Index",
142
+ "type": "object"
143
+ },
144
+ "k_anon": {
145
+ "default": 0,
146
+ "title": "K Anon",
147
+ "type": "integer"
148
+ },
149
+ "version": {
150
+ "default": "v1",
151
+ "title": "Version",
152
+ "type": "string"
153
+ }
154
+ },
155
+ "required": [
156
+ "id",
157
+ "clase",
158
+ "titulo",
159
+ "shape",
160
+ "fuente",
161
+ "medida"
162
+ ],
163
+ "title": "MetricSpec",
164
+ "type": "object"
165
+ }
@@ -0,0 +1,256 @@
1
+ {
2
+ "$defs": {
3
+ "ChartSpec": {
4
+ "properties": {
5
+ "type": {
6
+ "enum": [
7
+ "kpi",
8
+ "line",
9
+ "area",
10
+ "bar",
11
+ "bar_h",
12
+ "stacked_bar",
13
+ "treemap",
14
+ "scatter",
15
+ "heatmap",
16
+ "funnel",
17
+ "table",
18
+ "pie",
19
+ "histogram",
20
+ "boxplot"
21
+ ],
22
+ "title": "Type",
23
+ "type": "string"
24
+ },
25
+ "encoding": {
26
+ "additionalProperties": {
27
+ "$ref": "#/$defs/Encoding"
28
+ },
29
+ "title": "Encoding",
30
+ "type": "object"
31
+ },
32
+ "interactions": {
33
+ "$ref": "#/$defs/Interactions"
34
+ },
35
+ "series_role": {
36
+ "default": "primary",
37
+ "enum": [
38
+ "primary",
39
+ "accent",
40
+ "neutral"
41
+ ],
42
+ "title": "Series Role",
43
+ "type": "string"
44
+ },
45
+ "note": {
46
+ "anyOf": [
47
+ {
48
+ "type": "string"
49
+ },
50
+ {
51
+ "type": "null"
52
+ }
53
+ ],
54
+ "default": null,
55
+ "title": "Note"
56
+ }
57
+ },
58
+ "required": [
59
+ "type"
60
+ ],
61
+ "title": "ChartSpec",
62
+ "type": "object"
63
+ },
64
+ "Encoding": {
65
+ "properties": {
66
+ "field": {
67
+ "title": "Field",
68
+ "type": "string"
69
+ },
70
+ "type": {
71
+ "enum": [
72
+ "nominal",
73
+ "ordinal",
74
+ "quantitative",
75
+ "temporal"
76
+ ],
77
+ "title": "Type",
78
+ "type": "string"
79
+ },
80
+ "format": {
81
+ "anyOf": [
82
+ {
83
+ "enum": [
84
+ "number",
85
+ "money",
86
+ "percent",
87
+ "impact"
88
+ ],
89
+ "type": "string"
90
+ },
91
+ {
92
+ "type": "null"
93
+ }
94
+ ],
95
+ "default": null,
96
+ "title": "Format"
97
+ }
98
+ },
99
+ "required": [
100
+ "field",
101
+ "type"
102
+ ],
103
+ "title": "Encoding",
104
+ "type": "object"
105
+ },
106
+ "Interactions": {
107
+ "properties": {
108
+ "emits_filter": {
109
+ "anyOf": [
110
+ {
111
+ "type": "string"
112
+ },
113
+ {
114
+ "type": "null"
115
+ }
116
+ ],
117
+ "default": null,
118
+ "title": "Emits Filter"
119
+ },
120
+ "drilldown": {
121
+ "items": {
122
+ "type": "string"
123
+ },
124
+ "title": "Drilldown",
125
+ "type": "array"
126
+ },
127
+ "tooltip": {
128
+ "items": {
129
+ "type": "string"
130
+ },
131
+ "title": "Tooltip",
132
+ "type": "array"
133
+ }
134
+ },
135
+ "title": "Interactions",
136
+ "type": "object"
137
+ },
138
+ "MetricResult": {
139
+ "properties": {
140
+ "metric": {
141
+ "title": "Metric",
142
+ "type": "string"
143
+ },
144
+ "shape": {
145
+ "enum": [
146
+ "scalar",
147
+ "timeseries",
148
+ "category",
149
+ "category_wide",
150
+ "part_to_whole",
151
+ "timeseries_multi",
152
+ "distribution",
153
+ "correlation",
154
+ "matrix",
155
+ "funnel",
156
+ "table"
157
+ ],
158
+ "title": "Shape",
159
+ "type": "string"
160
+ },
161
+ "unidad": {
162
+ "title": "Unidad",
163
+ "type": "string"
164
+ },
165
+ "formato": {
166
+ "enum": [
167
+ "number",
168
+ "money",
169
+ "percent",
170
+ "impact"
171
+ ],
172
+ "title": "Formato",
173
+ "type": "string"
174
+ },
175
+ "columns": {
176
+ "items": {
177
+ "type": "string"
178
+ },
179
+ "title": "Columns",
180
+ "type": "array"
181
+ },
182
+ "rows": {
183
+ "items": {
184
+ "additionalProperties": true,
185
+ "type": "object"
186
+ },
187
+ "title": "Rows",
188
+ "type": "array"
189
+ },
190
+ "meta": {
191
+ "additionalProperties": true,
192
+ "title": "Meta",
193
+ "type": "object"
194
+ },
195
+ "truncated": {
196
+ "anyOf": [
197
+ {
198
+ "$ref": "#/$defs/Truncation"
199
+ },
200
+ {
201
+ "type": "null"
202
+ }
203
+ ],
204
+ "default": null
205
+ }
206
+ },
207
+ "required": [
208
+ "metric",
209
+ "shape",
210
+ "unidad",
211
+ "formato",
212
+ "columns",
213
+ "rows"
214
+ ],
215
+ "title": "MetricResult",
216
+ "type": "object"
217
+ },
218
+ "Truncation": {
219
+ "properties": {
220
+ "shown": {
221
+ "title": "Shown",
222
+ "type": "integer"
223
+ },
224
+ "total": {
225
+ "title": "Total",
226
+ "type": "integer"
227
+ },
228
+ "grouped_as": {
229
+ "default": "Otros",
230
+ "title": "Grouped As",
231
+ "type": "string"
232
+ }
233
+ },
234
+ "required": [
235
+ "shown",
236
+ "total"
237
+ ],
238
+ "title": "Truncation",
239
+ "type": "object"
240
+ }
241
+ },
242
+ "properties": {
243
+ "result": {
244
+ "$ref": "#/$defs/MetricResult"
245
+ },
246
+ "chart": {
247
+ "$ref": "#/$defs/ChartSpec"
248
+ }
249
+ },
250
+ "required": [
251
+ "result",
252
+ "chart"
253
+ ],
254
+ "title": "PanelResponse",
255
+ "type": "object"
256
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "MetricSpec": "schema/MetricSpec.schema.json",
3
+ "MetricQuery": "schema/MetricQuery.schema.json",
4
+ "MetricResult": "schema/MetricResult.schema.json",
5
+ "ChartSpec": "schema/ChartSpec.schema.json",
6
+ "PanelResponse": "schema/PanelResponse.schema.json",
7
+ "Filter": "schema/Filter.schema.json",
8
+ "GraphSpec": "schema/GraphSpec.schema.json",
9
+ "GraphNode": "schema/GraphNode.schema.json",
10
+ "GraphEdge": "schema/GraphEdge.schema.json",
11
+ "GraphResult": "schema/GraphResult.schema.json"
12
+ }