@golemio/energetics 1.12.2-dev.2740928370 → 1.12.2-dev.2741327856
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/db/example/00_clear_test_data.sql +19 -0
- package/db/example/06_eno.sql +36 -0
- package/db/example/07_enapo_om_detail.sql +140 -0
- package/db/example/08_ded_search.sql +25 -0
- package/db/migrations/postgresql/20260807090000-enapo-gid-mapping-om-detail.js +53 -0
- package/db/migrations/postgresql/20260807091000-enapo-om-detail-porsenna.js +53 -0
- package/db/migrations/postgresql/20260807092000-ded-building-search.js +53 -0
- package/db/migrations/postgresql/sqls/20260807090000-enapo-gid-mapping-om-detail-down.sql +3 -0
- package/db/migrations/postgresql/sqls/20260807090000-enapo-gid-mapping-om-detail-up.sql +182 -0
- package/db/migrations/postgresql/sqls/20260807091000-enapo-om-detail-porsenna-down.sql +135 -0
- package/db/migrations/postgresql/sqls/20260807091000-enapo-om-detail-porsenna-up.sql +292 -0
- package/db/migrations/postgresql/sqls/20260807092000-ded-building-search-down.sql +41 -0
- package/db/migrations/postgresql/sqls/20260807092000-ded-building-search-up.sql +262 -0
- package/db/scripts/ded_gid_mapping_mock_import.sql +107 -0
- package/dist/integration-engine/enapo/ioc/Di.js +5 -1
- package/dist/integration-engine/enapo/ioc/Di.js.map +1 -1
- package/dist/integration-engine/enapo/ioc/EnapoWorkerContainerToken.d.ts +2 -0
- package/dist/integration-engine/enapo/ioc/EnapoWorkerContainerToken.js +2 -0
- package/dist/integration-engine/enapo/ioc/EnapoWorkerContainerToken.js.map +1 -1
- package/dist/integration-engine/enapo/repositories/DedSearchIndexRepository.d.ts +7 -0
- package/dist/integration-engine/enapo/repositories/DedSearchIndexRepository.js +50 -0
- package/dist/integration-engine/enapo/repositories/DedSearchIndexRepository.js.map +1 -0
- package/dist/integration-engine/enapo/repositories/interfaces/IDedSearchIndexRepository.d.ts +7 -0
- package/dist/integration-engine/enapo/repositories/interfaces/IDedSearchIndexRepository.js +3 -0
- package/dist/integration-engine/enapo/repositories/interfaces/IDedSearchIndexRepository.js.map +1 -0
- package/dist/integration-engine/enapo/workers/EnapoWorker.js +1 -0
- package/dist/integration-engine/enapo/workers/EnapoWorker.js.map +1 -1
- package/dist/integration-engine/enapo/workers/task/DedSearchIndexRefreshTask.d.ts +21 -0
- package/dist/integration-engine/enapo/workers/task/DedSearchIndexRefreshTask.js +58 -0
- package/dist/integration-engine/enapo/workers/task/DedSearchIndexRefreshTask.js.map +1 -0
- package/dist/integration-engine/enapo/workers/task/EnoGeometryTask.d.ts +13 -1
- package/dist/integration-engine/enapo/workers/task/EnoGeometryTask.js +25 -2
- package/dist/integration-engine/enapo/workers/task/EnoGeometryTask.js.map +1 -1
- package/dist/output-gateway/constants/DedSearchWeights.d.ts +60 -0
- package/dist/output-gateway/constants/DedSearchWeights.js +42 -0
- package/dist/output-gateway/constants/DedSearchWeights.js.map +1 -0
- package/dist/output-gateway/constants/Links.d.ts +1 -0
- package/dist/output-gateway/constants/Links.js +2 -1
- package/dist/output-gateway/constants/Links.js.map +1 -1
- package/dist/output-gateway/controllers/v2/EnoBuildingsController.d.ts +16 -0
- package/dist/output-gateway/controllers/v2/EnoBuildingsController.js +80 -0
- package/dist/output-gateway/controllers/v2/EnoBuildingsController.js.map +1 -0
- package/dist/output-gateway/helpers/objectMappers.d.ts +10 -0
- package/dist/output-gateway/helpers/objectMappers.js +37 -0
- package/dist/output-gateway/helpers/objectMappers.js.map +1 -0
- package/dist/output-gateway/index.js +8 -1
- package/dist/output-gateway/index.js.map +1 -1
- package/dist/output-gateway/ioc/Di.js +13 -1
- package/dist/output-gateway/ioc/Di.js.map +1 -1
- package/dist/output-gateway/ioc/ModuleContainerToken.d.ts +6 -0
- package/dist/output-gateway/ioc/ModuleContainerToken.js +6 -0
- package/dist/output-gateway/ioc/ModuleContainerToken.js.map +1 -1
- package/dist/output-gateway/models/DedBuildingSearchViewModel.d.ts +30 -0
- package/dist/output-gateway/models/DedBuildingSearchViewModel.js +38 -0
- package/dist/output-gateway/models/DedBuildingSearchViewModel.js.map +1 -0
- package/dist/output-gateway/models/EnoBuildingDetailViewModel.d.ts +49 -0
- package/dist/output-gateway/models/EnoBuildingDetailViewModel.js +57 -0
- package/dist/output-gateway/models/EnoBuildingDetailViewModel.js.map +1 -0
- package/dist/output-gateway/models/EnoConsumptionPointViewModel.d.ts +106 -0
- package/dist/output-gateway/models/EnoConsumptionPointViewModel.js +119 -0
- package/dist/output-gateway/models/EnoConsumptionPointViewModel.js.map +1 -0
- package/dist/output-gateway/models/EnoPorsennaDeviceViewModel.d.ts +27 -0
- package/dist/output-gateway/models/EnoPorsennaDeviceViewModel.js +41 -0
- package/dist/output-gateway/models/EnoPorsennaDeviceViewModel.js.map +1 -0
- package/dist/output-gateway/models/interfaces/IDedBuildingSearchView.d.ts +24 -0
- package/dist/output-gateway/models/interfaces/IDedBuildingSearchView.js +3 -0
- package/dist/output-gateway/models/interfaces/IDedBuildingSearchView.js.map +1 -0
- package/dist/output-gateway/models/interfaces/IEnoBuildingDetailView.d.ts +44 -0
- package/dist/output-gateway/models/interfaces/IEnoBuildingDetailView.js +3 -0
- package/dist/output-gateway/models/interfaces/IEnoBuildingDetailView.js.map +1 -0
- package/dist/output-gateway/models/interfaces/IEnoConsumptionPointView.d.ts +106 -0
- package/dist/output-gateway/models/interfaces/IEnoConsumptionPointView.js +3 -0
- package/dist/output-gateway/models/interfaces/IEnoConsumptionPointView.js.map +1 -0
- package/dist/output-gateway/models/interfaces/IEnoPorsennaDeviceView.d.ts +22 -0
- package/dist/output-gateway/models/interfaces/IEnoPorsennaDeviceView.js +3 -0
- package/dist/output-gateway/models/interfaces/IEnoPorsennaDeviceView.js.map +1 -0
- package/dist/output-gateway/repositories/AbstractNumericParsingRepository.d.ts +12 -0
- package/dist/output-gateway/repositories/AbstractNumericParsingRepository.js +41 -0
- package/dist/output-gateway/repositories/AbstractNumericParsingRepository.js.map +1 -0
- package/dist/output-gateway/repositories/DedBuildingSearchRepository.d.ts +16 -0
- package/dist/output-gateway/repositories/DedBuildingSearchRepository.js +250 -0
- package/dist/output-gateway/repositories/DedBuildingSearchRepository.js.map +1 -0
- package/dist/output-gateway/repositories/EnoBuildingAddressesRepository.d.ts +8 -0
- package/dist/output-gateway/repositories/EnoBuildingAddressesRepository.js +62 -0
- package/dist/output-gateway/repositories/EnoBuildingAddressesRepository.js.map +1 -0
- package/dist/output-gateway/repositories/EnoBuildingDetailRepository.d.ts +18 -0
- package/dist/output-gateway/repositories/EnoBuildingDetailRepository.js +100 -0
- package/dist/output-gateway/repositories/EnoBuildingDetailRepository.js.map +1 -0
- package/dist/output-gateway/repositories/EnoConsumptionPointsRepository.d.ts +8 -0
- package/dist/output-gateway/repositories/EnoConsumptionPointsRepository.js +51 -0
- package/dist/output-gateway/repositories/EnoConsumptionPointsRepository.js.map +1 -0
- package/dist/output-gateway/repositories/EnoPorsennaDevicesRepository.d.ts +8 -0
- package/dist/output-gateway/repositories/EnoPorsennaDevicesRepository.js +51 -0
- package/dist/output-gateway/repositories/EnoPorsennaDevicesRepository.js.map +1 -0
- package/dist/output-gateway/repositories/PorsennaConsumptionsRepository.d.ts +8 -0
- package/dist/output-gateway/repositories/PorsennaConsumptionsRepository.js +52 -0
- package/dist/output-gateway/repositories/PorsennaConsumptionsRepository.js.map +1 -0
- package/dist/output-gateway/repositories/PpasInvoiceChildRepository.d.ts +13 -0
- package/dist/output-gateway/repositories/PpasInvoiceChildRepository.js +39 -0
- package/dist/output-gateway/repositories/PpasInvoiceChildRepository.js.map +1 -0
- package/dist/output-gateway/repositories/interfaces/IDedBuildingSearchRow.d.ts +14 -0
- package/dist/output-gateway/repositories/interfaces/IDedBuildingSearchRow.js +3 -0
- package/dist/output-gateway/repositories/interfaces/IDedBuildingSearchRow.js.map +1 -0
- package/dist/output-gateway/repositories/interfaces/IEnoBuildingDetailAggregate.d.ts +22 -0
- package/dist/output-gateway/repositories/interfaces/IEnoBuildingDetailAggregate.js +3 -0
- package/dist/output-gateway/repositories/interfaces/IEnoBuildingDetailAggregate.js.map +1 -0
- package/dist/output-gateway/routers/interfaces/IDedBuildingSearchResponse.d.ts +50 -0
- package/dist/output-gateway/routers/interfaces/IDedBuildingSearchResponse.js +3 -0
- package/dist/output-gateway/routers/interfaces/IDedBuildingSearchResponse.js.map +1 -0
- package/dist/output-gateway/routers/interfaces/IEnoBuildingDetailResponse.d.ts +130 -0
- package/dist/output-gateway/routers/interfaces/IEnoBuildingDetailResponse.js +3 -0
- package/dist/output-gateway/routers/interfaces/IEnoBuildingDetailResponse.js.map +1 -0
- package/dist/output-gateway/routers/interfaces/IEnoRegistrationUnit.d.ts +11 -0
- package/dist/output-gateway/routers/interfaces/IEnoRegistrationUnit.js +3 -0
- package/dist/output-gateway/routers/interfaces/IEnoRegistrationUnit.js.map +1 -0
- package/dist/output-gateway/routers/v2/V2EnoBuildingsRouter.d.ts +11 -0
- package/dist/output-gateway/routers/v2/V2EnoBuildingsRouter.js +45 -0
- package/dist/output-gateway/routers/v2/V2EnoBuildingsRouter.js.map +1 -0
- package/dist/output-gateway/transformations/DedBuildingSearchTransformation.d.ts +11 -0
- package/dist/output-gateway/transformations/DedBuildingSearchTransformation.js +57 -0
- package/dist/output-gateway/transformations/DedBuildingSearchTransformation.js.map +1 -0
- package/dist/output-gateway/transformations/EnoBuildingDetailTransformation.d.ts +18 -0
- package/dist/output-gateway/transformations/EnoBuildingDetailTransformation.js +193 -0
- package/dist/output-gateway/transformations/EnoBuildingDetailTransformation.js.map +1 -0
- package/dist/schema-definitions/models/enapo/EnapoGidMappingModel.d.ts +17 -0
- package/dist/schema-definitions/models/enapo/EnapoGidMappingModel.js +63 -0
- package/dist/schema-definitions/models/enapo/EnapoGidMappingModel.js.map +1 -0
- package/dist/schema-definitions/models/enapo/interfaces/IEnapoGidMapping.d.ts +11 -0
- package/dist/schema-definitions/models/enapo/interfaces/IEnapoGidMapping.js +3 -0
- package/dist/schema-definitions/models/enapo/interfaces/IEnapoGidMapping.js.map +1 -0
- package/dist/schema-definitions/models/eno/AddressModel.d.ts +1 -1
- package/dist/schema-definitions/models/eno/AddressModel.js +1 -1
- package/dist/schema-definitions/models/eno/AddressModel.js.map +1 -1
- package/dist/schema-definitions/models/eno/interfaces/IAddress.d.ts +1 -1
- package/docs/implementation_documentation.md +90 -2
- package/docs/openapi-output.yaml +554 -1
- package/package.json +1 -1
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
-- Trigram matching for the fuzzy part of the search. IF NOT EXISTS keeps the migration re-runnable
|
|
2
|
+
-- on environments that already have it; note it does NOT relocate an installation sitting in another
|
|
3
|
+
-- schema - the index definitions below reference public.gist_trgm_ops, so if the extension lives
|
|
4
|
+
-- elsewhere, move it first with ALTER EXTENSION pg_trgm SET SCHEMA public.
|
|
5
|
+
CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;
|
|
6
|
+
CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
|
|
7
|
+
|
|
8
|
+
-- Text is normalised with lower(public.unaccent(...)) so that searching without Czech diacritics
|
|
9
|
+
-- works. The same expression is applied to the incoming query in the search repository - keep the
|
|
10
|
+
-- two in sync, otherwise the normalised columns stop matching what is searched for.
|
|
11
|
+
-- unaccent is STABLE rather than IMMUTABLE, which is fine here: the normalised text is stored as
|
|
12
|
+
-- real columns of the materialized view and the trigram indexes are built on those columns, not on
|
|
13
|
+
-- an expression.
|
|
14
|
+
|
|
15
|
+
-- ENO geometry is stored as WKT text with a per-row EPSG code (S-JTSK 5514 by default).
|
|
16
|
+
-- Malformed WKT would abort the whole REFRESH, so the conversion returns NULL instead of raising.
|
|
17
|
+
CREATE OR REPLACE FUNCTION f_ded_safe_geom(wkt text, epsg varchar)
|
|
18
|
+
RETURNS public.geometry
|
|
19
|
+
LANGUAGE plpgsql
|
|
20
|
+
IMMUTABLE
|
|
21
|
+
PARALLEL SAFE
|
|
22
|
+
AS $$
|
|
23
|
+
BEGIN
|
|
24
|
+
RETURN public.ST_Transform(
|
|
25
|
+
public.ST_SetSRID(public.ST_GeomFromText(wkt), COALESCE(NULLIF(epsg, '')::int, 5514)),
|
|
26
|
+
4326
|
|
27
|
+
);
|
|
28
|
+
EXCEPTION WHEN OTHERS THEN
|
|
29
|
+
RETURN NULL;
|
|
30
|
+
END;
|
|
31
|
+
$$;
|
|
32
|
+
|
|
33
|
+
COMMENT ON FUNCTION f_ded_safe_geom(text, varchar) IS
|
|
34
|
+
'Converts an eno_geometrie WKT polygon to EPSG:4326, returning NULL for unparsable geometry instead of raising (a single bad row must not abort the search index refresh).';
|
|
35
|
+
|
|
36
|
+
-- Building detail view, expanded with the ENO lookups (eno_ciselnik_*) resolved through eno_majetek:
|
|
37
|
+
-- the evidenční jednotka and both správci (mandate and accounting-unit). Kept as one row per building
|
|
38
|
+
-- GID via DISTINCT ON; the mv_ded_building_search below depends on this view, so it must be defined first.
|
|
39
|
+
--
|
|
40
|
+
-- The LATERALs pick the latest row by platnost_od and deliberately do NOT filter on aktivni: every
|
|
41
|
+
-- existing ENO repository in this module reads these lookups the same way, and the endpoint has to keep
|
|
42
|
+
-- reporting the správce/evidenční jednotka a building was last assigned to even after that lookup row is
|
|
43
|
+
-- deactivated. If the ENO data contract ever says a deactivated row must disappear from the detail, the
|
|
44
|
+
-- filter belongs in all ENO consumers at once, not only here.
|
|
45
|
+
CREATE OR REPLACE VIEW v_enapo_building_detail AS
|
|
46
|
+
SELECT DISTINCT ON (b.gid)
|
|
47
|
+
b.gid,
|
|
48
|
+
b.zdroj,
|
|
49
|
+
b.nazev,
|
|
50
|
+
b.oznaceni,
|
|
51
|
+
b.druh_vytapeni,
|
|
52
|
+
b.pripojka_elektro,
|
|
53
|
+
b.pripojka_voda,
|
|
54
|
+
b.pripojka_kanalizace,
|
|
55
|
+
b.budova_rozdelena_byt_nebyt,
|
|
56
|
+
b.celkova_plocha_budova,
|
|
57
|
+
b.celkova_plocha_byt_budova,
|
|
58
|
+
b.celkova_plocha_nebyt_budova,
|
|
59
|
+
b.zastavena_plocha,
|
|
60
|
+
b.obestaveny_prostor,
|
|
61
|
+
b.pocet_byt,
|
|
62
|
+
b.pocet_nebyt_budova,
|
|
63
|
+
b.pocet_nadzem_podlazi,
|
|
64
|
+
b.pocet_podzem_podlazi,
|
|
65
|
+
b.pocet_podkrovi,
|
|
66
|
+
b.vytah,
|
|
67
|
+
b.czcc,
|
|
68
|
+
b.id_cuzk,
|
|
69
|
+
b.id_objekt,
|
|
70
|
+
b.kod_vyuziti,
|
|
71
|
+
b.nazev_vyuziti,
|
|
72
|
+
b.kod_ochrana,
|
|
73
|
+
b.nazev_ochrana,
|
|
74
|
+
b.platnost_od,
|
|
75
|
+
ej.ej_id,
|
|
76
|
+
ej.ej_kod,
|
|
77
|
+
ej.ej_nazev,
|
|
78
|
+
ej.ej_typ,
|
|
79
|
+
spm.sp_id AS spm_id,
|
|
80
|
+
spm.sp_kod AS spm_kod,
|
|
81
|
+
spm.sp_nazev AS spm_nazev,
|
|
82
|
+
spm.sp_ic AS spm_ic,
|
|
83
|
+
spm.sp_dic AS spm_dic,
|
|
84
|
+
spu.sp_id AS spu_id,
|
|
85
|
+
spu.sp_kod AS spu_kod,
|
|
86
|
+
spu.sp_nazev AS spu_nazev,
|
|
87
|
+
spu.sp_ic AS spu_ic,
|
|
88
|
+
spu.sp_dic AS spu_dic
|
|
89
|
+
FROM eno_budova b
|
|
90
|
+
LEFT JOIN eno_majetek m
|
|
91
|
+
ON m.gid = b.gid
|
|
92
|
+
AND m.gid_typ = 'budova'
|
|
93
|
+
AND m.zdroj = b.zdroj
|
|
94
|
+
LEFT JOIN LATERAL (
|
|
95
|
+
SELECT
|
|
96
|
+
e.id AS ej_id,
|
|
97
|
+
e.kod AS ej_kod,
|
|
98
|
+
e.nazev AS ej_nazev,
|
|
99
|
+
e.typ AS ej_typ
|
|
100
|
+
FROM eno_ciselnik_evidencni_jednotka e
|
|
101
|
+
WHERE e.id = m.id_maj_evidencni_jednotka
|
|
102
|
+
ORDER BY e.platnost_od DESC NULLS LAST
|
|
103
|
+
LIMIT 1
|
|
104
|
+
) ej ON true
|
|
105
|
+
LEFT JOIN LATERAL (
|
|
106
|
+
SELECT
|
|
107
|
+
s.id_maj_spravce AS sp_id,
|
|
108
|
+
s.kod AS sp_kod,
|
|
109
|
+
s.nazev AS sp_nazev,
|
|
110
|
+
s.ic AS sp_ic,
|
|
111
|
+
s.dic AS sp_dic
|
|
112
|
+
FROM eno_ciselnik_spravce s
|
|
113
|
+
WHERE s.id_maj_spravce = m.id_maj_spravce_mandatni
|
|
114
|
+
ORDER BY s.platnost_od DESC NULLS LAST
|
|
115
|
+
LIMIT 1
|
|
116
|
+
) spm ON true
|
|
117
|
+
LEFT JOIN LATERAL (
|
|
118
|
+
SELECT
|
|
119
|
+
s.id_maj_spravce AS sp_id,
|
|
120
|
+
s.kod AS sp_kod,
|
|
121
|
+
s.nazev AS sp_nazev,
|
|
122
|
+
s.ic AS sp_ic,
|
|
123
|
+
s.dic AS sp_dic
|
|
124
|
+
FROM eno_ciselnik_spravce s
|
|
125
|
+
WHERE s.id_maj_spravce = m.id_maj_spravce_ucet_jednotka
|
|
126
|
+
ORDER BY s.platnost_od DESC NULLS LAST
|
|
127
|
+
LIMIT 1
|
|
128
|
+
) spu ON true
|
|
129
|
+
ORDER BY b.gid, b.zdroj;
|
|
130
|
+
|
|
131
|
+
-- One row per building GID, precomputed for the DeD search endpoint.
|
|
132
|
+
-- Materialized because v_enapo_building_consumption_points carries three LEFT JOIN LATERALs plus a
|
|
133
|
+
-- UNION ALL branch per point and the geometry needs a PostGIS transform - too much to recompute on
|
|
134
|
+
-- every keystroke of an autocomplete.
|
|
135
|
+
-- Scope: buildings only (eno_budova / gid_typ = 'budova'), eno_stavba is deliberately not covered.
|
|
136
|
+
CREATE MATERIALIZED VIEW mv_ded_building_search AS
|
|
137
|
+
WITH searchable_gid AS (
|
|
138
|
+
SELECT gid FROM v_enapo_building_detail
|
|
139
|
+
UNION
|
|
140
|
+
SELECT gid FROM enapo_gid_mapping
|
|
141
|
+
UNION
|
|
142
|
+
SELECT gid FROM v_enapo_building_porsenna_devices
|
|
143
|
+
),
|
|
144
|
+
active_gid AS (
|
|
145
|
+
SELECT g.gid
|
|
146
|
+
FROM searchable_gid g
|
|
147
|
+
WHERE NOT EXISTS (
|
|
148
|
+
SELECT 1
|
|
149
|
+
FROM eno_vyrazeno v
|
|
150
|
+
WHERE v.gid = g.gid AND v.gid_typ = 'budova'
|
|
151
|
+
)
|
|
152
|
+
),
|
|
153
|
+
building_address AS (
|
|
154
|
+
SELECT
|
|
155
|
+
a.gid,
|
|
156
|
+
array_agg(a.popis::text ORDER BY a.hlavni DESC NULLS LAST, a.poradi ASC) AS addresses
|
|
157
|
+
FROM (
|
|
158
|
+
SELECT DISTINCT ON (gid, popis) gid, popis, hlavni, poradi
|
|
159
|
+
FROM eno_adresa
|
|
160
|
+
WHERE gid_typ = 'budova' AND popis IS NOT NULL
|
|
161
|
+
ORDER BY gid, popis, hlavni DESC NULLS LAST, poradi ASC
|
|
162
|
+
) a
|
|
163
|
+
GROUP BY a.gid
|
|
164
|
+
),
|
|
165
|
+
building_point AS (
|
|
166
|
+
SELECT
|
|
167
|
+
gid,
|
|
168
|
+
COALESCE(array_agg(DISTINCT place_id::text ORDER BY place_id::text) FILTER (WHERE id_type = 'ean'), '{}'::text[]) AS ean,
|
|
169
|
+
COALESCE(array_agg(DISTINCT place_id::text ORDER BY place_id::text) FILTER (WHERE id_type = 'eic'), '{}'::text[]) AS eic,
|
|
170
|
+
COALESCE(array_agg(DISTINCT place_id::text ORDER BY place_id::text) FILTER (WHERE id_type = 'om'), '{}'::text[]) AS om,
|
|
171
|
+
count(*) FILTER (WHERE is_active) AS active_points_count
|
|
172
|
+
FROM v_enapo_building_consumption_points
|
|
173
|
+
GROUP BY gid
|
|
174
|
+
),
|
|
175
|
+
building_geometry AS (
|
|
176
|
+
SELECT
|
|
177
|
+
gid,
|
|
178
|
+
public.ST_Multi(public.ST_Collect(f_ded_safe_geom(zakres, epsg_code))) AS geom
|
|
179
|
+
FROM eno_geometrie
|
|
180
|
+
WHERE zakres IS NOT NULL
|
|
181
|
+
GROUP BY gid
|
|
182
|
+
)
|
|
183
|
+
SELECT
|
|
184
|
+
g.gid::text AS gid,
|
|
185
|
+
b.nazev::text AS nazev,
|
|
186
|
+
b.oznaceni::text AS oznaceni,
|
|
187
|
+
-- The whole evidenční jednotka is carried so the search response can use the same shape as the
|
|
188
|
+
-- building detail endpoint (id / kod / nazev / typ) instead of a narrower look-alike.
|
|
189
|
+
b.ej_id AS ej_id,
|
|
190
|
+
b.ej_kod::text AS ej_kod,
|
|
191
|
+
b.ej_nazev::text AS ej_nazev,
|
|
192
|
+
b.ej_typ::text AS ej_typ,
|
|
193
|
+
a.addresses[1] AS address_main,
|
|
194
|
+
COALESCE(a.addresses, '{}'::text[]) AS addresses,
|
|
195
|
+
COALESCE(p.ean, '{}'::text[]) AS ean,
|
|
196
|
+
COALESCE(p.eic, '{}'::text[]) AS eic,
|
|
197
|
+
COALESCE(p.om, '{}'::text[]) AS om,
|
|
198
|
+
COALESCE(p.active_points_count, 0) AS active_points_count,
|
|
199
|
+
(b.gid IS NOT NULL) AS has_building_record,
|
|
200
|
+
lower(public.unaccent(concat_ws(' ', b.nazev, b.oznaceni))) AS name_norm,
|
|
201
|
+
lower(public.unaccent(COALESCE(array_to_string(a.addresses, ' '), ''))) AS address_norm,
|
|
202
|
+
(
|
|
203
|
+
setweight(to_tsvector('simple', lower(public.unaccent(concat_ws(' ', b.nazev, b.oznaceni, b.ej_nazev)))), 'A') ||
|
|
204
|
+
setweight(to_tsvector('simple', lower(public.unaccent(COALESCE(a.addresses[1], '')))), 'B') ||
|
|
205
|
+
setweight(to_tsvector('simple', lower(public.unaccent(COALESCE(array_to_string(a.addresses[2:], ' '), '')))), 'C') ||
|
|
206
|
+
setweight(
|
|
207
|
+
to_tsvector(
|
|
208
|
+
'simple',
|
|
209
|
+
lower(concat_ws(' ', array_to_string(COALESCE(p.ean, '{}') || COALESCE(p.eic, '{}') || COALESCE(p.om, '{}'), ' '), g.gid, b.ej_kod))
|
|
210
|
+
),
|
|
211
|
+
'D'
|
|
212
|
+
)
|
|
213
|
+
) AS search_document,
|
|
214
|
+
geo.geom
|
|
215
|
+
FROM active_gid g
|
|
216
|
+
LEFT JOIN v_enapo_building_detail b ON b.gid = g.gid
|
|
217
|
+
LEFT JOIN building_address a ON a.gid = g.gid
|
|
218
|
+
LEFT JOIN building_point p ON p.gid = g.gid
|
|
219
|
+
LEFT JOIN building_geometry geo ON geo.gid = g.gid;
|
|
220
|
+
|
|
221
|
+
COMMENT ON MATERIALIZED VIEW mv_ded_building_search IS
|
|
222
|
+
'Search index for the DeD building search endpoint - one row per building GID with the weighted tsvector, normalised name/address for trigram matching, EAN/EIC/OM identifiers for exact matching and the building geometry in EPSG:4326. Refreshed by the DedSearchIndexRefreshTask (integration engine).';
|
|
223
|
+
|
|
224
|
+
-- The internal_ prefix the DB conventions mandate for generated columns is a rule about tables: every
|
|
225
|
+
-- column of this object is derived, so prefixing all of them would carry no information and would break
|
|
226
|
+
-- the shared naming with v_enapo_building_detail. The intent behind the rule - being able to tell how a
|
|
227
|
+
-- value was produced - is met with a per-column comment on each computed column instead.
|
|
228
|
+
COMMENT ON COLUMN mv_ded_building_search.addresses IS
|
|
229
|
+
'Distinct eno_adresa.popis of the building (gid_typ = ''budova''), ordered main address first, then by poradi.';
|
|
230
|
+
COMMENT ON COLUMN mv_ded_building_search.address_main IS 'First element of addresses, i.e. the main address.';
|
|
231
|
+
COMMENT ON COLUMN mv_ded_building_search.ean IS
|
|
232
|
+
'Distinct EAN identifiers of the building consumption points (v_enapo_building_consumption_points, id_type = ''ean'').';
|
|
233
|
+
COMMENT ON COLUMN mv_ded_building_search.eic IS
|
|
234
|
+
'Distinct EIC identifiers of the building consumption points (v_enapo_building_consumption_points, id_type = ''eic'').';
|
|
235
|
+
COMMENT ON COLUMN mv_ded_building_search.om IS
|
|
236
|
+
'Distinct OM identifiers of the building consumption points (v_enapo_building_consumption_points, id_type = ''om'').';
|
|
237
|
+
COMMENT ON COLUMN mv_ded_building_search.active_points_count IS
|
|
238
|
+
'Number of consumption points of the building flagged is_active in v_enapo_building_consumption_points.';
|
|
239
|
+
COMMENT ON COLUMN mv_ded_building_search.has_building_record IS
|
|
240
|
+
'False when the GID reached the index only through enapo_gid_mapping or Porsenna and has no eno_budova record.';
|
|
241
|
+
COMMENT ON COLUMN mv_ded_building_search.name_norm IS
|
|
242
|
+
'lower(public.unaccent(nazev || '' '' || oznaceni)); the trigram column matched against the equally normalised query.';
|
|
243
|
+
COMMENT ON COLUMN mv_ded_building_search.address_norm IS
|
|
244
|
+
'lower(public.unaccent(...)) over all addresses joined by a space; the trigram column for address matching.';
|
|
245
|
+
COMMENT ON COLUMN mv_ded_building_search.search_document IS
|
|
246
|
+
'Weighted tsvector: A = nazev + oznaceni + evidenční jednotka name, B = main address, C = secondary addresses, D = EAN/EIC/OM + gid + evidenční jednotka code.';
|
|
247
|
+
COMMENT ON COLUMN mv_ded_building_search.geom IS
|
|
248
|
+
'eno_geometrie.zakres polygons of the GID collected into one MultiPolygon and transformed to EPSG:4326 by f_ded_safe_geom; NULL when no polygon is parsable.';
|
|
249
|
+
|
|
250
|
+
-- Required by REFRESH MATERIALIZED VIEW CONCURRENTLY.
|
|
251
|
+
CREATE UNIQUE INDEX mv_ded_building_search_gid_uidx ON mv_ded_building_search (gid);
|
|
252
|
+
|
|
253
|
+
CREATE INDEX mv_ded_building_search_document_gin ON mv_ded_building_search USING gin (search_document);
|
|
254
|
+
|
|
255
|
+
-- GiST rather than GIN on the trigram columns: only GiST supports the <-> distance operator used by
|
|
256
|
+
-- the nearest-neighbour candidate generator.
|
|
257
|
+
CREATE INDEX mv_ded_building_search_name_trgm ON mv_ded_building_search USING gist (name_norm public.gist_trgm_ops);
|
|
258
|
+
CREATE INDEX mv_ded_building_search_address_trgm ON mv_ded_building_search USING gist (address_norm public.gist_trgm_ops);
|
|
259
|
+
|
|
260
|
+
CREATE INDEX mv_ded_building_search_ean_gin ON mv_ded_building_search USING gin (ean);
|
|
261
|
+
CREATE INDEX mv_ded_building_search_eic_gin ON mv_ded_building_search USING gin (eic);
|
|
262
|
+
CREATE INDEX mv_ded_building_search_om_gin ON mv_ded_building_search USING gin (om);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
-- Copies the data-team dbt output (ded_gid_mapping) into the module-owned mock table
|
|
2
|
+
-- energetics.enapo_gid_mapping.
|
|
3
|
+
--
|
|
4
|
+
-- Source table location differs per environment:
|
|
5
|
+
-- - rabin: analytic_dbt.ded_gid_mapping (used below)
|
|
6
|
+
-- - golem: tmp.ded_gid_mapping (replace the schema in the FROM clause)
|
|
7
|
+
--
|
|
8
|
+
-- Notes:
|
|
9
|
+
-- - Full refresh of mock rows only: rows are inserted with link_source = 'mock', so this
|
|
10
|
+
-- script can be re-run any time and never touches future non-mock (sync task) rows.
|
|
11
|
+
-- - The dbt table has no primary key; DISTINCT ON collapses duplicates per (place_id, gid),
|
|
12
|
+
-- preferring an active mapping (valid_to IS NULL) and then the newest valid_from.
|
|
13
|
+
-- - id_type / commodity are resolved from each other so a row survives when only one of the
|
|
14
|
+
-- two columns is filled: an explicit value wins, the other column is the fallback.
|
|
15
|
+
-- commodity uses EB codes ('1' -> electricity, '2' -> gas) as well as the DeD names.
|
|
16
|
+
-- Because the two are resolved independently, a source row filling both with values that
|
|
17
|
+
-- disagree (id_type = 'eic' with commodity = 'electricity') would otherwise be written as an
|
|
18
|
+
-- impossible pair. EAN is always electricity and EIC always gas, so such rows are skipped -
|
|
19
|
+
-- the same invariant must hold when the dbt sync task takes this logic over.
|
|
20
|
+
-- - valid_to = 1900-01-01 is the EB placeholder for "not canceled" and is converted to NULL
|
|
21
|
+
-- (dbt should already do this — the NULLIF is a defensive guard).
|
|
22
|
+
-- - place_id is capped at 50 chars by the target column; longer values are skipped rather
|
|
23
|
+
-- than letting the whole insert fail on a string-truncation error.
|
|
24
|
+
--
|
|
25
|
+
-- Run the pre-flight query in the comment at the bottom first to see what would be skipped.
|
|
26
|
+
|
|
27
|
+
BEGIN;
|
|
28
|
+
|
|
29
|
+
DELETE FROM energetics.enapo_gid_mapping WHERE link_source = 'mock';
|
|
30
|
+
|
|
31
|
+
WITH src AS (
|
|
32
|
+
SELECT
|
|
33
|
+
trim(s.place_id) AS place_id,
|
|
34
|
+
trim(s.gid) AS gid,
|
|
35
|
+
lower(trim(s.commodity)) AS commodity_raw,
|
|
36
|
+
lower(trim(s.id_type)) AS id_type_raw,
|
|
37
|
+
COALESCE(s.is_first_gid, false) AS is_first_gid,
|
|
38
|
+
s.valid_from,
|
|
39
|
+
NULLIF(s.valid_to, DATE '1900-01-01') AS valid_to
|
|
40
|
+
FROM analytic_dbt.ded_gid_mapping s
|
|
41
|
+
WHERE s.place_id IS NOT NULL AND trim(s.place_id) <> ''
|
|
42
|
+
AND s.gid IS NOT NULL AND trim(s.gid) <> ''
|
|
43
|
+
), resolved AS (
|
|
44
|
+
SELECT
|
|
45
|
+
place_id,
|
|
46
|
+
gid,
|
|
47
|
+
is_first_gid,
|
|
48
|
+
valid_from,
|
|
49
|
+
valid_to,
|
|
50
|
+
CASE
|
|
51
|
+
WHEN id_type_raw IN ('ean', 'eic') THEN id_type_raw
|
|
52
|
+
WHEN commodity_raw IN ('1', 'electricity', 'elektrina') THEN 'ean'
|
|
53
|
+
WHEN commodity_raw IN ('2', 'gas', 'plyn') THEN 'eic'
|
|
54
|
+
END AS id_type,
|
|
55
|
+
CASE
|
|
56
|
+
WHEN commodity_raw IN ('1', 'electricity', 'elektrina') THEN 'electricity'
|
|
57
|
+
WHEN commodity_raw IN ('2', 'gas', 'plyn') THEN 'gas'
|
|
58
|
+
WHEN id_type_raw = 'ean' THEN 'electricity'
|
|
59
|
+
WHEN id_type_raw = 'eic' THEN 'gas'
|
|
60
|
+
END AS commodity
|
|
61
|
+
FROM src
|
|
62
|
+
WHERE length(place_id) <= 50
|
|
63
|
+
)
|
|
64
|
+
INSERT INTO energetics.enapo_gid_mapping
|
|
65
|
+
(place_id, id_type, commodity, gid, is_first_gid, link_source, valid_from, valid_to)
|
|
66
|
+
SELECT DISTINCT ON (r.place_id, r.gid)
|
|
67
|
+
r.place_id,
|
|
68
|
+
r.id_type,
|
|
69
|
+
r.commodity,
|
|
70
|
+
r.gid,
|
|
71
|
+
r.is_first_gid,
|
|
72
|
+
'mock',
|
|
73
|
+
r.valid_from,
|
|
74
|
+
r.valid_to
|
|
75
|
+
FROM resolved r
|
|
76
|
+
WHERE r.id_type IS NOT NULL
|
|
77
|
+
AND r.commodity IS NOT NULL
|
|
78
|
+
-- Drops rows whose source id_type and commodity contradict each other; the two CASE
|
|
79
|
+
-- expressions above resolve independently and cannot catch the disagreement themselves.
|
|
80
|
+
AND (r.id_type, r.commodity) IN (('ean', 'electricity'), ('eic', 'gas'))
|
|
81
|
+
ORDER BY
|
|
82
|
+
r.place_id,
|
|
83
|
+
r.gid,
|
|
84
|
+
(r.valid_to IS NULL) DESC,
|
|
85
|
+
r.valid_from DESC NULLS LAST;
|
|
86
|
+
|
|
87
|
+
COMMIT;
|
|
88
|
+
|
|
89
|
+
-- Pre-flight / post-check on the source table: which (id_type, commodity) combinations exist,
|
|
90
|
+
-- how many rows each holds, whether this script can resolve them and whether the two columns
|
|
91
|
+
-- contradict each other (contradicting rows are skipped by the insert above).
|
|
92
|
+
--
|
|
93
|
+
-- SELECT
|
|
94
|
+
-- lower(trim(id_type)) AS id_type_raw,
|
|
95
|
+
-- lower(trim(commodity)) AS commodity_raw,
|
|
96
|
+
-- count(*) AS rows,
|
|
97
|
+
-- count(*) FILTER (WHERE length(trim(place_id)) > 50) AS too_long_place_id,
|
|
98
|
+
-- lower(trim(id_type)) IN ('ean', 'eic')
|
|
99
|
+
-- OR lower(trim(commodity)) IN ('1', '2', 'electricity', 'elektrina', 'gas', 'plyn') AS resolvable,
|
|
100
|
+
-- (lower(trim(id_type)) = 'ean' AND lower(trim(commodity)) IN ('2', 'gas', 'plyn'))
|
|
101
|
+
-- OR (lower(trim(id_type)) = 'eic' AND lower(trim(commodity)) IN ('1', 'electricity', 'elektrina'))
|
|
102
|
+
-- AS contradicting
|
|
103
|
+
-- FROM analytic_dbt.ded_gid_mapping
|
|
104
|
+
-- WHERE place_id IS NOT NULL AND trim(place_id) <> ''
|
|
105
|
+
-- AND gid IS NOT NULL AND trim(gid) <> ''
|
|
106
|
+
-- GROUP BY 1, 2
|
|
107
|
+
-- ORDER BY rows DESC;
|
|
@@ -17,6 +17,7 @@ const EnoAddressRepository_1 = require("../repositories/eno/EnoAddressRepository
|
|
|
17
17
|
const EnoBuildingRepository_1 = require("../repositories/eno/EnoBuildingRepository");
|
|
18
18
|
const EnoEJRepository_1 = require("../repositories/eno/EnoEJRepository");
|
|
19
19
|
const EnoGeometryRepository_1 = require("../repositories/eno/EnoGeometryRepository");
|
|
20
|
+
const DedSearchIndexRepository_1 = require("../repositories/DedSearchIndexRepository");
|
|
20
21
|
const EnoLocationRepository_1 = require("../repositories/eno/EnoLocationRepository");
|
|
21
22
|
const EnoManagerRepository_1 = require("../repositories/eno/EnoManagerRepository");
|
|
22
23
|
const EnoOrganizationRepository_1 = require("../repositories/eno/EnoOrganizationRepository");
|
|
@@ -53,6 +54,7 @@ const EnapoPpasTask_1 = require("../workers/task/EnapoPpasTask");
|
|
|
53
54
|
const EnapoPrediTask_1 = require("../workers/task/EnapoPrediTask");
|
|
54
55
|
const EnoBuildingTask_1 = require("../workers/task/EnoBuildingTask");
|
|
55
56
|
const EnoGeometryTask_1 = require("../workers/task/EnoGeometryTask");
|
|
57
|
+
const DedSearchIndexRefreshTask_1 = require("../workers/task/DedSearchIndexRefreshTask");
|
|
56
58
|
const EnoLookupTask_1 = require("../workers/task/EnoLookupTask");
|
|
57
59
|
const EnoStructureTask_1 = require("../workers/task/EnoStructureTask");
|
|
58
60
|
const PorsennaDistributionTask_1 = require("../workers/task/PorsennaDistributionTask");
|
|
@@ -85,6 +87,7 @@ EnapoContainer.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.En
|
|
|
85
87
|
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnoRemovedGIDRepository, EnoRemovedGIDRepository_1.EnoRemovedGIDRepository)
|
|
86
88
|
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnoStructureRepository, EnoStructureRepository_1.EnoStructureRepository)
|
|
87
89
|
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnoGeometryRepository, EnoGeometryRepository_1.EnoGeometryRepository)
|
|
90
|
+
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.DedSearchIndexRepository, DedSearchIndexRepository_1.DedSearchIndexRepository)
|
|
88
91
|
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PpasDistributionInvoiceDeviceRepository, PpasDistributionInvoiceDeviceRepository_1.PpasDistributionInvoiceDeviceRepository)
|
|
89
92
|
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PpasDistributionInvoiceInstallationRepository, PpasDistributionInvoiceInstallationRepository_1.PpasDistributionInvoiceInstallationRepository)
|
|
90
93
|
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PpasDistributionInvoicePriceRepository, PpasDistributionInvoicePriceRepository_1.PpasDistributionInvoicePriceRepository)
|
|
@@ -120,5 +123,6 @@ EnapoContainer.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.En
|
|
|
120
123
|
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnoGeometryTask, EnoGeometryTask_1.EnoGeometryTask)
|
|
121
124
|
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnapoPpasDistributionTask, EnapoPpasDistributionTask_1.EnapoPpasDistributionTask)
|
|
122
125
|
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnapoPpasCommercialTask, EnapoPpasCommercialTask_1.EnapoPpasCommercialTask)
|
|
123
|
-
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PorsennaDistributionTask, PorsennaDistributionTask_1.PorsennaDistributionTask)
|
|
126
|
+
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PorsennaDistributionTask, PorsennaDistributionTask_1.PorsennaDistributionTask)
|
|
127
|
+
.register(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.DedSearchIndexRefreshTask, DedSearchIndexRefreshTask_1.DedSearchIndexRefreshTask);
|
|
124
128
|
//# sourceMappingURL=Di.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,iIAA4H;AAC5H,qHAAgH;AAChH,kIAA6H;AAC7H,6FAAwF;AACxF,qEAA0F;AAE1F,kFAA+E;AAC/E,mGAAgG;AAChG,mFAAgF;AAChF,sGAAmG;AACnG,4GAAyG;AACzG,6FAA0F;AAC1F,+FAA4F;AAC5F,mFAAgF;AAChF,qFAAkF;AAClF,yEAAsE;AACtE,qFAAkF;AAClF,qFAAkF;AAClF,mFAAgF;AAChF,6FAA0F;AAC1F,qFAAkF;AAClF,yFAAsF;AACtF,uFAAoF;AACpF,+FAA4F;AAC5F,sGAAmG;AACnG,0GAAuG;AACvG,kGAA+F;AAC/F,sHAAmH;AACnH,kIAA+H;AAC/H,oHAAiH;AACjH,0GAAuG;AACvG,0HAAuH;AACvH,sIAAmI;AACnI,wHAAqH;AACrH,8GAA2G;AAC3G,oGAAiG;AACjG,oFAAiF;AACjF,8FAA2F;AAC3F,wGAAqG;AACrG,0GAAuG;AACvG,qHAAkH;AAClH,yGAAsG;AACtG,uGAAoG;AACpG,2GAAwG;AACxG,kHAA+G;AAC/G,wGAAqG;AACrG,gGAA6F;AAC7F,qFAAkF;AAClF,yFAAsF;AACtF,iEAA8D;AAC9D,mEAAgE;AAChE,qEAAkE;AAClE,qEAAkE;AAClE,iEAA8D;AAC9D,uEAAoE;AACpE,uFAAoF;AACpF,2EAAwE;AAExE,wBAAwB;AACxB,MAAM,cAAc,GAAwB,+BAA0B,CAAC,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,iIAA4H;AAC5H,qHAAgH;AAChH,kIAA6H;AAC7H,6FAAwF;AACxF,qEAA0F;AAE1F,kFAA+E;AAC/E,mGAAgG;AAChG,mFAAgF;AAChF,sGAAmG;AACnG,4GAAyG;AACzG,6FAA0F;AAC1F,+FAA4F;AAC5F,mFAAgF;AAChF,qFAAkF;AAClF,yEAAsE;AACtE,qFAAkF;AAClF,uFAAoF;AACpF,qFAAkF;AAClF,mFAAgF;AAChF,6FAA0F;AAC1F,qFAAkF;AAClF,yFAAsF;AACtF,uFAAoF;AACpF,+FAA4F;AAC5F,sGAAmG;AACnG,0GAAuG;AACvG,kGAA+F;AAC/F,sHAAmH;AACnH,kIAA+H;AAC/H,oHAAiH;AACjH,0GAAuG;AACvG,0HAAuH;AACvH,sIAAmI;AACnI,wHAAqH;AACrH,8GAA2G;AAC3G,oGAAiG;AACjG,oFAAiF;AACjF,8FAA2F;AAC3F,wGAAqG;AACrG,0GAAuG;AACvG,qHAAkH;AAClH,yGAAsG;AACtG,uGAAoG;AACpG,2GAAwG;AACxG,kHAA+G;AAC/G,wGAAqG;AACrG,gGAA6F;AAC7F,qFAAkF;AAClF,yFAAsF;AACtF,iEAA8D;AAC9D,mEAAgE;AAChE,qEAAkE;AAClE,qEAAkE;AAClE,yFAAsF;AACtF,iEAA8D;AAC9D,uEAAoE;AACpE,uFAAoF;AACpF,2EAAwE;AAExE,wBAAwB;AACxB,MAAM,cAAc,GAAwB,+BAA0B,CAAC,oBAAoB,EAAE,CAAC;AA+ErF,wCAAc;AA9EvB,YAAY;AAEZ,oBAAoB;AACpB,cAAc,CAAC,QAAQ,CAAC,2CAAoB,CAAC,wBAAw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B,EAAE,mDAAwB,CAAC;KACtF,QAAQ,CAAC,qDAAyB,CAAC,yBAAyB,EAAE,qDAAyB,CAAC,CAAC"}
|
|
@@ -47,9 +47,11 @@ declare const EnapoWorkerContainerToken: {
|
|
|
47
47
|
EnoRemovedGIDRepository: symbol;
|
|
48
48
|
EnoStructureRepository: symbol;
|
|
49
49
|
EnoGeometryRepository: symbol;
|
|
50
|
+
DedSearchIndexRepository: symbol;
|
|
50
51
|
EnoLookupTask: symbol;
|
|
51
52
|
EnoBuildingTask: symbol;
|
|
52
53
|
EnoStructureTask: symbol;
|
|
53
54
|
EnoGeometryTask: symbol;
|
|
55
|
+
DedSearchIndexRefreshTask: symbol;
|
|
54
56
|
};
|
|
55
57
|
export { EnapoWorkerContainerToken };
|
|
@@ -59,10 +59,12 @@ const EnapoWorkerContainerToken = {
|
|
|
59
59
|
EnoRemovedGIDRepository: Symbol(),
|
|
60
60
|
EnoStructureRepository: Symbol(),
|
|
61
61
|
EnoGeometryRepository: Symbol(),
|
|
62
|
+
DedSearchIndexRepository: Symbol(),
|
|
62
63
|
EnoLookupTask: Symbol(),
|
|
63
64
|
EnoBuildingTask: Symbol(),
|
|
64
65
|
EnoStructureTask: Symbol(),
|
|
65
66
|
EnoGeometryTask: Symbol(),
|
|
67
|
+
DedSearchIndexRefreshTask: Symbol(),
|
|
66
68
|
//#endregion
|
|
67
69
|
};
|
|
68
70
|
exports.EnapoWorkerContainerToken = EnapoWorkerContainerToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnapoWorkerContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/ioc/EnapoWorkerContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,yBAAyB,GAAG;IAC9B,oBAAoB;IACpB,kCAAkC,EAAE,MAAM,EAAE;IAC5C,+BAA+B,EAAE,MAAM,EAAE;IACzC,6BAA6B,EAAE,MAAM,EAAE;IACvC,kBAAkB,EAAE,MAAM,EAAE;IAC5B,0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AAE;IACnC,oBAAoB,EAAE,MAAM,EAAE;IAC9B,eAAe,EAAE,MAAM,EAAE;IACzB,qBAAqB,EAAE,MAAM,EAAE;IAC/B,oBAAoB,EAAE,MAAM,EAAE;IAC9B,qBAAqB,EAAE,MAAM,EAAE;IAC/B,qBAAqB,EAAE,MAAM,EAAE;IAC/B,uBAAuB,EAAE,MAAM,EAAE;IACjC,sBAAsB,EAAE,MAAM,EAAE;IAChC,qBAAqB,EAAE,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"EnapoWorkerContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/ioc/EnapoWorkerContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,yBAAyB,GAAG;IAC9B,oBAAoB;IACpB,kCAAkC,EAAE,MAAM,EAAE;IAC5C,+BAA+B,EAAE,MAAM,EAAE;IACzC,6BAA6B,EAAE,MAAM,EAAE;IACvC,kBAAkB,EAAE,MAAM,EAAE;IAC5B,0BAA0B,EAAE,MAAM,EAAE;IACpC,YAAY;IAEZ,sBAAsB;IACtB,2BAA2B,EAAE,MAAM,EAAE;IACrC,uBAAuB,EAAE,MAAM,EAAE;IACjC,4BAA4B,EAAE,MAAM,EAAE;IACtC,uCAAuC,EAAE,MAAM,EAAE;IACjD,6CAA6C,EAAE,MAAM,EAAE;IACvD,sCAAsC,EAAE,MAAM,EAAE;IAChD,iCAAiC,EAAE,MAAM,EAAE;IAC3C,+BAA+B,EAAE,MAAM,EAAE;IACzC,2CAA2C,EAAE,MAAM,EAAE;IACrD,qCAAqC,EAAE,MAAM,EAAE;IAC/C,oCAAoC,EAAE,MAAM,EAAE;IAC9C,2BAA2B,EAAE,MAAM,EAAE;IACrC,6BAA6B,EAAE,MAAM,EAAE;IACvC,yBAAyB,EAAE,MAAM,EAAE;IACnC,YAAY;IAEZ,yBAAyB;IACzB,6BAA6B,EAAE,MAAM,EAAE;IACvC,6BAA6B,EAAE,MAAM,EAAE;IACvC,kCAAkC,EAAE,MAA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|
2
|
+
import { IDedSearchIndexRepository } from "./interfaces/IDedSearchIndexRepository";
|
|
3
|
+
export declare class DedSearchIndexRepository implements IDedSearchIndexRepository {
|
|
4
|
+
private connector;
|
|
5
|
+
constructor(connector: IDatabaseConnector);
|
|
6
|
+
refresh(): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DedSearchIndexRepository = void 0;
|
|
16
|
+
const constants_1 = require("../../../schema-definitions/constants");
|
|
17
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
18
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
19
|
+
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
20
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
21
|
+
/**
|
|
22
|
+
* CONCURRENTLY keeps the search endpoint served during the rebuild - it relies on the unique index
|
|
23
|
+
* on gid created by the migration. It must not run inside a transaction, which is why this statement
|
|
24
|
+
* is issued on the plain (autocommit) connection and never wrapped in one.
|
|
25
|
+
*
|
|
26
|
+
* Two overlapping refreshes are serialised by Postgres itself and the second one simply redoes the
|
|
27
|
+
* work; with a single consumer on the queue that is harmless. Should this queue ever be scaled out,
|
|
28
|
+
* take an advisory lock here and skip the refresh when it is not granted.
|
|
29
|
+
*/
|
|
30
|
+
const REFRESH_STATEMENT = `REFRESH MATERIALIZED VIEW CONCURRENTLY ${constants_1.PG_SCHEMA}.mv_ded_building_search`;
|
|
31
|
+
let DedSearchIndexRepository = class DedSearchIndexRepository {
|
|
32
|
+
constructor(connector) {
|
|
33
|
+
this.connector = connector;
|
|
34
|
+
}
|
|
35
|
+
async refresh() {
|
|
36
|
+
try {
|
|
37
|
+
await this.connector.getConnection().query(REFRESH_STATEMENT, { type: sequelize_1.QueryTypes.RAW });
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
throw new golemio_errors_1.GeneralError("Failed to refresh the DeD building search index.", this.constructor.name, err);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.DedSearchIndexRepository = DedSearchIndexRepository;
|
|
45
|
+
exports.DedSearchIndexRepository = DedSearchIndexRepository = __decorate([
|
|
46
|
+
(0, tsyringe_1.injectable)(),
|
|
47
|
+
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
48
|
+
__metadata("design:paramtypes", [Object])
|
|
49
|
+
], DedSearchIndexRepository);
|
|
50
|
+
//# sourceMappingURL=DedSearchIndexRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DedSearchIndexRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/repositories/DedSearchIndexRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qEAA2C;AAE3C,wEAAqE;AACrE,6EAAwE;AACxE,mEAAiE;AACjE,iEAAwE;AAGxE;;;;;;;;GAQG;AACH,MAAM,iBAAiB,GAAG,0CAA0C,qBAAS,yBAAyB,CAAC;AAGhG,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACjC,YAAyD,SAA6B;QAA7B,cAAS,GAAT,SAAS,CAAoB;IAAG,CAAC;IAEnF,KAAK,CAAC,OAAO;QAChB,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,sBAAU,CAAC,GAAG,EAAE,CAAC,CAAC;QAC5F,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,IAAI,6BAAY,CAAC,kDAAkD,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC3G,CAAC;IACL,CAAC;CACJ,CAAA;AAVY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;;GADvC,wBAAwB,CAUpC"}
|
package/dist/integration-engine/enapo/repositories/interfaces/IDedSearchIndexRepository.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDedSearchIndexRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/repositories/interfaces/IDedSearchIndexRepository.ts"],"names":[],"mappings":""}
|
|
@@ -23,6 +23,7 @@ class EnapoWorker extends integration_engine_1.AbstractWorker {
|
|
|
23
23
|
this.registerTask(Di_1.EnapoContainer.resolve(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnapoPpasDistributionTask));
|
|
24
24
|
this.registerTask(Di_1.EnapoContainer.resolve(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnapoPpasCommercialTask));
|
|
25
25
|
this.registerTask(Di_1.EnapoContainer.resolve(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PorsennaDistributionTask));
|
|
26
|
+
this.registerTask(Di_1.EnapoContainer.resolve(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.DedSearchIndexRefreshTask));
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
exports.EnapoWorker = EnapoWorker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnapoWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/workers/EnapoWorker.ts"],"names":[],"mappings":";;;AAAA,8EAAuE;AAEvE,4CAAiD;AACjD,kCAA2C;AAC3C,gFAA6E;AAE7E,MAAa,WAAY,SAAQ,mCAAc;IAG3C;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,6BAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"EnapoWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/workers/EnapoWorker.ts"],"names":[],"mappings":";;;AAAA,8EAAuE;AAEvE,4CAAiD;AACjD,kCAA2C;AAC3C,gFAA6E;AAE7E,MAAa,WAAY,SAAQ,mCAAc;IAG3C;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,6BAAiB,CAAC;QAkB5B,iBAAY,GAAG,CAAC,IAAW,EAAQ,EAAE;YACxC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7C,CAAC,CAAC;QAhBE,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,aAAa,CAAC,CAAC,CAAC;QAC1F,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,cAAc,CAAC,CAAC,CAAC;QAC3F,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,aAAa,CAAC,CAAC,CAAC;QAC1F,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,eAAe,CAAC,CAAC,CAAC;QAC5F,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC7F,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,eAAe,CAAC,CAAC,CAAC;QAC5F,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,yBAAyB,CAAC,CAAC,CAAC;QACtG,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACpG,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,wBAAwB,CAAC,CAAC,CAAC;QACrG,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAC1G,CAAC;CAMJ;AAvBD,kCAuBC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IDedSearchIndexRepository } from "../../repositories/interfaces/IDedSearchIndexRepository";
|
|
2
|
+
import { AbstractTask } from "@golemio/core/dist/integration-engine/workers/AbstractTask";
|
|
3
|
+
/**
|
|
4
|
+
* Rebuilds mv_ded_building_search, the index behind the DeD building search endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Runs on a nightly cron and is additionally triggered by the ENO tasks that change what the index
|
|
7
|
+
* contains, so a freshly ingested building becomes searchable the same day. The refresh takes no
|
|
8
|
+
* parameters - it always rebuilds the whole index - so there is nothing to validate and the schema
|
|
9
|
+
* is deliberately undefined.
|
|
10
|
+
*
|
|
11
|
+
* The TTL is short on purpose: a queued refresh that waited longer than half an hour has been
|
|
12
|
+
* superseded by a newer one and is not worth running.
|
|
13
|
+
*/
|
|
14
|
+
export declare class DedSearchIndexRefreshTask extends AbstractTask<Record<string, never>> {
|
|
15
|
+
private dedSearchIndexRepository;
|
|
16
|
+
queueName: string;
|
|
17
|
+
queueTtl: number;
|
|
18
|
+
protected schema: undefined;
|
|
19
|
+
constructor(dedSearchIndexRepository: IDedSearchIndexRepository);
|
|
20
|
+
execute(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DedSearchIndexRefreshTask = void 0;
|
|
16
|
+
const constants_1 = require("../../constants");
|
|
17
|
+
const EnapoWorkerContainerToken_1 = require("../../ioc/EnapoWorkerContainerToken");
|
|
18
|
+
const AbstractTask_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTask");
|
|
19
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
20
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
21
|
+
/**
|
|
22
|
+
* Rebuilds mv_ded_building_search, the index behind the DeD building search endpoint.
|
|
23
|
+
*
|
|
24
|
+
* Runs on a nightly cron and is additionally triggered by the ENO tasks that change what the index
|
|
25
|
+
* contains, so a freshly ingested building becomes searchable the same day. The refresh takes no
|
|
26
|
+
* parameters - it always rebuilds the whole index - so there is nothing to validate and the schema
|
|
27
|
+
* is deliberately undefined.
|
|
28
|
+
*
|
|
29
|
+
* The TTL is short on purpose: a queued refresh that waited longer than half an hour has been
|
|
30
|
+
* superseded by a newer one and is not worth running.
|
|
31
|
+
*/
|
|
32
|
+
let DedSearchIndexRefreshTask = class DedSearchIndexRefreshTask extends AbstractTask_1.AbstractTask {
|
|
33
|
+
constructor(dedSearchIndexRepository) {
|
|
34
|
+
super(constants_1.ENAPO_WORKER_NAME);
|
|
35
|
+
this.dedSearchIndexRepository = dedSearchIndexRepository;
|
|
36
|
+
this.queueName = "refreshDedSearchIndex";
|
|
37
|
+
this.queueTtl = 30 * 60 * 1000;
|
|
38
|
+
this.schema = undefined;
|
|
39
|
+
}
|
|
40
|
+
async execute() {
|
|
41
|
+
try {
|
|
42
|
+
await this.dedSearchIndexRepository.refresh();
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
if (err instanceof golemio_errors_1.AbstractGolemioError) {
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
throw new golemio_errors_1.GeneralError("Failed to refresh the DeD building search index.", this.constructor.name, err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.DedSearchIndexRefreshTask = DedSearchIndexRefreshTask;
|
|
53
|
+
exports.DedSearchIndexRefreshTask = DedSearchIndexRefreshTask = __decorate([
|
|
54
|
+
(0, tsyringe_1.injectable)(),
|
|
55
|
+
__param(0, (0, tsyringe_1.inject)(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.DedSearchIndexRepository)),
|
|
56
|
+
__metadata("design:paramtypes", [Object])
|
|
57
|
+
], DedSearchIndexRefreshTask);
|
|
58
|
+
//# sourceMappingURL=DedSearchIndexRefreshTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DedSearchIndexRefreshTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/workers/task/DedSearchIndexRefreshTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAwD;AACxD,mFAAoF;AAEpF,6FAA0F;AAC1F,6EAA8F;AAC9F,iEAAwE;AAExE;;;;;;;;;;GAUG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,2BAAmC;IAK9E,YAEI,wBAA2D;QAE3D,KAAK,CAAC,6BAAiB,CAAC,CAAC;QAFjB,6BAAwB,GAAxB,wBAAwB,CAA2B;QANxD,cAAS,GAAG,uBAAuB,CAAC;QACpC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACvB,WAAM,GAAG,SAAS,CAAC;IAO7B,CAAC;IAEM,KAAK,CAAC,OAAO;QAChB,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,CAAC;QAClD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,GAAG,YAAY,qCAAoB,EAAE,CAAC;gBACtC,MAAM,GAAG,CAAC;YACd,CAAC;YAED,MAAM,IAAI,6BAAY,CAAC,kDAAkD,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC3G,CAAC;IACL,CAAC;CACJ,CAAA;AAvBY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,qBAAU,GAAE;IAOJ,WAAA,IAAA,iBAAM,EAAC,qDAAyB,CAAC,wBAAwB,CAAC,CAAA;;GANtD,yBAAyB,CAuBrC"}
|