@nexgen-os/core 0.4.2 → 0.5.1

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.
@@ -0,0 +1,605 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/nexgen-os/nexgen-os/blob/main/packages/core/schema/geojson-export.1.json",
4
+ "title": "Nexgen OS GeoJSON export, version 1",
5
+ "description": "The document `exportGeoJson()` of `@nexgen-os/core` writes: a participant, or a project and every participant taking part in it, as one RFC 7946 FeatureCollection — the places and the figures computed on them together, so that a study can be shown to the people it concerns. With `open: true` it is the document meant for the public (a citizens' portal, a consultation, an open-data catalogue, a publication): no street line, no serial number, no metadata, nothing from a source that may not be passed on. `importGeoJsonParticipants()` reads the participants of such a document back. A property is added to this schema in the same change that adds it to the export; a property renamed or removed is a version 2.",
6
+ "type": "object",
7
+ "required": [
8
+ "type",
9
+ "features",
10
+ "nexgen_os"
11
+ ],
12
+ "additionalProperties": false,
13
+ "properties": {
14
+ "type": {
15
+ "const": "FeatureCollection"
16
+ },
17
+ "bbox": {
18
+ "$ref": "#/$defs/bbox"
19
+ },
20
+ "features": {
21
+ "type": "array",
22
+ "items": {
23
+ "$ref": "#/$defs/feature"
24
+ }
25
+ },
26
+ "nexgen_os": {
27
+ "$ref": "#/$defs/about"
28
+ }
29
+ },
30
+ "$defs": {
31
+ "uuid": {
32
+ "type": "string",
33
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
34
+ },
35
+ "bbox": {
36
+ "type": "array",
37
+ "minItems": 4,
38
+ "items": {
39
+ "type": "number"
40
+ },
41
+ "description": "West, south, east, north — with the lowest and highest heights when the positions carry one: around every position of the collection (RFC 7946 §5)."
42
+ },
43
+ "feature": {
44
+ "type": "object",
45
+ "required": [
46
+ "type",
47
+ "id",
48
+ "geometry",
49
+ "properties"
50
+ ],
51
+ "additionalProperties": false,
52
+ "properties": {
53
+ "type": {
54
+ "const": "Feature"
55
+ },
56
+ "id": {
57
+ "$ref": "#/$defs/uuid",
58
+ "description": "The object's identifier in Nexgen OS."
59
+ },
60
+ "geometry": {
61
+ "$ref": "#/$defs/geometry"
62
+ },
63
+ "properties": {
64
+ "$ref": "#/$defs/properties"
65
+ }
66
+ }
67
+ },
68
+ "geometry": {
69
+ "type": [
70
+ "object",
71
+ "null"
72
+ ],
73
+ "description": "WGS 84 longitude, latitude and, when known, height in metres, seven decimals; outer rings counter-clockwise, holes clockwise (RFC 7946 §3.1.6). Null for a device (a device is not placed) and for an object described without a shape.",
74
+ "required": [
75
+ "type"
76
+ ],
77
+ "additionalProperties": false,
78
+ "properties": {
79
+ "type": {
80
+ "enum": [
81
+ "Point",
82
+ "MultiPoint",
83
+ "LineString",
84
+ "MultiLineString",
85
+ "Polygon",
86
+ "MultiPolygon",
87
+ "GeometryCollection"
88
+ ]
89
+ },
90
+ "coordinates": {
91
+ "type": "array"
92
+ },
93
+ "geometries": {
94
+ "type": "array",
95
+ "items": {
96
+ "$ref": "#/$defs/geometry"
97
+ }
98
+ },
99
+ "bbox": {
100
+ "$ref": "#/$defs/bbox"
101
+ }
102
+ }
103
+ },
104
+ "properties": {
105
+ "type": "object",
106
+ "description": "The columns of the object, named as the model names them, then what is attached to it. A property a kind of object does not have is absent, and a property an open export never carries is absent from it.",
107
+ "required": [
108
+ "kind",
109
+ "name",
110
+ "attributes",
111
+ "identifiers",
112
+ "calculations"
113
+ ],
114
+ "additionalProperties": false,
115
+ "properties": {
116
+ "kind": {
117
+ "enum": [
118
+ "project",
119
+ "participant",
120
+ "site",
121
+ "building",
122
+ "surface",
123
+ "device"
124
+ ],
125
+ "description": "Which object of the model the feature is: the project (first, when a project is exported), a participant, and — with the `building` module — its ground (`site`), its buildings and their surfaces; then the devices."
126
+ },
127
+ "name": {
128
+ "type": "string",
129
+ "description": "The object's name."
130
+ },
131
+ "attributes": {
132
+ "type": "object",
133
+ "description": "The attributes of the object holding at the export's moment (`nexgen_os.at`), as `attributes_of()` reads them: attribute type → value. An open export leaves out those a source that may not be passed on gave."
134
+ },
135
+ "identifiers": {
136
+ "type": "array",
137
+ "description": "The identifiers the object is known by elsewhere (a register, a meter point, a building identifier), scheme by scheme, holding at the export's moment. An open export leaves out those a source that may not be passed on gave.",
138
+ "items": {
139
+ "$ref": "#/$defs/identifier"
140
+ }
141
+ },
142
+ "calculations": {
143
+ "type": "array",
144
+ "description": "The figures the installed modules computed on the object, each as its module keeps it (`solar.estimates`, `community.settlements`…), oldest first. The export computes nothing; empty when the export was asked without them. An open export keeps them: a study shown to the public is its figures beside its places.",
145
+ "items": {
146
+ "$ref": "#/$defs/calculation"
147
+ }
148
+ },
149
+ "project_kind": {
150
+ "type": [
151
+ "string",
152
+ "null"
153
+ ],
154
+ "description": "project: its kind, a code of `project_kinds`."
155
+ },
156
+ "country": {
157
+ "type": [
158
+ "string",
159
+ "null"
160
+ ],
161
+ "description": "project, participant: the country, ISO 3166-1 alpha-2. A participant is a feature only when it has one."
162
+ },
163
+ "status": {
164
+ "type": [
165
+ "string",
166
+ "null"
167
+ ],
168
+ "description": "project, participant, building, device: its status, as the model keeps it."
169
+ },
170
+ "start_date": {
171
+ "type": [
172
+ "string",
173
+ "null"
174
+ ],
175
+ "description": "project: the day it starts.",
176
+ "format": "date"
177
+ },
178
+ "end_date": {
179
+ "type": [
180
+ "string",
181
+ "null"
182
+ ],
183
+ "description": "project: the day it ends.",
184
+ "format": "date"
185
+ },
186
+ "project_id": {
187
+ "type": [
188
+ "string",
189
+ "null"
190
+ ],
191
+ "description": "participant: the project it takes part in.",
192
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
193
+ },
194
+ "category": {
195
+ "type": [
196
+ "string",
197
+ "null"
198
+ ],
199
+ "description": "participant: its category (`consumer`, `producer`, `prosumer`…)."
200
+ },
201
+ "segment": {
202
+ "type": [
203
+ "string",
204
+ "null"
205
+ ],
206
+ "description": "participant: its segment, a code of `segments`."
207
+ },
208
+ "address_line1": {
209
+ "type": [
210
+ "string",
211
+ "null"
212
+ ],
213
+ "description": "participant: the street line of its address. Never in an open export."
214
+ },
215
+ "address_line2": {
216
+ "type": [
217
+ "string",
218
+ "null"
219
+ ],
220
+ "description": "participant: the second street line of its address. Never in an open export."
221
+ },
222
+ "postal_code": {
223
+ "type": [
224
+ "string",
225
+ "null"
226
+ ],
227
+ "description": "participant: the postal code of its address."
228
+ },
229
+ "city": {
230
+ "type": [
231
+ "string",
232
+ "null"
233
+ ],
234
+ "description": "participant: the city of its address."
235
+ },
236
+ "region": {
237
+ "type": [
238
+ "string",
239
+ "null"
240
+ ],
241
+ "description": "participant: the region of its address."
242
+ },
243
+ "municipality": {
244
+ "type": [
245
+ "string",
246
+ "null"
247
+ ],
248
+ "description": "participant: the code of its municipality, in the scheme of its country."
249
+ },
250
+ "time_zone": {
251
+ "type": [
252
+ "string",
253
+ "null"
254
+ ],
255
+ "description": "participant: its IANA time zone, which its daily readings follow."
256
+ },
257
+ "location_precision": {
258
+ "type": [
259
+ "string",
260
+ "null"
261
+ ],
262
+ "description": "participant: how precisely its geometry places it (a building, an address, a postal code, a municipality…)."
263
+ },
264
+ "location_source_code": {
265
+ "type": [
266
+ "string",
267
+ "null"
268
+ ],
269
+ "description": "participant: the source that placed it, a code of `nexgen_os.sources`. An open export keeps the address of a participant placed by a source that may not be passed on, and drops its geometry."
270
+ },
271
+ "participant_id": {
272
+ "type": [
273
+ "string",
274
+ "null"
275
+ ],
276
+ "description": "site, building, surface, device: the participant it belongs to.",
277
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
278
+ },
279
+ "site_id": {
280
+ "type": [
281
+ "string",
282
+ "null"
283
+ ],
284
+ "description": "building, surface: the ground it stands on.",
285
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
286
+ },
287
+ "building_id": {
288
+ "type": [
289
+ "string",
290
+ "null"
291
+ ],
292
+ "description": "surface: the building it is a face of; null for a ground area.",
293
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
294
+ },
295
+ "use": {
296
+ "type": [
297
+ "string",
298
+ "null"
299
+ ],
300
+ "description": "site, building: what it is used for."
301
+ },
302
+ "area_m2": {
303
+ "type": [
304
+ "number",
305
+ "null"
306
+ ],
307
+ "description": "site, surface: its area in square metres."
308
+ },
309
+ "elevation_m": {
310
+ "type": [
311
+ "number",
312
+ "null"
313
+ ],
314
+ "description": "building: the height of its ground above sea level, in metres."
315
+ },
316
+ "height_m": {
317
+ "type": [
318
+ "number",
319
+ "null"
320
+ ],
321
+ "description": "building: its height above its ground, in metres."
322
+ },
323
+ "year_built": {
324
+ "type": [
325
+ "integer",
326
+ "null"
327
+ ],
328
+ "description": "building: the year it was built."
329
+ },
330
+ "floors_above_ground": {
331
+ "type": [
332
+ "integer",
333
+ "null"
334
+ ],
335
+ "description": "building: its floors above ground."
336
+ },
337
+ "floors_below_ground": {
338
+ "type": [
339
+ "integer",
340
+ "null"
341
+ ],
342
+ "description": "building: its floors below ground."
343
+ },
344
+ "floor_area_m2": {
345
+ "type": [
346
+ "number",
347
+ "null"
348
+ ],
349
+ "description": "building: its floor area, in square metres."
350
+ },
351
+ "energy_label": {
352
+ "type": [
353
+ "string",
354
+ "null"
355
+ ],
356
+ "description": "building: its energy label, as its country writes it."
357
+ },
358
+ "surface_kind": {
359
+ "type": [
360
+ "string",
361
+ "null"
362
+ ],
363
+ "description": "surface: a roof face, a facade, a ground area…"
364
+ },
365
+ "azimuth_deg": {
366
+ "type": [
367
+ "number",
368
+ "null"
369
+ ],
370
+ "description": "surface: the direction it faces, in degrees clockwise from true north."
371
+ },
372
+ "tilt_deg": {
373
+ "type": [
374
+ "number",
375
+ "null"
376
+ ],
377
+ "description": "surface: its tilt from the horizontal, in degrees."
378
+ },
379
+ "material": {
380
+ "type": [
381
+ "string",
382
+ "null"
383
+ ],
384
+ "description": "surface: its material."
385
+ },
386
+ "u_value": {
387
+ "type": [
388
+ "number",
389
+ "null"
390
+ ],
391
+ "description": "surface: its thermal transmittance, in W/(m²·K)."
392
+ },
393
+ "is_external": {
394
+ "type": [
395
+ "boolean",
396
+ "null"
397
+ ],
398
+ "description": "surface: whether it faces the outside."
399
+ },
400
+ "global_id": {
401
+ "type": [
402
+ "string",
403
+ "null"
404
+ ],
405
+ "description": "site, building, surface: its identifier in the source it was read from (an IFC GlobalId, an OpenStreetMap way…)."
406
+ },
407
+ "source_code": {
408
+ "type": [
409
+ "string",
410
+ "null"
411
+ ],
412
+ "description": "site, building, surface, device: the source that described it, a code of `nexgen_os.sources`. An open export withholds an object described by a source that may not be passed on, with everything on it."
413
+ },
414
+ "metadata": {
415
+ "type": [
416
+ "object",
417
+ "null"
418
+ ],
419
+ "description": "site, building, surface: what its source said beyond the columns. Never in an open export."
420
+ },
421
+ "device_type": {
422
+ "type": [
423
+ "string",
424
+ "null"
425
+ ],
426
+ "description": "device: its type, a code of `device_types`."
427
+ },
428
+ "manufacturer": {
429
+ "type": [
430
+ "string",
431
+ "null"
432
+ ],
433
+ "description": "device: its manufacturer."
434
+ },
435
+ "model": {
436
+ "type": [
437
+ "string",
438
+ "null"
439
+ ],
440
+ "description": "device: its model."
441
+ },
442
+ "serial_number": {
443
+ "type": [
444
+ "string",
445
+ "null"
446
+ ],
447
+ "description": "device: its serial number. Never in an open export."
448
+ },
449
+ "rated_power_kw": {
450
+ "type": [
451
+ "number",
452
+ "null"
453
+ ],
454
+ "description": "device: its rated power, in kW."
455
+ },
456
+ "unit_count": {
457
+ "type": [
458
+ "integer",
459
+ "null"
460
+ ],
461
+ "description": "device: how many units it counts (modules of an array, points of a charging station…)."
462
+ },
463
+ "installation_date": {
464
+ "type": [
465
+ "string",
466
+ "null"
467
+ ],
468
+ "description": "device: the day it was installed.",
469
+ "format": "date"
470
+ }
471
+ }
472
+ },
473
+ "identifier": {
474
+ "type": "object",
475
+ "required": [
476
+ "scheme",
477
+ "value"
478
+ ],
479
+ "additionalProperties": false,
480
+ "properties": {
481
+ "scheme": {
482
+ "type": "string",
483
+ "description": "A code of `identifier_schemes`."
484
+ },
485
+ "value": {
486
+ "type": "string",
487
+ "description": "The identifier, as its scheme writes it."
488
+ }
489
+ }
490
+ },
491
+ "calculation": {
492
+ "type": "object",
493
+ "required": [
494
+ "id",
495
+ "module",
496
+ "table",
497
+ "provenance",
498
+ "updated_at",
499
+ "results"
500
+ ],
501
+ "additionalProperties": false,
502
+ "properties": {
503
+ "id": {
504
+ "$ref": "#/$defs/uuid"
505
+ },
506
+ "module": {
507
+ "type": "string",
508
+ "description": "The code of the module that keeps it."
509
+ },
510
+ "table": {
511
+ "type": "string",
512
+ "description": "The module's table it is kept in: `estimates`, `settlements`…"
513
+ },
514
+ "provenance": {
515
+ "type": "string",
516
+ "description": "Where it comes from: the program and the version that computed it."
517
+ },
518
+ "updated_at": {
519
+ "type": "string",
520
+ "description": "When the module last wrote it, ISO 8601 in UTC.",
521
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"
522
+ },
523
+ "results": {
524
+ "description": "The results, exactly as the module keeps them."
525
+ }
526
+ }
527
+ },
528
+ "about": {
529
+ "type": "object",
530
+ "description": "Foreign member: what the document is and what it owes. Nothing in it depends on the moment the export ran: the same database gives the same document.",
531
+ "required": [
532
+ "schema_version",
533
+ "at",
534
+ "open",
535
+ "sources",
536
+ "withheld"
537
+ ],
538
+ "additionalProperties": false,
539
+ "properties": {
540
+ "schema_version": {
541
+ "type": "string",
542
+ "description": "The version of the Nexgen OS schema the document was read from.",
543
+ "pattern": "^\\d+\\.\\d+\\.\\d+"
544
+ },
545
+ "at": {
546
+ "type": [
547
+ "string",
548
+ "null"
549
+ ],
550
+ "description": "The moment attributes and identifiers were read at, ISO 8601 in UTC; null for the moment of the export."
551
+ },
552
+ "open": {
553
+ "type": "boolean",
554
+ "description": "Whether this is the open export, meant for the public."
555
+ },
556
+ "sources": {
557
+ "type": "array",
558
+ "description": "Every source a feature, an attribute or an identifier of the document came from, with its licence and its attribution, by code.",
559
+ "items": {
560
+ "$ref": "#/$defs/source"
561
+ }
562
+ },
563
+ "withheld": {
564
+ "type": "integer",
565
+ "description": "How many objects an open export left out because their source, or the source of the object they belong to, may not be passed on.",
566
+ "minimum": 0
567
+ }
568
+ }
569
+ },
570
+ "source": {
571
+ "type": "object",
572
+ "required": [
573
+ "code",
574
+ "name",
575
+ "license",
576
+ "attribution"
577
+ ],
578
+ "additionalProperties": false,
579
+ "properties": {
580
+ "code": {
581
+ "type": "string",
582
+ "description": "The source's code in `sources`."
583
+ },
584
+ "name": {
585
+ "type": "string",
586
+ "description": "The source's name."
587
+ },
588
+ "license": {
589
+ "type": [
590
+ "string",
591
+ "null"
592
+ ],
593
+ "description": "Its licence, an SPDX identifier when there is one."
594
+ },
595
+ "attribution": {
596
+ "type": [
597
+ "string",
598
+ "null"
599
+ ],
600
+ "description": "The attribution it asks for, to show beside what it gave."
601
+ }
602
+ }
603
+ }
604
+ }
605
+ }