@connectci/xdmod-charts 0.2.0 → 0.3.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.
@@ -10,4 +10,4 @@ Each `fixtures/<name>.json` is one case for a producer's payload builder:
10
10
 
11
11
  Comparison rule: deep equality between the builder's output and `expected`, except `warnings`. For `warnings` only the ordered list of `code`s is compared. The text is each producer's own.
12
12
 
13
- Fixtures use synthetic names only (`cluster-a`, `user-1`), never values recorded from a real or demo XDMoD. Each rule in `rules/README.md` names the fixtures that pin it.
13
+ Fixture values are invented, never recorded from a real or demo XDMoD. Usernames, people, projects and queues are always synthetic (`user-1`, `queue-a`). Resources may be synthetic (`cluster-a`) or a public resource's name, since those names are public; their values are still invented. Each rule in `rules/README.md` names the fixtures that pin it.
@@ -0,0 +1,328 @@
1
+ {
2
+ "description": "Monthly job_count by resource with ten series, more than the palette's eight colours: the builder passes every series through in XDMoD's order; capping is the adapter's and the client's job.",
3
+ "producers": [
4
+ "ts",
5
+ "py"
6
+ ],
7
+ "input": {
8
+ "request": {
9
+ "realm": "Jobs",
10
+ "statistic": "job_count",
11
+ "group_by": "resource",
12
+ "dataset_type": "timeseries",
13
+ "start_date": "2026-08-01",
14
+ "end_date": "2026-10-31",
15
+ "filters_notes": [],
16
+ "dimension_filtered": false,
17
+ "offset": 0,
18
+ "limit": 10,
19
+ "unit": "Month"
20
+ },
21
+ "label": "Number of Jobs Ended",
22
+ "description": "Number of Jobs Ended: The total number of jobs that ended during the selected period.",
23
+ "today": "2026-11-27",
24
+ "others_count": 0,
25
+ "has_more": false,
26
+ "latest_data_day": null,
27
+ "resource_days": null,
28
+ "link": null,
29
+ "time_zone": null,
30
+ "instance": null,
31
+ "series": [
32
+ {
33
+ "name": "cluster-a",
34
+ "values": {
35
+ "2026-08-01": 100,
36
+ "2026-09-01": 101,
37
+ "2026-10-01": 102
38
+ }
39
+ },
40
+ {
41
+ "name": "cluster-b",
42
+ "values": {
43
+ "2026-08-01": 90,
44
+ "2026-09-01": 91,
45
+ "2026-10-01": 92
46
+ }
47
+ },
48
+ {
49
+ "name": "cluster-c",
50
+ "values": {
51
+ "2026-08-01": 80,
52
+ "2026-09-01": 81,
53
+ "2026-10-01": 82
54
+ }
55
+ },
56
+ {
57
+ "name": "cluster-d",
58
+ "values": {
59
+ "2026-08-01": 70,
60
+ "2026-09-01": 71,
61
+ "2026-10-01": 72
62
+ }
63
+ },
64
+ {
65
+ "name": "cluster-e",
66
+ "values": {
67
+ "2026-08-01": 60,
68
+ "2026-09-01": 61,
69
+ "2026-10-01": 62
70
+ }
71
+ },
72
+ {
73
+ "name": "cluster-f",
74
+ "values": {
75
+ "2026-08-01": 50,
76
+ "2026-09-01": 51,
77
+ "2026-10-01": 52
78
+ }
79
+ },
80
+ {
81
+ "name": "cluster-g",
82
+ "values": {
83
+ "2026-08-01": 40,
84
+ "2026-09-01": 41,
85
+ "2026-10-01": 42
86
+ }
87
+ },
88
+ {
89
+ "name": "cluster-h",
90
+ "values": {
91
+ "2026-08-01": 30,
92
+ "2026-09-01": 31,
93
+ "2026-10-01": 32
94
+ }
95
+ },
96
+ {
97
+ "name": "cluster-i",
98
+ "values": {
99
+ "2026-08-01": 20,
100
+ "2026-09-01": 21,
101
+ "2026-10-01": 22
102
+ }
103
+ },
104
+ {
105
+ "name": "cluster-j",
106
+ "values": {
107
+ "2026-08-01": 10,
108
+ "2026-09-01": 11,
109
+ "2026-10-01": 12
110
+ }
111
+ }
112
+ ]
113
+ },
114
+ "expected": {
115
+ "version": 1,
116
+ "realm": "Jobs",
117
+ "statistic": "job_count",
118
+ "group_by": "resource",
119
+ "dataset_type": "timeseries",
120
+ "requested": {
121
+ "start": "2026-08-01",
122
+ "end": "2026-10-31"
123
+ },
124
+ "counted": {
125
+ "start": "2026-08-01",
126
+ "end": "2026-10-31"
127
+ },
128
+ "last_period_incomplete": false,
129
+ "measure": {
130
+ "label": "Number of Jobs Ended",
131
+ "description": "The total number of jobs that ended during the selected period.",
132
+ "kind": "total",
133
+ "missing": "zero",
134
+ "unit": "jobs"
135
+ },
136
+ "dimension": {
137
+ "name": "resource",
138
+ "ordered": false
139
+ },
140
+ "filters": {
141
+ "notes": []
142
+ },
143
+ "offset": 0,
144
+ "others_count": 0,
145
+ "has_more": false,
146
+ "ranked_by": "value",
147
+ "link": null,
148
+ "source": "XDMoD",
149
+ "retrieved": "2026-11-27",
150
+ "unit": "Month",
151
+ "warnings": [],
152
+ "data_through": "2026-10-01",
153
+ "data_through_precision": "period",
154
+ "last_data_period_partial": false,
155
+ "series": [
156
+ {
157
+ "name": "cluster-a",
158
+ "points": [
159
+ {
160
+ "start": "2026-08-01",
161
+ "value": 100
162
+ },
163
+ {
164
+ "start": "2026-09-01",
165
+ "value": 101
166
+ },
167
+ {
168
+ "start": "2026-10-01",
169
+ "value": 102
170
+ }
171
+ ]
172
+ },
173
+ {
174
+ "name": "cluster-b",
175
+ "points": [
176
+ {
177
+ "start": "2026-08-01",
178
+ "value": 90
179
+ },
180
+ {
181
+ "start": "2026-09-01",
182
+ "value": 91
183
+ },
184
+ {
185
+ "start": "2026-10-01",
186
+ "value": 92
187
+ }
188
+ ]
189
+ },
190
+ {
191
+ "name": "cluster-c",
192
+ "points": [
193
+ {
194
+ "start": "2026-08-01",
195
+ "value": 80
196
+ },
197
+ {
198
+ "start": "2026-09-01",
199
+ "value": 81
200
+ },
201
+ {
202
+ "start": "2026-10-01",
203
+ "value": 82
204
+ }
205
+ ]
206
+ },
207
+ {
208
+ "name": "cluster-d",
209
+ "points": [
210
+ {
211
+ "start": "2026-08-01",
212
+ "value": 70
213
+ },
214
+ {
215
+ "start": "2026-09-01",
216
+ "value": 71
217
+ },
218
+ {
219
+ "start": "2026-10-01",
220
+ "value": 72
221
+ }
222
+ ]
223
+ },
224
+ {
225
+ "name": "cluster-e",
226
+ "points": [
227
+ {
228
+ "start": "2026-08-01",
229
+ "value": 60
230
+ },
231
+ {
232
+ "start": "2026-09-01",
233
+ "value": 61
234
+ },
235
+ {
236
+ "start": "2026-10-01",
237
+ "value": 62
238
+ }
239
+ ]
240
+ },
241
+ {
242
+ "name": "cluster-f",
243
+ "points": [
244
+ {
245
+ "start": "2026-08-01",
246
+ "value": 50
247
+ },
248
+ {
249
+ "start": "2026-09-01",
250
+ "value": 51
251
+ },
252
+ {
253
+ "start": "2026-10-01",
254
+ "value": 52
255
+ }
256
+ ]
257
+ },
258
+ {
259
+ "name": "cluster-g",
260
+ "points": [
261
+ {
262
+ "start": "2026-08-01",
263
+ "value": 40
264
+ },
265
+ {
266
+ "start": "2026-09-01",
267
+ "value": 41
268
+ },
269
+ {
270
+ "start": "2026-10-01",
271
+ "value": 42
272
+ }
273
+ ]
274
+ },
275
+ {
276
+ "name": "cluster-h",
277
+ "points": [
278
+ {
279
+ "start": "2026-08-01",
280
+ "value": 30
281
+ },
282
+ {
283
+ "start": "2026-09-01",
284
+ "value": 31
285
+ },
286
+ {
287
+ "start": "2026-10-01",
288
+ "value": 32
289
+ }
290
+ ]
291
+ },
292
+ {
293
+ "name": "cluster-i",
294
+ "points": [
295
+ {
296
+ "start": "2026-08-01",
297
+ "value": 20
298
+ },
299
+ {
300
+ "start": "2026-09-01",
301
+ "value": 21
302
+ },
303
+ {
304
+ "start": "2026-10-01",
305
+ "value": 22
306
+ }
307
+ ]
308
+ },
309
+ {
310
+ "name": "cluster-j",
311
+ "points": [
312
+ {
313
+ "start": "2026-08-01",
314
+ "value": 10
315
+ },
316
+ {
317
+ "start": "2026-09-01",
318
+ "value": 11
319
+ },
320
+ {
321
+ "start": "2026-10-01",
322
+ "value": 12
323
+ }
324
+ ]
325
+ }
326
+ ]
327
+ }
328
+ }
@@ -0,0 +1,104 @@
1
+ {
2
+ "description": "Aggregate avg_cpu_hours by resource through today: all three warnings, in rule 9's order. avg_cpu_hours is not in statistics.json, so the prefix fallback makes it an average and there is no unit.",
3
+ "producers": [
4
+ "ts",
5
+ "py"
6
+ ],
7
+ "input": {
8
+ "request": {
9
+ "realm": "Jobs",
10
+ "statistic": "avg_cpu_hours",
11
+ "group_by": "resource",
12
+ "dataset_type": "aggregate",
13
+ "start_date": "2026-11-01",
14
+ "end_date": "2026-11-27",
15
+ "filters_notes": [],
16
+ "dimension_filtered": false,
17
+ "offset": 0,
18
+ "limit": 8
19
+ },
20
+ "label": "CPU Hours: Per Job",
21
+ "description": "CPU Hours: Per Job: The average core time, in hours, of a job.",
22
+ "today": "2026-11-27",
23
+ "others_count": 0,
24
+ "has_more": false,
25
+ "latest_data_day": null,
26
+ "resource_days": null,
27
+ "link": null,
28
+ "time_zone": null,
29
+ "instance": null,
30
+ "categories": [
31
+ {
32
+ "name": "1. cluster-a",
33
+ "value": 3.5
34
+ },
35
+ {
36
+ "name": "2. cluster-b",
37
+ "value": 1.25
38
+ }
39
+ ]
40
+ },
41
+ "expected": {
42
+ "version": 1,
43
+ "realm": "Jobs",
44
+ "statistic": "avg_cpu_hours",
45
+ "group_by": "resource",
46
+ "dataset_type": "aggregate",
47
+ "requested": {
48
+ "start": "2026-11-01",
49
+ "end": "2026-11-27"
50
+ },
51
+ "counted": {
52
+ "start": "2026-11-01",
53
+ "end": "2026-11-27"
54
+ },
55
+ "last_period_incomplete": true,
56
+ "measure": {
57
+ "label": "CPU Hours: Per Job",
58
+ "description": "The average core time, in hours, of a job.",
59
+ "kind": "average",
60
+ "missing": "gap"
61
+ },
62
+ "dimension": {
63
+ "name": "resource",
64
+ "ordered": false
65
+ },
66
+ "filters": {
67
+ "notes": []
68
+ },
69
+ "offset": 0,
70
+ "others_count": 0,
71
+ "has_more": false,
72
+ "ranked_by": "value",
73
+ "link": null,
74
+ "source": "XDMoD",
75
+ "retrieved": "2026-11-27",
76
+ "warnings": [
77
+ {
78
+ "code": "waiting-not-counted",
79
+ "text": "XDMoD counts a job when it ends, so jobs still waiting or running aren't counted, and the last period may be incomplete."
80
+ },
81
+ {
82
+ "code": "not-comparable-across-resources",
83
+ "text": "CPU hours don't allow for differences in per-core speed, so they aren't comparable across resources."
84
+ },
85
+ {
86
+ "code": "mean-of-jobs",
87
+ "text": "This is an average per job, so a few long jobs can pull it up."
88
+ }
89
+ ],
90
+ "data_through": null,
91
+ "data_through_precision": null,
92
+ "last_data_period_partial": false,
93
+ "categories": [
94
+ {
95
+ "name": "cluster-a",
96
+ "value": 3.5
97
+ },
98
+ {
99
+ "name": "cluster-b",
100
+ "value": 1.25
101
+ }
102
+ ]
103
+ }
104
+ }
@@ -0,0 +1,135 @@
1
+ {
2
+ "description": "Weekly job_count by queue through today, a Friday: the today cap cuts the last week, so it is incomplete and the waiting warning applies; counted still ends on Sunday; the latest data day sharpens data_through inside the last week, so that week is partial.",
3
+ "producers": [
4
+ "py"
5
+ ],
6
+ "input": {
7
+ "request": {
8
+ "realm": "Jobs",
9
+ "statistic": "job_count",
10
+ "group_by": "queue",
11
+ "dataset_type": "timeseries",
12
+ "start_date": "2026-11-09",
13
+ "end_date": "2026-11-27",
14
+ "filters_notes": [],
15
+ "dimension_filtered": false,
16
+ "offset": 0,
17
+ "limit": 8,
18
+ "unit": "Week"
19
+ },
20
+ "label": "Number of Jobs Ended",
21
+ "description": "Number of Jobs Ended: The total number of jobs that ended during the selected period.",
22
+ "today": "2026-11-27",
23
+ "others_count": 0,
24
+ "has_more": false,
25
+ "latest_data_day": "2026-11-26",
26
+ "resource_days": null,
27
+ "link": null,
28
+ "time_zone": null,
29
+ "instance": null,
30
+ "series": [
31
+ {
32
+ "name": "queue-a",
33
+ "values": {
34
+ "2026-11-09": 4,
35
+ "2026-11-13": 6,
36
+ "2026-11-16": 3,
37
+ "2026-11-23": 2,
38
+ "2026-11-26": 5
39
+ }
40
+ },
41
+ {
42
+ "name": "queue-b",
43
+ "values": {
44
+ "2026-11-10": 1
45
+ }
46
+ }
47
+ ]
48
+ },
49
+ "expected": {
50
+ "version": 1,
51
+ "realm": "Jobs",
52
+ "statistic": "job_count",
53
+ "group_by": "queue",
54
+ "dataset_type": "timeseries",
55
+ "requested": {
56
+ "start": "2026-11-09",
57
+ "end": "2026-11-27"
58
+ },
59
+ "counted": {
60
+ "start": "2026-11-09",
61
+ "end": "2026-11-29"
62
+ },
63
+ "last_period_incomplete": true,
64
+ "measure": {
65
+ "label": "Number of Jobs Ended",
66
+ "description": "The total number of jobs that ended during the selected period.",
67
+ "kind": "total",
68
+ "missing": "zero",
69
+ "unit": "jobs"
70
+ },
71
+ "dimension": {
72
+ "name": "queue",
73
+ "ordered": false
74
+ },
75
+ "filters": {
76
+ "notes": []
77
+ },
78
+ "offset": 0,
79
+ "others_count": 0,
80
+ "has_more": false,
81
+ "ranked_by": "value",
82
+ "link": null,
83
+ "source": "XDMoD",
84
+ "retrieved": "2026-11-27",
85
+ "unit": "Week",
86
+ "warnings": [
87
+ {
88
+ "code": "waiting-not-counted",
89
+ "text": "XDMoD counts a job when it ends, so jobs still waiting or running aren't counted, and the last period may be incomplete."
90
+ }
91
+ ],
92
+ "data_through": "2026-11-26",
93
+ "data_through_precision": "day",
94
+ "last_data_period_partial": true,
95
+ "series": [
96
+ {
97
+ "name": "queue-a",
98
+ "points": [
99
+ {
100
+ "start": "2026-11-09",
101
+ "value": 10
102
+ },
103
+ {
104
+ "start": "2026-11-16",
105
+ "value": 3
106
+ },
107
+ {
108
+ "start": "2026-11-23",
109
+ "value": 7
110
+ }
111
+ ]
112
+ },
113
+ {
114
+ "name": "queue-b",
115
+ "points": [
116
+ {
117
+ "start": "2026-11-09",
118
+ "value": 1
119
+ },
120
+ {
121
+ "start": "2026-11-16",
122
+ "value": null
123
+ },
124
+ {
125
+ "start": "2026-11-23",
126
+ "value": null
127
+ }
128
+ ],
129
+ "data_through": "2026-11-09",
130
+ "data_through_precision": "period",
131
+ "data_through_source": "series"
132
+ }
133
+ ]
134
+ }
135
+ }
@@ -0,0 +1,130 @@
1
+ {
2
+ "description": "Weekly total_cpu_hours by queue, range ending on a Wednesday: counted ends the Sunday after, days after the requested end are in the last week, fractional days sum, a queue with no later week is marked by its own last week (source series).",
3
+ "producers": [
4
+ "py"
5
+ ],
6
+ "input": {
7
+ "request": {
8
+ "realm": "Jobs",
9
+ "statistic": "total_cpu_hours",
10
+ "group_by": "queue",
11
+ "dataset_type": "timeseries",
12
+ "start_date": "2026-10-05",
13
+ "end_date": "2026-10-21",
14
+ "filters_notes": [],
15
+ "dimension_filtered": false,
16
+ "offset": 0,
17
+ "limit": 8,
18
+ "unit": "Week"
19
+ },
20
+ "label": "CPU Hours: Total",
21
+ "description": "CPU Hours: Total: The total core time, in hours, of jobs that ended.",
22
+ "today": "2026-11-27",
23
+ "others_count": 0,
24
+ "has_more": false,
25
+ "latest_data_day": null,
26
+ "resource_days": null,
27
+ "link": null,
28
+ "time_zone": null,
29
+ "instance": null,
30
+ "series": [
31
+ {
32
+ "name": "queue-a",
33
+ "values": {
34
+ "2026-10-05": 1.5,
35
+ "2026-10-11": 2.25,
36
+ "2026-10-21": 0.5,
37
+ "2026-10-24": 4
38
+ }
39
+ },
40
+ {
41
+ "name": "queue-b",
42
+ "values": {
43
+ "2026-10-13": 10,
44
+ "2026-10-14": 0
45
+ }
46
+ }
47
+ ]
48
+ },
49
+ "expected": {
50
+ "version": 1,
51
+ "realm": "Jobs",
52
+ "statistic": "total_cpu_hours",
53
+ "group_by": "queue",
54
+ "dataset_type": "timeseries",
55
+ "requested": {
56
+ "start": "2026-10-05",
57
+ "end": "2026-10-21"
58
+ },
59
+ "counted": {
60
+ "start": "2026-10-05",
61
+ "end": "2026-10-25"
62
+ },
63
+ "last_period_incomplete": false,
64
+ "measure": {
65
+ "label": "CPU Hours: Total",
66
+ "description": "The total core time, in hours, of jobs that ended.",
67
+ "kind": "total",
68
+ "missing": "zero",
69
+ "unit": "core-hours"
70
+ },
71
+ "dimension": {
72
+ "name": "queue",
73
+ "ordered": false
74
+ },
75
+ "filters": {
76
+ "notes": []
77
+ },
78
+ "offset": 0,
79
+ "others_count": 0,
80
+ "has_more": false,
81
+ "ranked_by": "value",
82
+ "link": null,
83
+ "source": "XDMoD",
84
+ "retrieved": "2026-11-27",
85
+ "unit": "Week",
86
+ "warnings": [],
87
+ "data_through": "2026-10-19",
88
+ "data_through_precision": "period",
89
+ "last_data_period_partial": false,
90
+ "series": [
91
+ {
92
+ "name": "queue-a",
93
+ "points": [
94
+ {
95
+ "start": "2026-10-05",
96
+ "value": 3.75
97
+ },
98
+ {
99
+ "start": "2026-10-12",
100
+ "value": null
101
+ },
102
+ {
103
+ "start": "2026-10-19",
104
+ "value": 4.5
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ "name": "queue-b",
110
+ "points": [
111
+ {
112
+ "start": "2026-10-05",
113
+ "value": null
114
+ },
115
+ {
116
+ "start": "2026-10-12",
117
+ "value": 10
118
+ },
119
+ {
120
+ "start": "2026-10-19",
121
+ "value": null
122
+ }
123
+ ],
124
+ "data_through": "2026-10-12",
125
+ "data_through_precision": "period",
126
+ "data_through_source": "series"
127
+ }
128
+ ]
129
+ }
130
+ }
@@ -0,0 +1,129 @@
1
+ {
2
+ "description": "Weekly job_count by resource, range starting on a Wednesday: weeks start Monday, counted starts the Monday before, days before the requested start are in the first week, each week is the sum of its days, a week with no day is null.",
3
+ "producers": [
4
+ "py"
5
+ ],
6
+ "input": {
7
+ "request": {
8
+ "realm": "Jobs",
9
+ "statistic": "job_count",
10
+ "group_by": "resource",
11
+ "dataset_type": "timeseries",
12
+ "start_date": "2026-10-07",
13
+ "end_date": "2026-10-25",
14
+ "filters_notes": [],
15
+ "dimension_filtered": false,
16
+ "offset": 0,
17
+ "limit": 8,
18
+ "unit": "Week"
19
+ },
20
+ "label": "Number of Jobs Ended",
21
+ "description": "Number of Jobs Ended: The total number of jobs that ended during the selected period.",
22
+ "today": "2026-11-27",
23
+ "others_count": 0,
24
+ "has_more": false,
25
+ "latest_data_day": null,
26
+ "resource_days": null,
27
+ "link": null,
28
+ "time_zone": null,
29
+ "instance": null,
30
+ "series": [
31
+ {
32
+ "name": "cluster-a",
33
+ "values": {
34
+ "2026-10-05": 3,
35
+ "2026-10-06": 2,
36
+ "2026-10-09": 5,
37
+ "2026-10-12": 4,
38
+ "2026-10-18": 1,
39
+ "2026-10-20": 7
40
+ }
41
+ },
42
+ {
43
+ "name": "cluster-b",
44
+ "values": {
45
+ "2026-10-08": 2,
46
+ "2026-10-21": 6
47
+ }
48
+ }
49
+ ]
50
+ },
51
+ "expected": {
52
+ "version": 1,
53
+ "realm": "Jobs",
54
+ "statistic": "job_count",
55
+ "group_by": "resource",
56
+ "dataset_type": "timeseries",
57
+ "requested": {
58
+ "start": "2026-10-07",
59
+ "end": "2026-10-25"
60
+ },
61
+ "counted": {
62
+ "start": "2026-10-05",
63
+ "end": "2026-10-25"
64
+ },
65
+ "last_period_incomplete": false,
66
+ "measure": {
67
+ "label": "Number of Jobs Ended",
68
+ "description": "The total number of jobs that ended during the selected period.",
69
+ "kind": "total",
70
+ "missing": "zero",
71
+ "unit": "jobs"
72
+ },
73
+ "dimension": {
74
+ "name": "resource",
75
+ "ordered": false
76
+ },
77
+ "filters": {
78
+ "notes": []
79
+ },
80
+ "offset": 0,
81
+ "others_count": 0,
82
+ "has_more": false,
83
+ "ranked_by": "value",
84
+ "link": null,
85
+ "source": "XDMoD",
86
+ "retrieved": "2026-11-27",
87
+ "unit": "Week",
88
+ "warnings": [],
89
+ "data_through": "2026-10-19",
90
+ "data_through_precision": "period",
91
+ "last_data_period_partial": false,
92
+ "series": [
93
+ {
94
+ "name": "cluster-a",
95
+ "points": [
96
+ {
97
+ "start": "2026-10-05",
98
+ "value": 10
99
+ },
100
+ {
101
+ "start": "2026-10-12",
102
+ "value": 5
103
+ },
104
+ {
105
+ "start": "2026-10-19",
106
+ "value": 7
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ "name": "cluster-b",
112
+ "points": [
113
+ {
114
+ "start": "2026-10-05",
115
+ "value": 2
116
+ },
117
+ {
118
+ "start": "2026-10-12",
119
+ "value": null
120
+ },
121
+ {
122
+ "start": "2026-10-19",
123
+ "value": 6
124
+ }
125
+ ]
126
+ }
127
+ ]
128
+ }
129
+ }
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@connectci/xdmod-charts",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Shared XDMoD chart payload contract: schema, types and parser.",
5
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/connectci-platform/xdmod-charts.git"
9
+ },
6
10
  "type": "module",
7
11
  "main": "dist/index.js",
8
12
  "types": "dist/index.d.ts",
package/rules/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Payload content rules
2
2
 
3
- Both producers (access-mcp in TypeScript, xdmod-mcp in Python) build a `ChartPayload` from XDMoD's answers by these rules. The schema says what shape is valid; these rules say what the values must be. Each rule names the fixture that pins it. Where it says "fixture: to come", the fixture is not written yet (Task 7 for weeks). Fixtures are compared as described in `fixtures/README.md`.
3
+ Both producers (access-mcp in TypeScript, xdmod-mcp in Python) build a `ChartPayload` from XDMoD's answers by these rules. The schema says what shape is valid; these rules say what the values must be. Each rule names the fixture that pins it. Fixtures are compared as described in `fixtures/README.md`.
4
4
 
5
5
  `rules/statistics.json` holds one entry per statistic either producer charts: `kind` (`total` or `average`), `unit` (a free string, so a new unit never hides a chart on an older client) and `additive` (true only when weeks may be summed, see rule 8).
6
6
 
7
7
  1. Measure kind and what a missing period means. `measure.kind` is the statistic's `kind` in `rules/statistics.json`. For an id not listed, the fallback applies in both languages: an id starting `total_` or ending `_count` is a total, anything else is an average. `measureKind()` in this package is the reference. A total's missing period is `measure.missing: "zero"`: an empty period is 0. An average's is `"gap"`: an empty period is unknown, never 0, and stays `null`. `measure.unit` is the statistic's `unit`, omitted for an unlisted id. Fixture: aggregate-jobs-by-resource (total, zero); gap: average-leaves-gaps; unit: cpu-hours-by-resource-incomplete.
8
8
 
9
- 2. The period grid and `counted`. For a timeseries, `unit` is the requested unit when it is Day, Week, Month, Quarter or Year, else chosen from the range: under 6 whole months Day, under 120 months Month, otherwise Quarter. The grid is every period start from the period containing `start_date` through the one containing `end_date`. Every series has one point per grid start, in order, with `null` where XDMoD sent no value. A period XDMoD returns that is off the grid is an error. `counted` runs from the first period's start to the last period's end, so it can be wider than `requested`. For an aggregate there are no periods and `counted` equals `requested`. Fixture: aggregate-jobs-by-resource (aggregate); timeseries: timeseries-month-gaps, calendar-december-into-january, calendar-range-ends-at-month-end, partial-last-day (Day).
9
+ 2. The period grid and `counted`. For a timeseries, `unit` is the requested unit when it is Day, Week, Month, Quarter or Year, else chosen from the range: under 6 whole months Day, under 120 months Month, otherwise Quarter. The grid is every period start from the period containing `start_date` through the one containing `end_date`. Every series has one point per grid start, in order, with `null` where XDMoD sent no value. A period XDMoD returns that is off the grid, or the same period given twice for one series, is an error, and so is a range whose grid is empty. `counted` runs from the first period's start to the last period's end, so it can be wider than `requested`. For an aggregate there are no periods, the payload has no `unit`, and `counted` equals `requested`. Fixture: aggregate-jobs-by-resource (aggregate); timeseries: timeseries-month-gaps, timeseries-more-series-than-palette (every series passes through, however many), calendar-december-into-january, calendar-range-ends-at-month-end, partial-last-day (Day).
10
10
 
11
11
  3. `data_through` and its precision. For a timeseries it is the start of the last period in which any series has a value, with `data_through_precision: "period"`. When the realm's latest data day is known, falls on or after that start and within the same period, it replaces the start and the precision is `"day"`. With Day units the precision is always `"day"`. With no value anywhere both are `null`. For an aggregate, `data_through` is the realm's latest data day, with precision `"day"`, only when that day is before the requested end; otherwise both are `null`. Fixture: aggregate-jobs-by-resource (null case); no-series-values (null for a timeseries); probe-day-inside-last-month, probe-day-after-range, probe-day-last-day-of-period, series-ended-before-probe-day; aggregate-incomplete-with-probe-day, aggregate-probe-reaches-end.
12
12
 
@@ -14,13 +14,13 @@ Both producers (access-mcp in TypeScript, xdmod-mcp in Python) build a `ChartPay
14
14
 
15
15
  5. Partial last period. `last_data_period_partial` is true when periods after the last one with data are empty, or when `data_through` has day precision and falls before the end of its period. Otherwise false. It is always false for an aggregate. `last_period_incomplete` is true when `counted.end` is on or after today (for an aggregate, when the requested end is). Fixture: aggregate-jobs-by-resource (false); partial-last-month, partial-last-day (true); timeseries-complete-last-period (incomplete false).
16
16
 
17
- 6. Ordered-bucket fill. A dimension is ordered when it is one of `jobsize`, `jobwalltime`, `jobwaittime`, `nodecount`, `gpu_count`. Categories of an ordered dimension are sorted into the dimension's bucket order (unknown names last, original order kept for ties). A bucket XDMoD left out is added with value 0 only when the statistic is a total, every bucket is known to have come back (`dimension_complete`), there is no paging (`has_more` false, `offset` 0), `dimension_filtered` is false (the request does not filter the group_by dimension itself), and at least one category came back. Otherwise nothing is added. Fixture: aggregate-fills-empty-buckets (fill); aggregate-no-fill-for-average, aggregate-no-fill-incomplete-buckets, aggregate-no-fill-when-more, aggregate-no-fill-with-offset, aggregate-no-fill-when-bucket-filtered (no fill); aggregate-ordered-bucket-order, aggregate-unknown-bucket-last, aggregate-nominal-not-reordered (order).
17
+ 6. Ordered-bucket fill. A dimension is ordered when it is one of `jobsize`, `jobwalltime`, `jobwaittime`, `nodecount`, `gpu_count`. Categories of an ordered dimension are sorted into the dimension's bucket order (unknown names last, original order kept for ties), but only when `dimension_order` is given and non-empty; without it they stay in XDMoD's order and nothing is filled. A bucket XDMoD left out is added with value 0 only when the statistic is a total, every bucket is known to have come back (`dimension_complete`), there is no paging (`has_more` false, `offset` 0), `dimension_filtered` is false (the request does not filter the group_by dimension itself), and at least one category came back. Otherwise nothing is added. Fixture: aggregate-fills-empty-buckets (fill); aggregate-no-fill-for-average, aggregate-no-fill-incomplete-buckets, aggregate-no-fill-when-more, aggregate-no-fill-with-offset, aggregate-no-fill-when-bucket-filtered (no fill); aggregate-ordered-bucket-order, aggregate-unknown-bucket-last, aggregate-nominal-not-reordered (order).
18
18
 
19
- 7. Ranking, `offset` and `others_count`. Names XDMoD numbers ("1. cluster-a") lose the rank prefix. `ranked_by` is `"value"`; XDMoD's order is kept, with `offset` the number of top-ranked entries skipped. `others_count` is the producer's count when XDMoD gave one; when it did not, it is `null` if `has_more` and 0 if not. No "Other" bucket is ever made. Fixture: aggregate-jobs-by-resource (no more); aggregate-has-more-others-count, aggregate-no-fill-when-more (null count), aggregate-offset-page (offset, rank prefixes), rank-prefixes-on-series.
19
+ 7. Ranking, `offset` and `others_count`. Names XDMoD numbers ("1. cluster-a") lose the rank prefix. `ranked_by` is `"value"`; XDMoD's order is kept, with `offset` the number of top-ranked entries skipped. `others_count` is the producer's count when XDMoD gave one; when it did not, it is `null` if `has_more` and 0 if not. The adapter derives it (rule 11), and the builder copies `BuilderInput.others_count` as given, a `null` included. No "Other" bucket is ever made. Fixture: aggregate-jobs-by-resource (no more); aggregate-has-more-others-count, aggregate-no-fill-when-more (null count), aggregate-offset-page (offset, rank prefixes), rank-prefixes-on-series.
20
20
 
21
- 8. Weeks. `unit: "Week"` is for additive statistics only (`additive: true`); a producer does not request weeks for any other. A week starts Monday. The fetch starts on the Monday on or before the start date and ends on the Sunday on or after the end date, capped at today. `counted` is those whole weeks. `last_period_incomplete` is set only when the today cap cut the last week. Fixture: to come (Task 7 weeks).
21
+ 8. Weeks. `unit: "Week"` is for additive statistics only (`additive: true`); a producer does not request weeks for any other. A week starts Monday. XDMoD has no week unit, so the producer fetches days: the fetch starts on the Monday on or before the start date and ends on the Sunday on or after the end date, capped at today. For a week chart `series[].values` holds those daily values keyed by day, and the builder sums each series' days into Monday-start weeks; a week with no day stays `null`, and a day outside the week grid is an error (rule 2). `counted` is those whole weeks, from the Monday through the Sunday, even when the cap cut the last one. `last_period_incomplete` is set only when the today cap cut the last week, which is rule 5's test: `counted.end` (the last Sunday) is on or after today, so a week ending today counts as incomplete too. Rules 3 to 5 then apply to the weeks as to any other period. Fixture: week-total-midweek-start, week-total-midweek-end, week-total-incomplete-last (py only: access-mcp does not offer weeks).
22
22
 
23
- 9. Warnings. A producer on this contract always emits `warnings`, an empty array when it has none; an absent `warnings` field means a pre-contract producer, and a client then applies its built-in warnings (`BUILT_IN_WARNINGS`). Each has a stable `code` and producer-worded `text`, and the order below is the order in the list. `waiting-not-counted` when the realm is Jobs and the last period is incomplete. `not-comparable-across-resources` when the dimension is `resource` and the statistic is `total_cpu_hours` or `avg_cpu_hours`. `mean-of-jobs` when the statistic starts with `avg_`. Fixture: aggregate-jobs-by-resource (none); cpu-hours-by-resource-incomplete, average-leaves-gaps, label-stripped-from-description (codes in order).
23
+ 9. Warnings. A producer on this contract always emits `warnings`, an empty array when it has none; an absent `warnings` field means a pre-contract producer, and a client then applies its built-in warnings (`BUILT_IN_WARNINGS`). Each has a stable `code` and producer-worded `text`, and the order below is the order in the list. `waiting-not-counted` when the realm is Jobs and the last period is incomplete. `not-comparable-across-resources` when the dimension is `resource` and the statistic is `total_cpu_hours` or `avg_cpu_hours`. `mean-of-jobs` when the statistic starts with `avg_`. Fixture: aggregate-jobs-by-resource (none); cpu-hours-by-resource-incomplete, average-leaves-gaps, label-stripped-from-description, warnings-all-three (codes in order).
24
24
 
25
25
  10. Measure description. `measure.description` is the label-stripped plain text of XDMoD's description. Convert in this order. (a) Replace matches of the regex `(?<![.!?:;,])\s*<br\s*\/?>\s*` (case-insensitive, global) with ". ". The lookbehind is checked at the start of the match, so the punctuation must be the immediately preceding character with no whitespace between: `"a.<br>b"` has no match here, so the next step turns it into "a. b", but `"a. <br>b"` matches (the match starts at the space) and gives "a. . b", a doubled period. A port must copy the regex, not paraphrase it. (b) Replace every remaining `<br\s*\/?>` (case-insensitive) with a single space. (c) Remove every other tag, regex `<[^>]*>`. (d) Decode exactly six entities, in this order: `&nbsp;` to a space, `&lt;`, `&gt;`, `&quot;`, `&#39;`, and last `&amp;`. (e) Collapse runs of whitespace to one space and trim. (f) If the label is non-empty and the result starts with `<label>:` (case-insensitive, `label` being `measure.label`), remove that prefix and trim; an empty label is never stripped. Fixture: aggregate-jobs-by-resource (the "Number of Jobs Ended:" prefix is stripped); label-stripped-from-description (HTML converted).
26
26