@golemio/energetics 1.12.1 → 1.12.2-dev.2727447026

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.
Files changed (90) hide show
  1. package/db/example/00_clear_test_data.sql +13 -0
  2. package/db/example/06_eno.sql +25 -0
  3. package/db/example/07_enapo_om_detail.sql +131 -0
  4. package/db/migrations/postgresql/20260729100000-enapo-gid-mapping-om-detail.js +53 -0
  5. package/db/migrations/postgresql/20260730120000-enapo-om-detail-porsenna.js +53 -0
  6. package/db/migrations/postgresql/sqls/20260729100000-enapo-gid-mapping-om-detail-down.sql +3 -0
  7. package/db/migrations/postgresql/sqls/20260729100000-enapo-gid-mapping-om-detail-up.sql +179 -0
  8. package/db/migrations/postgresql/sqls/20260730120000-enapo-om-detail-porsenna-down.sql +132 -0
  9. package/db/migrations/postgresql/sqls/20260730120000-enapo-om-detail-porsenna-up.sql +287 -0
  10. package/db/scripts/ded_gid_mapping_mock_import.sql +48 -0
  11. package/dist/output-gateway/constants/Links.d.ts +1 -0
  12. package/dist/output-gateway/constants/Links.js +2 -1
  13. package/dist/output-gateway/constants/Links.js.map +1 -1
  14. package/dist/output-gateway/controllers/v2/EnoBuildingsController.d.ts +11 -0
  15. package/dist/output-gateway/controllers/v2/EnoBuildingsController.js +53 -0
  16. package/dist/output-gateway/controllers/v2/EnoBuildingsController.js.map +1 -0
  17. package/dist/output-gateway/helpers/objectMappers.d.ts +10 -0
  18. package/dist/output-gateway/helpers/objectMappers.js +37 -0
  19. package/dist/output-gateway/helpers/objectMappers.js.map +1 -0
  20. package/dist/output-gateway/index.js +8 -1
  21. package/dist/output-gateway/index.js.map +1 -1
  22. package/dist/output-gateway/ioc/Di.js +9 -1
  23. package/dist/output-gateway/ioc/Di.js.map +1 -1
  24. package/dist/output-gateway/ioc/ModuleContainerToken.d.ts +4 -0
  25. package/dist/output-gateway/ioc/ModuleContainerToken.js +4 -0
  26. package/dist/output-gateway/ioc/ModuleContainerToken.js.map +1 -1
  27. package/dist/output-gateway/models/EnoBuildingDetailViewModel.d.ts +35 -0
  28. package/dist/output-gateway/models/EnoBuildingDetailViewModel.js +43 -0
  29. package/dist/output-gateway/models/EnoBuildingDetailViewModel.js.map +1 -0
  30. package/dist/output-gateway/models/EnoConsumptionPointViewModel.d.ts +105 -0
  31. package/dist/output-gateway/models/EnoConsumptionPointViewModel.js +118 -0
  32. package/dist/output-gateway/models/EnoConsumptionPointViewModel.js.map +1 -0
  33. package/dist/output-gateway/models/EnoPorsennaDeviceViewModel.d.ts +27 -0
  34. package/dist/output-gateway/models/EnoPorsennaDeviceViewModel.js +41 -0
  35. package/dist/output-gateway/models/EnoPorsennaDeviceViewModel.js.map +1 -0
  36. package/dist/output-gateway/models/interfaces/IEnoBuildingDetailView.d.ts +30 -0
  37. package/dist/output-gateway/models/interfaces/IEnoBuildingDetailView.js +3 -0
  38. package/dist/output-gateway/models/interfaces/IEnoBuildingDetailView.js.map +1 -0
  39. package/dist/output-gateway/models/interfaces/IEnoConsumptionPointView.d.ts +104 -0
  40. package/dist/output-gateway/models/interfaces/IEnoConsumptionPointView.js +3 -0
  41. package/dist/output-gateway/models/interfaces/IEnoConsumptionPointView.js.map +1 -0
  42. package/dist/output-gateway/models/interfaces/IEnoPorsennaDeviceView.d.ts +22 -0
  43. package/dist/output-gateway/models/interfaces/IEnoPorsennaDeviceView.js +3 -0
  44. package/dist/output-gateway/models/interfaces/IEnoPorsennaDeviceView.js.map +1 -0
  45. package/dist/output-gateway/repositories/AbstractNumericParsingRepository.d.ts +12 -0
  46. package/dist/output-gateway/repositories/AbstractNumericParsingRepository.js +41 -0
  47. package/dist/output-gateway/repositories/AbstractNumericParsingRepository.js.map +1 -0
  48. package/dist/output-gateway/repositories/EnoBuildingAddressesRepository.d.ts +8 -0
  49. package/dist/output-gateway/repositories/EnoBuildingAddressesRepository.js +62 -0
  50. package/dist/output-gateway/repositories/EnoBuildingAddressesRepository.js.map +1 -0
  51. package/dist/output-gateway/repositories/EnoBuildingDetailRepository.d.ts +18 -0
  52. package/dist/output-gateway/repositories/EnoBuildingDetailRepository.js +100 -0
  53. package/dist/output-gateway/repositories/EnoBuildingDetailRepository.js.map +1 -0
  54. package/dist/output-gateway/repositories/EnoConsumptionPointsRepository.d.ts +8 -0
  55. package/dist/output-gateway/repositories/EnoConsumptionPointsRepository.js +51 -0
  56. package/dist/output-gateway/repositories/EnoConsumptionPointsRepository.js.map +1 -0
  57. package/dist/output-gateway/repositories/EnoPorsennaDevicesRepository.d.ts +8 -0
  58. package/dist/output-gateway/repositories/EnoPorsennaDevicesRepository.js +51 -0
  59. package/dist/output-gateway/repositories/EnoPorsennaDevicesRepository.js.map +1 -0
  60. package/dist/output-gateway/repositories/PorsennaConsumptionsRepository.d.ts +8 -0
  61. package/dist/output-gateway/repositories/PorsennaConsumptionsRepository.js +52 -0
  62. package/dist/output-gateway/repositories/PorsennaConsumptionsRepository.js.map +1 -0
  63. package/dist/output-gateway/repositories/PpasInvoiceChildRepository.d.ts +13 -0
  64. package/dist/output-gateway/repositories/PpasInvoiceChildRepository.js +39 -0
  65. package/dist/output-gateway/repositories/PpasInvoiceChildRepository.js.map +1 -0
  66. package/dist/output-gateway/repositories/interfaces/IEnoBuildingDetailAggregate.d.ts +22 -0
  67. package/dist/output-gateway/repositories/interfaces/IEnoBuildingDetailAggregate.js +3 -0
  68. package/dist/output-gateway/repositories/interfaces/IEnoBuildingDetailAggregate.js.map +1 -0
  69. package/dist/output-gateway/routers/interfaces/IEnoBuildingDetailResponse.d.ts +106 -0
  70. package/dist/output-gateway/routers/interfaces/IEnoBuildingDetailResponse.js +3 -0
  71. package/dist/output-gateway/routers/interfaces/IEnoBuildingDetailResponse.js.map +1 -0
  72. package/dist/output-gateway/routers/v2/V2EnoBuildingsRouter.d.ts +9 -0
  73. package/dist/output-gateway/routers/v2/V2EnoBuildingsRouter.js +40 -0
  74. package/dist/output-gateway/routers/v2/V2EnoBuildingsRouter.js.map +1 -0
  75. package/dist/output-gateway/transformations/EnoBuildingDetailTransformation.d.ts +14 -0
  76. package/dist/output-gateway/transformations/EnoBuildingDetailTransformation.js +149 -0
  77. package/dist/output-gateway/transformations/EnoBuildingDetailTransformation.js.map +1 -0
  78. package/dist/schema-definitions/models/enapo/EnapoGidMappingModel.d.ts +17 -0
  79. package/dist/schema-definitions/models/enapo/EnapoGidMappingModel.js +63 -0
  80. package/dist/schema-definitions/models/enapo/EnapoGidMappingModel.js.map +1 -0
  81. package/dist/schema-definitions/models/enapo/interfaces/IEnapoGidMapping.d.ts +11 -0
  82. package/dist/schema-definitions/models/enapo/interfaces/IEnapoGidMapping.js +3 -0
  83. package/dist/schema-definitions/models/enapo/interfaces/IEnapoGidMapping.js.map +1 -0
  84. package/dist/schema-definitions/models/eno/AddressModel.d.ts +1 -1
  85. package/dist/schema-definitions/models/eno/AddressModel.js +1 -1
  86. package/dist/schema-definitions/models/eno/AddressModel.js.map +1 -1
  87. package/dist/schema-definitions/models/eno/interfaces/IAddress.d.ts +1 -1
  88. package/docs/implementation_documentation.md +41 -2
  89. package/docs/openapi-output.yaml +260 -1
  90. package/package.json +1 -1
@@ -15,7 +15,18 @@ servers:
15
15
  description: Main (production) server
16
16
  tags:
17
17
  - name: ⚡ Energetics (v2)
18
- description: 💡 Organizations & measurement devices
18
+ description: >-
19
+ 💡 Organizations & measurement devices — the original OICT Energetika data domain
20
+ (`organizations*` and `consumption_energy_*` tables). All endpoints in this group are
21
+ organization-scoped and require the internal `accessLimit` query parameter, which is set
22
+ by the permission proxy (never by the client).
23
+ - name: 🗺️ Energetics DeD (v2)
24
+ description: >-
25
+ 🏢 DeD — city-wide energy management overview for Prague buildings. A separate data
26
+ domain from ⚡ Energetics: ENO buildings, consumption points (OM), PRE/PPAS enrichment
27
+ and Porsenna e-manazer devices. Data is not organization-scoped, so these endpoints do
28
+ not use the `accessLimit` parameter at all — sending it (or any other unknown query
29
+ parameter) is rejected with HTTP 400.
19
30
  paths:
20
31
  /v2/energetics/buildings:
21
32
  get:
@@ -73,6 +84,55 @@ paths:
73
84
  schema:
74
85
  $ref: "#/components/schemas/EnergeticsBuildingFull"
75
86
 
87
+ /v2/energetics/ded/buildings/{gid}:
88
+ get:
89
+ tags:
90
+ - 🗺️ Energetics DeD (v2)
91
+ summary: ENO building detail with consumption points (OM) and technical parameters
92
+ description: >-
93
+ Returns the ENO building (eno_budova) identified by GID together with its addresses and all
94
+ consumption points mapped to it. Commodity-specific data is nested under the
95
+ `electricity`/`gas`/`heat`/`water` keys of each consumption point; only the key matching the
96
+ `commodity` field is present, the others are omitted entirely.
97
+
98
+ Consumption points come from two independent sources: the energobroker mapping (EAN/EIC,
99
+ enriched with PRE metadata and PPAS invoices) and Porsenna e-manazer devices
100
+ (`link_source: porsenna`) — heat and water meters, plus any EAN/EIC the mapping lacks.
101
+ An OM known to both sources is returned once, with the Porsenna data nested as a `porsenna`
102
+ sub-block (device, sub-meters, yearly consumption) inside its commodity block. Buildings
103
+ tracked in Porsenna also carry an `energy_management` summary.
104
+
105
+ The endpoint returns whatever data exists for the GID: if there is any building record,
106
+ address, or consumption point, the response is 200 with the missing parts as `null` or
107
+ empty arrays (e.g. `building: null` when only consumption points or addresses are known).
108
+ 404 is returned only when no source holds any data for the GID.
109
+ parameters:
110
+ - in: path
111
+ name: gid
112
+ required: true
113
+ schema:
114
+ type: string
115
+ example: GID100
116
+ responses:
117
+ "200":
118
+ description: OK
119
+ headers:
120
+ Cache-Control:
121
+ description: Cache control directive for caching proxies
122
+ schema:
123
+ type: string
124
+ example: public, s-maxage=21600, stale-while-revalidate=60
125
+ content:
126
+ application/json:
127
+ schema:
128
+ $ref: "#/components/schemas/EnergeticsEnoBuildingDetail"
129
+ "401":
130
+ $ref: "#/components/responses/UnauthorizedError"
131
+ "404":
132
+ $ref: "#/components/responses/NotFoundError"
133
+ "500":
134
+ $ref: "#/components/responses/ServerError"
135
+
76
136
  /v2/energetics/devices:
77
137
  get:
78
138
  tags:
@@ -445,6 +505,205 @@ components:
445
505
  type: string
446
506
 
447
507
  schemas:
508
+ EnergeticsEnoBuildingDetail:
509
+ type: object
510
+ properties:
511
+ gid:
512
+ type: string
513
+ example: GID100
514
+ building:
515
+ type: object
516
+ nullable: true
517
+ description: >-
518
+ All available eno_budova attributes (Czech identifiers mirror the upstream ENO source).
519
+ Null when the GID has no ENO building record and is known only through the
520
+ consumption-point mapping.
521
+ properties:
522
+ zdroj:
523
+ type: string
524
+ nullable: true
525
+ nazev:
526
+ type: string
527
+ nullable: true
528
+ oznaceni:
529
+ type: string
530
+ nullable: true
531
+ druh_vytapeni:
532
+ type: string
533
+ nullable: true
534
+ pripojka_elektro:
535
+ type: string
536
+ nullable: true
537
+ pripojka_voda:
538
+ type: string
539
+ nullable: true
540
+ pripojka_kanalizace:
541
+ type: string
542
+ nullable: true
543
+ additionalProperties: true
544
+ addresses:
545
+ type: array
546
+ items:
547
+ type: object
548
+ properties:
549
+ popis:
550
+ type: string
551
+ nullable: true
552
+ hlavni:
553
+ type: boolean
554
+ nullable: true
555
+ poradi:
556
+ type: number
557
+ energy_management:
558
+ type: object
559
+ nullable: true
560
+ description: Porsenna (e-manazer) tracking summary; null when the building is not tracked there
561
+ properties:
562
+ source:
563
+ type: string
564
+ example: porsenna_p7
565
+ building_name:
566
+ type: string
567
+ nullable: true
568
+ address:
569
+ type: string
570
+ nullable: true
571
+ devices_total:
572
+ type: number
573
+ devices_active:
574
+ type: number
575
+ consumption_points:
576
+ type: array
577
+ items:
578
+ $ref: "#/components/schemas/EnergeticsEnoConsumptionPoint"
579
+ EnergeticsEnoPorsennaBlock:
580
+ type: object
581
+ description: Porsenna (e-manazer) device detail with sub-meters and yearly consumption aggregates
582
+ properties:
583
+ device:
584
+ type: object
585
+ additionalProperties: true
586
+ sub_devices:
587
+ type: array
588
+ items:
589
+ type: object
590
+ additionalProperties: true
591
+ yearly_consumption:
592
+ type: array
593
+ items:
594
+ type: object
595
+ properties:
596
+ period:
597
+ type: string
598
+ example: "2024"
599
+ value:
600
+ type: number
601
+ unit:
602
+ type: string
603
+ example: GJ
604
+ days_covered:
605
+ type: number
606
+ nullable: true
607
+ EnergeticsEnoConsumptionPoint:
608
+ type: object
609
+ properties:
610
+ place_id:
611
+ type: string
612
+ example: 27ZG100Z0000192O
613
+ id_type:
614
+ type: string
615
+ enum: [ean, eic, om]
616
+ commodity:
617
+ type: string
618
+ enum: [electricity, gas, heat, water]
619
+ is_first_gid:
620
+ type: boolean
621
+ is_active:
622
+ type: boolean
623
+ description: Derived from valid_to (null or in the future means the mapping is active)
624
+ link_source:
625
+ type: string
626
+ example: mock
627
+ valid_from:
628
+ type: string
629
+ format: date
630
+ nullable: true
631
+ valid_to:
632
+ type: string
633
+ format: date
634
+ nullable: true
635
+ address:
636
+ type: string
637
+ nullable: true
638
+ description: Consumption point address from the best available source
639
+ electricity:
640
+ type: object
641
+ description: Electricity-specific data (present only for commodity = electricity, omitted otherwise)
642
+ properties:
643
+ metadata:
644
+ type: object
645
+ nullable: true
646
+ description: Latest available month of PRE metadata for the EAN
647
+ additionalProperties: true
648
+ porsenna:
649
+ $ref: "#/components/schemas/EnergeticsEnoPorsennaBlock"
650
+ gas:
651
+ type: object
652
+ description: Gas-specific data (present only for commodity = gas, omitted otherwise)
653
+ properties:
654
+ porsenna:
655
+ $ref: "#/components/schemas/EnergeticsEnoPorsennaBlock"
656
+ distribution:
657
+ type: object
658
+ nullable: true
659
+ description: Latest non-canceled PPAS distribution invoice with its devices and prices
660
+ properties:
661
+ invoice:
662
+ type: object
663
+ additionalProperties: true
664
+ devices:
665
+ type: array
666
+ items:
667
+ type: object
668
+ additionalProperties: true
669
+ prices:
670
+ type: array
671
+ items:
672
+ type: object
673
+ additionalProperties: true
674
+ commercial:
675
+ type: object
676
+ nullable: true
677
+ description: Latest non-canceled PPAS commercial invoice with its installation, devices and prices
678
+ properties:
679
+ invoice:
680
+ type: object
681
+ additionalProperties: true
682
+ installation:
683
+ type: object
684
+ additionalProperties: true
685
+ devices:
686
+ type: array
687
+ items:
688
+ type: object
689
+ additionalProperties: true
690
+ prices:
691
+ type: array
692
+ items:
693
+ type: object
694
+ additionalProperties: true
695
+ heat:
696
+ type: object
697
+ description: Heat-specific data (present only for commodity = heat, omitted otherwise; Porsenna-sourced)
698
+ properties:
699
+ porsenna:
700
+ $ref: "#/components/schemas/EnergeticsEnoPorsennaBlock"
701
+ water:
702
+ type: object
703
+ description: Water-specific data (present only for commodity = water, omitted otherwise; Porsenna-sourced)
704
+ properties:
705
+ porsenna:
706
+ $ref: "#/components/schemas/EnergeticsEnoPorsennaBlock"
448
707
  EnergeticsBuildingShort:
449
708
  type: object
450
709
  properties:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/energetics",
3
- "version": "1.12.1",
3
+ "version": "1.12.2-dev.2727447026",
4
4
  "description": "Golemio Energetics Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",