aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/schema.json
blob: dba20ffb8d616b7c0913dc160181eac202310da1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
{
  "tables": {
    "JobRunsTable": {
      "columns": {
        "ID": "string",
        "SerialNumber": "string",
        "MachineType": "string",
        "Environment": "string",
        "Organization": "string",
        "Site": "string",
        "CreatedTime": "datetime",
        "UploadTime": "datetime",
        "JobName": "string",
        "Kind": "string",
        "Thread": "string",
        "NumberOfUnits": "int",
        "InterSegmentLength": "int",
        "LubricationEnabled": "bool",
        "SpoolTypeDistribution": "int",
        "NumberOfSpools": "int",
        "LogicalLength": "real",
        "ActualLength": "real",
        "TotalLength": "real",
        "StartPosition": "real",
        "EndPosition": "real",
        "Distance": "real",
        "StartTime": "datetime",
        "EndTime": "datetime",
        "Duration": "timespan",
        "HeatingDuration": "timespan",
        "Status": "string",
        "OutputCyan": "long",
        "OutputMagenta": "long",
        "OutputYellow": "long",
        "OutputBlack": "long",
        "OutputLightCyan": "long",
        "OutputLightMagenta": "long",
        "OutputLightYellow": "long",
        "OutputBlue": "long",
        "OutputLightBlue": "long",
        "OutputOrange": "long",
        "OutputLightOrange": "long",
        "OutputRubine": "long",
        "OutputLightRubine": "long",
        "OutputNavy": "long",
        "OutputViolet": "long",
        "OutputTransparent": "long",
        "OutputLubricant": "long",
        "FailureReason": "string",
        "ApplicationVersion": "string",
        "FirmwareVersion": "string",
        "Segments": "dynamic",
        "FineTuning": "dynamic",
        "ProcessParameters": "dynamic"
      },

      "primaryTimeColumn": "StartTime",
      "fallbackTimeColumns": [ "CreatedTime", "EndTime" ],
      "defaultTimeWindowDays": 30,

      "keys": {
        "primaryKey": [ "ID" ],
        "machineKey": [ "SerialNumber" ],
        "orgKeys": [ "Organization", "Site" ]
      },

      "enums": {
        "Status": [ "Completed", "Failed", "Aborted" ],
        "Kind": [ "Default", "FineTuning" ],
        "Environment": [ "DEV", "TEST", "BETA", "PROD" ]
      },

      "units": {
        "Distance": "meters",
        "LogicalLength": "meters",
        "ActualLength": "meters",
        "TotalLength": "meters",
        "StartPosition": "meters",
        "EndPosition": "meters",
        "Duration": "timespan",
        "HeatingDuration": "timespan",
        "Output*": "nanoliters"
      },

      "display": {
        "rename": {
          "Thread": "ThreadType"
        },
        "preferPercentBreakdowns": [ "Status" ]
      },

      "joinHints": [
        {
          "table": "MachinesTable",
          "on": [ "SerialNumber" ],
          "why": "Bring Organization/Site or versions from machine master data."
        }
      ],

      "notes": [
        "Each row is a single job run.",
        "Use StartTime for most time filters. if not found use CreatedTime",
        "Thread is the thread profile/type used for the job.",
        "Ink outputs (Output*) are in nanoliters.",
        "Distance = EndPosition - StartPosition.",
        "FineTuning is only populated when Kind == 'FineTuning'.",
        "FailureReason is only meaningful when Status == 'Failed'."
      ],

      "guardrails": {
        "requireTimeFilter": false,
        "maxRowsSuggested": 200,
        "encourageSummarizeOrTop": true
      },

      "fewShot": [
        {
          "user": "What are the most used thread types by jobs in the last 7 days?",
          "kql": "JobRunsTable\n| where EndTime between (from .. to)\n| summarize Jobs=count() by Thread\n| top 5 by Jobs desc"
        },
        {
          "user": "Failure rate per site last 30 days",
          "kql": "JobRunsTable\n| where EndTime between (from .. to)\n| summarize Total=count(), Failed=countif(Status == 'Failed') by Site\n| extend FailureRate = 100.0 * todouble(Failed) / todouble(Total)\n| order by FailureRate desc"
        },
        {
          "user": "Total ink usage by color for Organization X this week",
          "kql": "JobRunsTable\n| where EndTime between (from .. to) and Organization == 'Twine'\n| summarize Cyan=sum(OutputCyan), Magenta=sum(OutputMagenta), Yellow=sum(OutputYellow), Black=sum(OutputBlack), Transparent=sum(OutputTransparent), Lubricant=sum(OutputLubricant)"
        },
        {
          "user": "Average job duration by machine type yesterday",
          "kql": "JobRunsTable\n| where EndTime between (from .. to)\n| summarize AvgDuration=avg(Duration) by MachineType\n| order by AvgDuration desc"
        },
        {
          "user": "Top failure reasons in the past 14 days",
          "kql": "JobRunsTable\n| where EndTime between (from .. to) and Status == 'Failed' and isnotempty(FailureReason)\n| summarize Failures=count() by FailureReason\n| top 10 by Failures desc"
        }
      ]
    },
    "MachineStatusesTable": {
      "columns": {
        "SerialNumber": "string",
        "MachineType": "string",
        "Environment": "string",
        "Organization": "string",
        "Site": "string",
        "CreatedTime": "datetime",
        "UploadTime": "datetime",
        "State": "string",
        "OverallTemperature": "real",
        "Status": "dynamic"
      },

      "primaryTimeColumn": "CreatedTime",
      "fallbackTimeColumns": [ "UploadTime" ],
      "defaultTimeWindowDays": 1,

      "keys": {
        "machineKey": [ "SerialNumber" ]
      },

      "enums": {
        "State": [
          "PowerUp",
          "Ready",
          "Sleep",
          "Error",
          "ShuttingDown",
          "PreparingJob",
          "RunningJob",
          "PowerDown"
        ]
      },

      "notes": [
        "One row per machine status snapshot. Use CreatedTime for analysis; UploadTime is the ingestion/upload timestamp.",
        "Status is a dynamic JSON object mirroring the on-device status payload (e.g., State, OverallTemperature, SpoolState, IDSPacksLevels[], error flags).",
        "OverallTemperature is also duplicated at the top level for quick filtering/aggregation; the authoritative nested copy is Status.OverallTemperature.",
        "Common expansions: Status.State (string), Status.SpoolState (string), Status.IDSPacksLevels (array of per-pack objects with MidTankLevel, DispenserLevel, etc.).",
        "Example: latest state per machine (last 24h): MachineStatusesTable | where CreatedTime > ago(1d) | summarize arg_max(CreatedTime, *) by SerialNumber | project SerialNumber, Time=CreatedTime, State, OverallTemperature",
        "Example: detect low MidTankLevel on any pack: MachineStatusesTable | where CreatedTime > ago(1d) | mv-expand pack=Status.IDSPacksLevels | project SerialNumber, CreatedTime, Index=todouble(pack.Index), MidTankLevel=toreal(pack.MidTankLevel) | where MidTankLevel < 2 | summarize min(MidTankLevel), any(CreatedTime) by SerialNumber, Index",
        "Example: error intervals: MachineStatusesTable | where CreatedTime > ago(7d) | summarize Start=min(CreatedTime), End=max(CreatedTime), Count=count() by SerialNumber, State | where State == \"Error\" | order by Count desc",
        "Example: Get the overall temperature during the last job for machine 30001: let LastJob = JobRunsTable | where SerialNumber == \"30001\" | summarize arg_max(EndTime, StartTime, EndTime) by SerialNumber; MachineStatusesTable | where SerialNumber == \"30001\" | join kind=inner (LastJob) on SerialNumber | where CreatedTime between (StartTime .. EndTime)"
      ],

      "guardrails": {
        "requireTimeFilter": true,
        "maxRowsSuggested": 500,
        "encourageSummarizeOrTop": true
      },

      "joinHints": [
        {
          "table": "JobRunsTable",
          "on": [ "SerialNumber" ],
          "why": "Correlate state transitions (PreparingJob/RunningJob/Error) with job windows."
        },
        {
          "table": "MachinesTable",
          "on": [ "SerialNumber" ],
          "why": "Enrich with machine metadata (organization/site/version)."
        },
        {
          "table": "LogsTable",
          "on": [ "SerialNumber" ],
          "why": "Investigate logs around status changes using a time window."
        }
      ],

      "display": {
        "rename": {
          "CreatedTime": "Time"
        },
        "suggestedProjections": [
          "SerialNumber",
          "Time",
          "State",
          "OverallTemperature",
          "Status.SpoolState",
          "Status.IDSPacksLevels"
        ]
      }


    },
    "MachinesTable": {
      "columns": {
        "ID": "int",
        "GUID": "string",
        "LAST_UPDATED": "datetime",
        "SERIAL_NUMBER": "string",
        "NAME": "string",
        "PRODUCTION_DATE": "datetime",
        "ORGANIZATION_GUID": "string",
        "SITE_GUID": "string",
        "MACHINE_VERSION_GUID": "string",
        "CONFIGURATION_GUID": "string",
        "DEFAULT_RML_GUID": "string",
        "LOADED_RML_GUID": "string",
        "TARGET_JOB_TYPES": "string",
        "TARGET_COLOR_SPACE_CODES": "string",
        "DEFAULT_COLOR_SPACE_GUID": "string",
        "DEFAULT_SEGMENT_LENGTH": "real",
        "DEFAULT_SPOOL_TYPE_GUID": "string",
        "OS_KEY": "string",
        "AUTO_LOGIN": "bool",
        "AUTO_CHECK_FOR_UPDATES": "bool",
        "SETUP_ACTIVATION": "bool",
        "SETUP_REMOTE_ASSISTANCE": "bool",
        "SETUP_UWF": "bool",
        "SETUP_FIRMWARE": "bool",
        "SETUP_FPGA": "bool",
        "IS_DEMO": "bool",
        "SUSPEND_VERSION_UPDATE": "bool",
        "FORCE_VERSION_UPDATE": "bool",
        "PERFORM_SCHEMA_UPDATE_ON_DATA_UPDATE": "bool",
        "DEVICE_COM_PORT": "string",
        "IS_DEVICE_REGISTERED": "bool",
        "DEVICE_ID": "string",
        "DEVICE_NAME": "string",
        "HEAD_TYPE": "int",
        "ACTIVATION_KEY": "string",
        "LIGHT_INKS_INSTALLED": "bool",
        "BTSR_INSTALLED": "bool",
        "VERSION_TAG": "string",
        "MACHINE_TYPE": "int",
        "ALLOW_SMS_NOTIFICATIONS": "bool",
        "ENVIRONMENT": "string"
      },

      "keys": {
        "primaryKey": [ "GUID" ],
        "machineKey": [ "SERIAL_NUMBER" ]
      },

      "display": {
        "rename": {
          "SERIAL_NUMBER": "SerialNumber",
          "LAST_UPDATED": "LastUpdated",
          "MACHINE_TYPE": "MachineType",
          "ENVIRONMENT": "Environment"
        }
      },

      "joinHints": [
        {
          "table": "JobRunsTable",
          "on": [ "SerialNumber == MachinesTable.SERIAL_NUMBER" ],
          "why": "Enrich job runs with machine metadata (organization/site/version). Note: column casing differs."
        },
        {
          "table": "OrganizationsTable",
          "on": [ "GUID == MachinesTable.ORGANIZATION_GUID" ],
          "why": "Get the machine's organization name'."
        },
        {
          "table": "SitesTable",
          "on": [ "GUID == MachinesTable.SITE_GUID" ],
          "why": "Get the machine's site name'. If no site than the machine does not belong to any site."
        }
      ],

      "notes": [
        "Column names here are UPPER_SNAKE_CASE and are case-sensitive in Kusto.",
        "Use GUID as the stable machine identifier; SERIAL_NUMBER is the human-facing ID used in JobRunsTable.",
        "Map JobRunsTable.SerialNumber to MachinesTable.SERIAL_NUMBER for joins.",
        "If duplicate rows arrive, use arg_max(LAST_UPDATED, *) by GUID to keep the latest."
      ]
    },
    "LogsTable": {
      "columns": {
        "SerialNumber": "string",
        "MachineType": "string",
        "Environment": "string",
        "Organization": "string",
        "Site": "string",
        "CreatedTime": "datetime",
        "UploadTime": "datetime",
        "Source": "string",
        "Category": "string",
        "Class": "string",
        "Method": "string",
        "Line": "int",
        "Message": "string"
      },

      "primaryTimeColumn": "CreatedTime",
      "fallbackTimeColumns": [ "UploadTime" ],
      "defaultTimeWindowDays": 7,

      "keys": {
        "machineKey": [ "SerialNumber" ]
      },

      "enums": {
        "Category": [ "Info", "Warning", "Error", "Critical", "Debug" ],
        "Source": [ "Application", "Firmware" ]
      },

      "notes": [
        "Application logs emitted by services/apps running on or about the machines.",
        "Use CreatedTime for time filters; UploadTime is the ingestion/upload timestamp.",
        "Category is limited to Info, Warning, Error, Critical, Debug.",
        "Source can be either Application or Firmware where Firmware represents logs generated by the embedded device and Application is everything else.",
        "Example to get error logs associated with a specific job: let LastJob = JobRunsTable | where SerialNumber == \"30001\" | summarize arg_max(EndTime, StartTime, EndTime) by SerialNumber; LogsTable | join kind=inner (LastJob) on SerialNumber | where Category == \"Error\" | where CreatedTime between (StartTime .. EndTime) | order by CreatedTime asc | project Time = format_datetime(CreatedTime, 'HH:mm:ss.fff'), Message"
      ],

      "guardrails": {
        "requireTimeFilter": false,
        "maxRowsSuggested": 200,
        "encourageSummarizeOrTop": false
      },

      "joinHints": [
        {
          "table": "JobRunsTable",
          "on": [ "SerialNumber" ],
          "why": "Correlate logs to jobs on the same machine in a time window."
        }
      ],

      "display": {
        "rename": {
          "CreatedTime": "Time"
        }
      }
    },
    "EventTypesTable": {
      "columns": {
        "ID": "int",
        "GUID": "string",
        "LAST_UPDATED": "datetime",
        "CODE": "int",
        "NAME": "string",
        "TITLE": "string",
        "DESCRIPTION": "string",
        "TECHNICAL_DESCRIPTION": "string",
        "COMPONENT_INDEX": "int",
        "EVENT_CATEGORY": "int",
        "EVENT_GROUP": "int",
        "EVENT_NOTIFICATION_TIME": "int",
        "EVENT_ACTIONS": "string",
        "REQUIRES_USER_INTERVENTION": "bool",
        "GUIDANCE": "string",
        "PERSISTENT": "bool"
      },

      "keys": {
        "primaryKey": [ "GUID" ],
        "codeKey": [ "CODE" ]
      },

      "display": {
        "rename": {
          "LAST_UPDATED": "LastUpdated",
          "EVENT_CATEGORY": "EventCategory",
          "EVENT_GROUP": "EventGroup",
          "EVENT_NOTIFICATION_TIME": "NotificationTimeSec",
          "REQUIRES_USER_INTERVENTION": "RequiresUserIntervention"
        }
      },

      "notes": [
        "Lookup/dimension table describing event types.",
        "Join to EventsTable on EventsTable.EventTypeGuid == EventTypesTable.GUID.",
        "EVENT_CATEGORY/GROUP are numeric buckets; TITLE/NAME are human-friendly.",
        "If duplicate rows arrive, use arg_max(LAST_UPDATED, *) by GUID to keep the latest."
      ]
    },
    "EventsTable": {
      "columns": {
        "SerialNumber": "string",
        "MachineType": "string",
        "Environment": "string",
        "Organization": "string",
        "Site": "string",
        "CreatedTime": "datetime",
        "UploadTime": "datetime",
        "ID": "string",
        "HostName": "string",
        "EventTypeGuid": "string",
        "Description": "string"
      },

      "primaryTimeColumn": "CreatedTime",
      "fallbackTimeColumns": [ "UploadTime" ],
      "defaultTimeWindowDays": 7,

      "keys": {
        "eventKey": [ "ID" ],
        "machineKey": [ "SerialNumber" ]
      },

      "joinHints": [
        {
          "table": "EventTypesTable",
          "on": [ "EventTypeGuid == EventTypesTable.GUID" ],
          "why": "Bring title/category/code/technical description and flags like RequiresUserIntervention/Persistent."
        },
        {
          "table": "MachinesTable",
          "on": [ "SerialNumber == MachinesTable.SERIAL_NUMBER" ],
          "why": "Enrich events with machine master data (org/site/version)."
        }
      ],

      "guardrails": {
        "requireTimeFilter": true,
        "maxRowsSuggested": 200,
        "encourageSummarizeOrTop": true
      },

      "notes": [
        "Each row is a concrete event occurrence on a machine.",
        "Use CreatedTime for time range filters; UploadTime indicates ingestion.",
        "EventTypeGuid maps to EventTypesTable.GUID for metadata (title, category, etc.)."
      ]
    },
    "OrganizationsTable": {
      "columns": {
        "ID": "int",
        "GUID": "string",
        "LAST_UPDATED": "datetime",
        "NAME": "string",
        "CONTACT_GUID": "string",
        "ADDRESS_GUID": "string",
        "ENVIRONMENT": "string"
      },
      "keys": {
        "primaryKey": [ "GUID" ],
        "identityKey": [ "ID" ]
      },
      "display": {
        "rename": {
          "NAME": "Name",
          "LAST_UPDATED": "LastUpdated",
          "ENVIRONMENT": "Environment"
        }
      },
      "joinHints": [
        {
          "table": "SitesTable",
          "on": [ "SitesTable.ORGANIZATION_GUID == OrganizationsTable.GUID" ],
          "why": "Attach sites to their parent organization."
        },
        {
          "table": "MachinesTable",
          "on": [ "MachinesTable.ORGANIZATION_GUID == OrganizationsTable.GUID" ],
          "why": "Filter or aggregate machines by organization."
        }
      ],
      "notes": [
        "Column names are UPPER_SNAKE_CASE and case-sensitive in Kusto.",
        "ENVIRONMENT is populated by ADF at sink time (not present in source SQL).",
        "Prefer joining by GUID; ID is a SQL identity surrogate and may differ across environments.",
        "If duplicate rows arrive, use arg_max(LAST_UPDATED, *) by GUID to keep the latest."
      ]
    },
    "SitesTable": {
      "columns": {
        "ID": "int",
        "GUID": "string",
        "LAST_UPDATED": "datetime",
        "ORGANIZATION_GUID": "string",
        "NAME": "string",
        "DESCRIPTION": "string",
        "ENVIRONMENT": "string"
      },
      "keys": {
        "primaryKey": [ "GUID" ],
        "identityKey": [ "ID" ]
      },
      "display": {
        "rename": {
          "LAST_UPDATED": "LastUpdated",
          "ORGANIZATION_GUID": "OrganizationGuid",
          "ENVIRONMENT": "Environment"
        }
      },
      "joinHints": [
        {
          "table": "OrganizationsTable",
          "on": [ "SitesTable | join kind=inner (OrganizationsTable) on $left.ORGANIZATION_GUID == $right.GUID and $left.ENVIRONMENT == $right.ENVIRONMENT)" ],
          "why": "Attach each site to its parent organization."
        },
        {
          "table": "MachinesTable",
          "on": [ "MachinesTable.SITE_GUID == SitesTable.GUID" ],
          "why": "List or aggregate machines that belong to a site."
        }
      ],
      "notes": [
        "DESCRIPTION is nullable in SQL; ADX string accepts null/empty.",
        "ENVIRONMENT is injected by ADF at sink time (not present in source SQL).",
        "Prefer GUID-based joins; ID is a SQL identity and may vary across environments.",
        "To de-duplicate mirrored rows, use arg_max(LAST_UPDATED, *) by GUID."
      ]
    }
  }
}