@hpcc-js/ddl-shim 3.3.1 → 3.3.4
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/LICENSE +43 -43
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +3 -3
- package/src/__package__.ts +3 -3
- package/src/cli.ts +60 -60
- package/src/ddl/v0_0_22.ts +344 -344
- package/src/ddl/v1.ts +313 -313
- package/src/ddl/v2.ts +426 -426
- package/src/ddl/v2_0_23.ts +395 -395
- package/src/ddl/v2_1_0.ts +406 -406
- package/src/dermatology.ts +229 -229
- package/src/index.ts +11 -11
- package/src/upgrade.ts +734 -734
- package/src/validate.ts +38 -38
package/src/ddl/v1.ts
CHANGED
|
@@ -1,313 +1,313 @@
|
|
|
1
|
-
export type StringStringDict = { [key: string]: string; };
|
|
2
|
-
|
|
3
|
-
// Datasource ===============================================================
|
|
4
|
-
export type IFilterRule = "==" | "!=" | "<" | "<=" | ">" | ">=" | "set" | "notequals";
|
|
5
|
-
export interface IFilter {
|
|
6
|
-
fieldid: string;
|
|
7
|
-
nullable: boolean;
|
|
8
|
-
rule: IFilterRule;
|
|
9
|
-
minid?: string;
|
|
10
|
-
maxid?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface IOutput {
|
|
14
|
-
id: string;
|
|
15
|
-
from?: string;
|
|
16
|
-
filter?: IFilter[];
|
|
17
|
-
notify?: string[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface IDatasource {
|
|
21
|
-
id: string;
|
|
22
|
-
filter?: IFilter[];
|
|
23
|
-
outputs: IOutput[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface IWorkunitDatasource extends IDatasource {
|
|
27
|
-
WUID: boolean;
|
|
28
|
-
}
|
|
29
|
-
export function isWorkunitDatasource(ref: IAnyDatasource): ref is IWorkunitDatasource {
|
|
30
|
-
return (ref as IWorkunitDatasource).WUID !== undefined;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface IDatabombDatasource extends IDatasource {
|
|
34
|
-
databomb: true;
|
|
35
|
-
}
|
|
36
|
-
export function isDatabombDatasource(ref: IAnyDatasource): ref is IDatabombDatasource {
|
|
37
|
-
return (ref as IDatabombDatasource).databomb === true;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface IHipieDatasource extends IDatasource {
|
|
41
|
-
URL: string;
|
|
42
|
-
}
|
|
43
|
-
export function isHipieDatasource(ref: IAnyDatasource): ref is IHipieDatasource {
|
|
44
|
-
return (ref as IHipieDatasource).URL !== undefined;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type IAnyDatasource = IWorkunitDatasource | IDatabombDatasource | IHipieDatasource;
|
|
48
|
-
// Event ====================================================================
|
|
49
|
-
export interface IEventUpdate {
|
|
50
|
-
visualization: string;
|
|
51
|
-
instance?: string;
|
|
52
|
-
datasource: string;
|
|
53
|
-
col?: string;
|
|
54
|
-
merge: boolean;
|
|
55
|
-
mappings?: StringStringDict;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface IEvent {
|
|
59
|
-
mappings?: StringStringDict; // Legacy
|
|
60
|
-
updates: IEventUpdate[];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Mappings =================================================================
|
|
64
|
-
export interface IPieMapping {
|
|
65
|
-
label: string;
|
|
66
|
-
weight: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface ILineMapping {
|
|
70
|
-
x: string[];
|
|
71
|
-
y: string[];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface ITableMapping {
|
|
75
|
-
value: string[];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface IChoroMapping {
|
|
79
|
-
weight: string | string[];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface IChoroUSStateMapping extends IChoroMapping {
|
|
83
|
-
state: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface IChoroUSCountyMapping extends IChoroMapping {
|
|
87
|
-
county: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface IChoroGeohashMapping extends IChoroMapping {
|
|
91
|
-
geohash: string;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface IGraphMapping {
|
|
95
|
-
uid: string;
|
|
96
|
-
label: string;
|
|
97
|
-
weight: string;
|
|
98
|
-
flags: string;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface IGraphLinkMapping {
|
|
102
|
-
uid: string;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface IHeatMapMapping {
|
|
106
|
-
x: string;
|
|
107
|
-
y: string;
|
|
108
|
-
weight: string;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface ISliderMapping {
|
|
112
|
-
label: string;
|
|
113
|
-
}
|
|
114
|
-
// Source ===================================================================
|
|
115
|
-
export interface ISource {
|
|
116
|
-
id: string;
|
|
117
|
-
output: string;
|
|
118
|
-
sort?: string[];
|
|
119
|
-
first?: string | number;
|
|
120
|
-
reverse?: boolean;
|
|
121
|
-
properties?: StringStringDict; // TODO Needed?
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export interface IPieSource extends ISource {
|
|
125
|
-
mappings: IPieMapping;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface ILineSource extends ISource {
|
|
129
|
-
mappings: ILineMapping;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface ITableSource extends ISource {
|
|
133
|
-
mappings: ITableMapping;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export interface IGraphLink {
|
|
137
|
-
mappings: IGraphLinkMapping;
|
|
138
|
-
childfile: string;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface IGraphSource extends ISource {
|
|
142
|
-
mappings: IGraphMapping;
|
|
143
|
-
link: IGraphLink;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export interface IHeatMapSource extends ISource {
|
|
147
|
-
mappings: IHeatMapMapping;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export interface IChoroSource extends ISource {
|
|
151
|
-
mappings: IAnyChoroMapping;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export interface ISliderSource extends ISource {
|
|
155
|
-
mappings: ISliderMapping;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// Visualization ============================================================
|
|
159
|
-
export type VisualizationType = "PIE" | "LINE" | "BAR" | "TABLE" | "CHORO" | "GRAPH" | "HEAT_MAP" | "SLIDER" | "SUMMARY" | "FORM" | "2DCHART" | "WORD_CLOUD" | "BUBBLE";
|
|
160
|
-
export type VisualizationFieldDataType = "bool" | "boolean" | "integer" | "integer4" | "integer8" | "unsigned" | "unsigned4" | "unsigned8" | "float" | "double" | "real" | "real4" | "real8" | "string" | "date" | "time" | "geohash" | "dataset" | "visualization";
|
|
161
|
-
export type VisualizationFieldType = VisualizationFieldDataType | "range";
|
|
162
|
-
export type VisualizationFieldFuncitonType = "SUM" | "AVE" | "MIN" | "MAX" | "SCALE";
|
|
163
|
-
|
|
164
|
-
export interface IVisualizationField {
|
|
165
|
-
id: string;
|
|
166
|
-
properties: {
|
|
167
|
-
label?: string;
|
|
168
|
-
datatype: VisualizationFieldDataType;
|
|
169
|
-
default?: any[];
|
|
170
|
-
function?: VisualizationFieldFuncitonType;
|
|
171
|
-
params?: {
|
|
172
|
-
param1: string;
|
|
173
|
-
param2: string;
|
|
174
|
-
}
|
|
175
|
-
type: VisualizationFieldType;
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export interface IVisualization {
|
|
180
|
-
id: string;
|
|
181
|
-
title?: string;
|
|
182
|
-
type: VisualizationType;
|
|
183
|
-
fields?: IVisualizationField[];
|
|
184
|
-
properties?: {
|
|
185
|
-
charttype?: string,
|
|
186
|
-
|
|
187
|
-
// TODO Split Known Properties ---
|
|
188
|
-
[key: string]: any
|
|
189
|
-
};
|
|
190
|
-
events?: { [key: string]: IEvent };
|
|
191
|
-
onSelect?: any; // legacy
|
|
192
|
-
color?: any; // legacy
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export interface IPieVisualization extends IVisualization {
|
|
196
|
-
type: "PIE" | "BAR";
|
|
197
|
-
source: IPieSource;
|
|
198
|
-
}
|
|
199
|
-
export function isPieVisualization(viz: IAnyVisualization): viz is IPieVisualization {
|
|
200
|
-
return (viz as IPieVisualization).type === "PIE" || (viz as IPieVisualization).type === "BAR";
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface ILineVisualization extends IVisualization {
|
|
204
|
-
type: "LINE";
|
|
205
|
-
source: ILineSource;
|
|
206
|
-
}
|
|
207
|
-
export function isLineVisualization(viz: IAnyVisualization): viz is ILineVisualization {
|
|
208
|
-
return (viz as ILineVisualization).type === "LINE";
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export type ChoroColor = "default" | "YlGn" | "YlGnBu" | "GnBu" | "BuGn" | "PuBuGn" | "PuBu" | "BuPu" | "RdPu" | "PuRd" | "OrRd" | "YlOrRd" | "YlOrBr" | "Purples" | "Blues" | "Greens" | "Oranges" | "Reds" | "Greys" | "PuOr" | "BrBG" | "PRGn" | "PiYG" | "RdBu" | "RdGy" | "RdYlBu" | "Spectral" | "RdYlGn" | "RdWhGr";
|
|
212
|
-
export interface IChoroVisualization extends IVisualization {
|
|
213
|
-
type: "CHORO";
|
|
214
|
-
source: IChoroSource;
|
|
215
|
-
|
|
216
|
-
visualizations?: IChoroVisualization[];
|
|
217
|
-
color?: ChoroColor;
|
|
218
|
-
}
|
|
219
|
-
export function isChoroVisualization(viz: IAnyVisualization): viz is IChoroVisualization {
|
|
220
|
-
return (viz as IChoroVisualization).type === "CHORO";
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export interface ITableVisualization extends IVisualization {
|
|
224
|
-
type: "TABLE";
|
|
225
|
-
label: string[];
|
|
226
|
-
source: ITableSource;
|
|
227
|
-
}
|
|
228
|
-
export function isTableVisualization(viz: IAnyVisualization): viz is ITableVisualization {
|
|
229
|
-
return (viz as ITableVisualization).type === "TABLE";
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export interface ISliderVisualization extends IVisualization {
|
|
233
|
-
type: "SLIDER";
|
|
234
|
-
source: ISliderSource;
|
|
235
|
-
range?: number[];
|
|
236
|
-
}
|
|
237
|
-
export function isSliderVisualization(viz: IAnyVisualization): viz is ISliderVisualization {
|
|
238
|
-
return (viz as ISliderVisualization).type === "SLIDER";
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export interface IIcon {
|
|
242
|
-
[id: string]: string | number | boolean;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
export type IValueMappings = { [key: string]: IIcon; };
|
|
246
|
-
|
|
247
|
-
export interface IVisualizationIcon {
|
|
248
|
-
fieldid?: string;
|
|
249
|
-
faChar?: string;
|
|
250
|
-
valuemappings?: IValueMappings;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export interface IGraphVisualization extends IVisualization {
|
|
254
|
-
type: "GRAPH";
|
|
255
|
-
source: IGraphSource;
|
|
256
|
-
|
|
257
|
-
label: string[];
|
|
258
|
-
icon: IVisualizationIcon;
|
|
259
|
-
flag: IVisualizationIcon[];
|
|
260
|
-
}
|
|
261
|
-
export function isGraphVisualization(viz: IAnyVisualization): viz is IGraphVisualization {
|
|
262
|
-
return (viz as IGraphVisualization).type === "GRAPH";
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export interface IHeatMapVisualization extends IVisualization {
|
|
266
|
-
type: "HEAT_MAP";
|
|
267
|
-
source: IHeatMapSource;
|
|
268
|
-
}
|
|
269
|
-
export function isHeatMapVisualization(viz: IAnyVisualization): viz is IHeatMapVisualization {
|
|
270
|
-
return (viz as IHeatMapVisualization).type === "HEAT_MAP";
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export interface IFormVisualization extends IVisualization {
|
|
274
|
-
type: "FORM";
|
|
275
|
-
}
|
|
276
|
-
export function isFormVisualization(viz: IAnyVisualization): viz is IFormVisualization {
|
|
277
|
-
return (viz as IFormVisualization).type === "FORM";
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
// Dashboard ================================================================
|
|
281
|
-
export interface IDashboard {
|
|
282
|
-
id?: string;
|
|
283
|
-
title?: string;
|
|
284
|
-
enable?: string;
|
|
285
|
-
label?: string;
|
|
286
|
-
primary?: boolean;
|
|
287
|
-
visualizations: IAnyVisualization[];
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
export interface IDDL {
|
|
291
|
-
dashboards: IDashboard[];
|
|
292
|
-
datasources: IAnyDatasource[];
|
|
293
|
-
hipieversion: string;
|
|
294
|
-
visualizationversion: string;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// DDL ======================================================================
|
|
298
|
-
export type DDLSchema = IDDL;
|
|
299
|
-
|
|
300
|
-
// Helpers ==================================================================
|
|
301
|
-
export type IAnyChoroMapping = IChoroUSStateMapping | IChoroUSCountyMapping | IChoroGeohashMapping;
|
|
302
|
-
export function isUSStateMapping(mappings: IAnyChoroMapping) {
|
|
303
|
-
return (mappings as IChoroUSStateMapping).state !== undefined;
|
|
304
|
-
}
|
|
305
|
-
export function isUSCountyMapping(mappings: IAnyChoroMapping) {
|
|
306
|
-
return (mappings as IChoroUSCountyMapping).county !== undefined;
|
|
307
|
-
}
|
|
308
|
-
export function isGeohashMapping(mappings: IAnyChoroMapping) {
|
|
309
|
-
return (mappings as IChoroGeohashMapping).geohash !== undefined;
|
|
310
|
-
}
|
|
311
|
-
export type IAnyMapping = IPieMapping | ILineMapping | IGraphMapping | IAnyChoroMapping | ITableMapping | IHeatMapMapping;
|
|
312
|
-
export type IAnySource = IPieSource | ILineSource | ITableSource | IChoroSource | IGraphSource | IHeatMapSource;
|
|
313
|
-
export type IAnyVisualization = IPieVisualization | ILineVisualization | ITableVisualization | IChoroVisualization | IGraphVisualization | IHeatMapVisualization | ISliderVisualization | IFormVisualization;
|
|
1
|
+
export type StringStringDict = { [key: string]: string; };
|
|
2
|
+
|
|
3
|
+
// Datasource ===============================================================
|
|
4
|
+
export type IFilterRule = "==" | "!=" | "<" | "<=" | ">" | ">=" | "set" | "notequals";
|
|
5
|
+
export interface IFilter {
|
|
6
|
+
fieldid: string;
|
|
7
|
+
nullable: boolean;
|
|
8
|
+
rule: IFilterRule;
|
|
9
|
+
minid?: string;
|
|
10
|
+
maxid?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IOutput {
|
|
14
|
+
id: string;
|
|
15
|
+
from?: string;
|
|
16
|
+
filter?: IFilter[];
|
|
17
|
+
notify?: string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IDatasource {
|
|
21
|
+
id: string;
|
|
22
|
+
filter?: IFilter[];
|
|
23
|
+
outputs: IOutput[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface IWorkunitDatasource extends IDatasource {
|
|
27
|
+
WUID: boolean;
|
|
28
|
+
}
|
|
29
|
+
export function isWorkunitDatasource(ref: IAnyDatasource): ref is IWorkunitDatasource {
|
|
30
|
+
return (ref as IWorkunitDatasource).WUID !== undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface IDatabombDatasource extends IDatasource {
|
|
34
|
+
databomb: true;
|
|
35
|
+
}
|
|
36
|
+
export function isDatabombDatasource(ref: IAnyDatasource): ref is IDatabombDatasource {
|
|
37
|
+
return (ref as IDatabombDatasource).databomb === true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface IHipieDatasource extends IDatasource {
|
|
41
|
+
URL: string;
|
|
42
|
+
}
|
|
43
|
+
export function isHipieDatasource(ref: IAnyDatasource): ref is IHipieDatasource {
|
|
44
|
+
return (ref as IHipieDatasource).URL !== undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type IAnyDatasource = IWorkunitDatasource | IDatabombDatasource | IHipieDatasource;
|
|
48
|
+
// Event ====================================================================
|
|
49
|
+
export interface IEventUpdate {
|
|
50
|
+
visualization: string;
|
|
51
|
+
instance?: string;
|
|
52
|
+
datasource: string;
|
|
53
|
+
col?: string;
|
|
54
|
+
merge: boolean;
|
|
55
|
+
mappings?: StringStringDict;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface IEvent {
|
|
59
|
+
mappings?: StringStringDict; // Legacy
|
|
60
|
+
updates: IEventUpdate[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Mappings =================================================================
|
|
64
|
+
export interface IPieMapping {
|
|
65
|
+
label: string;
|
|
66
|
+
weight: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface ILineMapping {
|
|
70
|
+
x: string[];
|
|
71
|
+
y: string[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface ITableMapping {
|
|
75
|
+
value: string[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface IChoroMapping {
|
|
79
|
+
weight: string | string[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface IChoroUSStateMapping extends IChoroMapping {
|
|
83
|
+
state: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface IChoroUSCountyMapping extends IChoroMapping {
|
|
87
|
+
county: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface IChoroGeohashMapping extends IChoroMapping {
|
|
91
|
+
geohash: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface IGraphMapping {
|
|
95
|
+
uid: string;
|
|
96
|
+
label: string;
|
|
97
|
+
weight: string;
|
|
98
|
+
flags: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface IGraphLinkMapping {
|
|
102
|
+
uid: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface IHeatMapMapping {
|
|
106
|
+
x: string;
|
|
107
|
+
y: string;
|
|
108
|
+
weight: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface ISliderMapping {
|
|
112
|
+
label: string;
|
|
113
|
+
}
|
|
114
|
+
// Source ===================================================================
|
|
115
|
+
export interface ISource {
|
|
116
|
+
id: string;
|
|
117
|
+
output: string;
|
|
118
|
+
sort?: string[];
|
|
119
|
+
first?: string | number;
|
|
120
|
+
reverse?: boolean;
|
|
121
|
+
properties?: StringStringDict; // TODO Needed?
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface IPieSource extends ISource {
|
|
125
|
+
mappings: IPieMapping;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface ILineSource extends ISource {
|
|
129
|
+
mappings: ILineMapping;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface ITableSource extends ISource {
|
|
133
|
+
mappings: ITableMapping;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface IGraphLink {
|
|
137
|
+
mappings: IGraphLinkMapping;
|
|
138
|
+
childfile: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface IGraphSource extends ISource {
|
|
142
|
+
mappings: IGraphMapping;
|
|
143
|
+
link: IGraphLink;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface IHeatMapSource extends ISource {
|
|
147
|
+
mappings: IHeatMapMapping;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface IChoroSource extends ISource {
|
|
151
|
+
mappings: IAnyChoroMapping;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface ISliderSource extends ISource {
|
|
155
|
+
mappings: ISliderMapping;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Visualization ============================================================
|
|
159
|
+
export type VisualizationType = "PIE" | "LINE" | "BAR" | "TABLE" | "CHORO" | "GRAPH" | "HEAT_MAP" | "SLIDER" | "SUMMARY" | "FORM" | "2DCHART" | "WORD_CLOUD" | "BUBBLE";
|
|
160
|
+
export type VisualizationFieldDataType = "bool" | "boolean" | "integer" | "integer4" | "integer8" | "unsigned" | "unsigned4" | "unsigned8" | "float" | "double" | "real" | "real4" | "real8" | "string" | "date" | "time" | "geohash" | "dataset" | "visualization";
|
|
161
|
+
export type VisualizationFieldType = VisualizationFieldDataType | "range";
|
|
162
|
+
export type VisualizationFieldFuncitonType = "SUM" | "AVE" | "MIN" | "MAX" | "SCALE";
|
|
163
|
+
|
|
164
|
+
export interface IVisualizationField {
|
|
165
|
+
id: string;
|
|
166
|
+
properties: {
|
|
167
|
+
label?: string;
|
|
168
|
+
datatype: VisualizationFieldDataType;
|
|
169
|
+
default?: any[];
|
|
170
|
+
function?: VisualizationFieldFuncitonType;
|
|
171
|
+
params?: {
|
|
172
|
+
param1: string;
|
|
173
|
+
param2: string;
|
|
174
|
+
}
|
|
175
|
+
type: VisualizationFieldType;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface IVisualization {
|
|
180
|
+
id: string;
|
|
181
|
+
title?: string;
|
|
182
|
+
type: VisualizationType;
|
|
183
|
+
fields?: IVisualizationField[];
|
|
184
|
+
properties?: {
|
|
185
|
+
charttype?: string,
|
|
186
|
+
|
|
187
|
+
// TODO Split Known Properties ---
|
|
188
|
+
[key: string]: any
|
|
189
|
+
};
|
|
190
|
+
events?: { [key: string]: IEvent };
|
|
191
|
+
onSelect?: any; // legacy
|
|
192
|
+
color?: any; // legacy
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface IPieVisualization extends IVisualization {
|
|
196
|
+
type: "PIE" | "BAR";
|
|
197
|
+
source: IPieSource;
|
|
198
|
+
}
|
|
199
|
+
export function isPieVisualization(viz: IAnyVisualization): viz is IPieVisualization {
|
|
200
|
+
return (viz as IPieVisualization).type === "PIE" || (viz as IPieVisualization).type === "BAR";
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface ILineVisualization extends IVisualization {
|
|
204
|
+
type: "LINE";
|
|
205
|
+
source: ILineSource;
|
|
206
|
+
}
|
|
207
|
+
export function isLineVisualization(viz: IAnyVisualization): viz is ILineVisualization {
|
|
208
|
+
return (viz as ILineVisualization).type === "LINE";
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export type ChoroColor = "default" | "YlGn" | "YlGnBu" | "GnBu" | "BuGn" | "PuBuGn" | "PuBu" | "BuPu" | "RdPu" | "PuRd" | "OrRd" | "YlOrRd" | "YlOrBr" | "Purples" | "Blues" | "Greens" | "Oranges" | "Reds" | "Greys" | "PuOr" | "BrBG" | "PRGn" | "PiYG" | "RdBu" | "RdGy" | "RdYlBu" | "Spectral" | "RdYlGn" | "RdWhGr";
|
|
212
|
+
export interface IChoroVisualization extends IVisualization {
|
|
213
|
+
type: "CHORO";
|
|
214
|
+
source: IChoroSource;
|
|
215
|
+
|
|
216
|
+
visualizations?: IChoroVisualization[];
|
|
217
|
+
color?: ChoroColor;
|
|
218
|
+
}
|
|
219
|
+
export function isChoroVisualization(viz: IAnyVisualization): viz is IChoroVisualization {
|
|
220
|
+
return (viz as IChoroVisualization).type === "CHORO";
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface ITableVisualization extends IVisualization {
|
|
224
|
+
type: "TABLE";
|
|
225
|
+
label: string[];
|
|
226
|
+
source: ITableSource;
|
|
227
|
+
}
|
|
228
|
+
export function isTableVisualization(viz: IAnyVisualization): viz is ITableVisualization {
|
|
229
|
+
return (viz as ITableVisualization).type === "TABLE";
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface ISliderVisualization extends IVisualization {
|
|
233
|
+
type: "SLIDER";
|
|
234
|
+
source: ISliderSource;
|
|
235
|
+
range?: number[];
|
|
236
|
+
}
|
|
237
|
+
export function isSliderVisualization(viz: IAnyVisualization): viz is ISliderVisualization {
|
|
238
|
+
return (viz as ISliderVisualization).type === "SLIDER";
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface IIcon {
|
|
242
|
+
[id: string]: string | number | boolean;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export type IValueMappings = { [key: string]: IIcon; };
|
|
246
|
+
|
|
247
|
+
export interface IVisualizationIcon {
|
|
248
|
+
fieldid?: string;
|
|
249
|
+
faChar?: string;
|
|
250
|
+
valuemappings?: IValueMappings;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface IGraphVisualization extends IVisualization {
|
|
254
|
+
type: "GRAPH";
|
|
255
|
+
source: IGraphSource;
|
|
256
|
+
|
|
257
|
+
label: string[];
|
|
258
|
+
icon: IVisualizationIcon;
|
|
259
|
+
flag: IVisualizationIcon[];
|
|
260
|
+
}
|
|
261
|
+
export function isGraphVisualization(viz: IAnyVisualization): viz is IGraphVisualization {
|
|
262
|
+
return (viz as IGraphVisualization).type === "GRAPH";
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export interface IHeatMapVisualization extends IVisualization {
|
|
266
|
+
type: "HEAT_MAP";
|
|
267
|
+
source: IHeatMapSource;
|
|
268
|
+
}
|
|
269
|
+
export function isHeatMapVisualization(viz: IAnyVisualization): viz is IHeatMapVisualization {
|
|
270
|
+
return (viz as IHeatMapVisualization).type === "HEAT_MAP";
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export interface IFormVisualization extends IVisualization {
|
|
274
|
+
type: "FORM";
|
|
275
|
+
}
|
|
276
|
+
export function isFormVisualization(viz: IAnyVisualization): viz is IFormVisualization {
|
|
277
|
+
return (viz as IFormVisualization).type === "FORM";
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Dashboard ================================================================
|
|
281
|
+
export interface IDashboard {
|
|
282
|
+
id?: string;
|
|
283
|
+
title?: string;
|
|
284
|
+
enable?: string;
|
|
285
|
+
label?: string;
|
|
286
|
+
primary?: boolean;
|
|
287
|
+
visualizations: IAnyVisualization[];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface IDDL {
|
|
291
|
+
dashboards: IDashboard[];
|
|
292
|
+
datasources: IAnyDatasource[];
|
|
293
|
+
hipieversion: string;
|
|
294
|
+
visualizationversion: string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// DDL ======================================================================
|
|
298
|
+
export type DDLSchema = IDDL;
|
|
299
|
+
|
|
300
|
+
// Helpers ==================================================================
|
|
301
|
+
export type IAnyChoroMapping = IChoroUSStateMapping | IChoroUSCountyMapping | IChoroGeohashMapping;
|
|
302
|
+
export function isUSStateMapping(mappings: IAnyChoroMapping) {
|
|
303
|
+
return (mappings as IChoroUSStateMapping).state !== undefined;
|
|
304
|
+
}
|
|
305
|
+
export function isUSCountyMapping(mappings: IAnyChoroMapping) {
|
|
306
|
+
return (mappings as IChoroUSCountyMapping).county !== undefined;
|
|
307
|
+
}
|
|
308
|
+
export function isGeohashMapping(mappings: IAnyChoroMapping) {
|
|
309
|
+
return (mappings as IChoroGeohashMapping).geohash !== undefined;
|
|
310
|
+
}
|
|
311
|
+
export type IAnyMapping = IPieMapping | ILineMapping | IGraphMapping | IAnyChoroMapping | ITableMapping | IHeatMapMapping;
|
|
312
|
+
export type IAnySource = IPieSource | ILineSource | ITableSource | IChoroSource | IGraphSource | IHeatMapSource;
|
|
313
|
+
export type IAnyVisualization = IPieVisualization | ILineVisualization | ITableVisualization | IChoroVisualization | IGraphVisualization | IHeatMapVisualization | ISliderVisualization | IFormVisualization;
|