@golemio/energetics 1.4.3-dev.1411262009 → 1.4.4-rc.1419814471
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/migrations/postgresql/sqls/20230116095151-correct_v_energetis_upadate-down.sql +27 -27
- package/db/migrations/postgresql/sqls/20230116095151-correct_v_energetis_upadate-up.sql +28 -28
- package/db/migrations/postgresql/sqls/20230202122506-v_energetics_last_updates-down.sql +64 -64
- package/db/migrations/postgresql/sqls/20230202122506-v_energetics_last_updates-up.sql +168 -168
- package/db/migrations/postgresql/sqls/20230208144859-v_energetics_last_updates_corr-down.sql +50 -50
- package/db/migrations/postgresql/sqls/20230208144859-v_energetics_last_updates_corr-up.sql +51 -51
- package/db/migrations/postgresql/sqls/20230216151258-new_views_out_of_prague-down.sql +461 -461
- package/db/migrations/postgresql/sqls/20230216151258-new_views_out_of_prague-up.sql +464 -464
- package/db/migrations/postgresql/sqls/20230220063725-another_view_out_of_prague_-down.sql +126 -126
- package/db/migrations/postgresql/sqls/20230220063725-another_view_out_of_prague_-up.sql +127 -127
- package/db/migrations/postgresql/sqls/20230220132403-v_gas_reserve_correct-down.sql +111 -111
- package/db/migrations/postgresql/sqls/20230220132403-v_gas_reserve_correct-up.sql +110 -110
- package/dist/integration-engine/commodity-providers/ioc/Di.js +1 -1
- package/dist/integration-engine/commodity-providers/ioc/Di.js.map +1 -1
- package/docs/index.md +3 -0
- package/package.json +4 -4
package/db/migrations/postgresql/sqls/20230208144859-v_energetics_last_updates_corr-down.sql
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
CREATE OR REPLACE VIEW v_consumption_energy_missing_devices_last_update_prague_10
|
|
2
|
-
AS WITH missing_devices_last_update AS (
|
|
3
|
-
SELECT replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) AS addr,
|
|
4
|
-
"left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)) AS building_code,
|
|
5
|
-
max(consumption_energy_consumption.time_utc) AS last_update
|
|
6
|
-
FROM consumption_energy_consumption
|
|
7
|
-
WHERE NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
|
|
8
|
-
CASE
|
|
9
|
-
WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
|
|
10
|
-
ELSE consumption_energy_devices.addr
|
|
11
|
-
END AS addr
|
|
12
|
-
FROM consumption_energy_devices))
|
|
13
|
-
GROUP BY (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text)), consumption_energy_consumption.addr
|
|
14
|
-
), missing_devices_last_not_zero AS (
|
|
15
|
-
SELECT replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) AS addr,
|
|
16
|
-
max(consumption_energy_consumption.time_utc) AS last_not_zero_value
|
|
17
|
-
FROM consumption_energy_consumption
|
|
18
|
-
WHERE consumption_energy_consumption.value > 0::numeric AND NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
|
|
19
|
-
CASE
|
|
20
|
-
WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
|
|
21
|
-
ELSE consumption_energy_devices.addr
|
|
22
|
-
END AS addr
|
|
23
|
-
FROM consumption_energy_devices))
|
|
24
|
-
GROUP BY consumption_energy_consumption.addr, (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text))
|
|
25
|
-
), buildings_mapping AS (
|
|
26
|
-
SELECT DISTINCT
|
|
27
|
-
CASE
|
|
28
|
-
WHEN d.addr::text !~~ '/%'::text THEN '/'::text || "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text))
|
|
29
|
-
ELSE "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text))
|
|
30
|
-
END AS building_code,
|
|
31
|
-
b.building_name
|
|
32
|
-
FROM consumption_energy_devices d
|
|
33
|
-
JOIN consumption_energy_buildings b ON d.building_id = b.id
|
|
34
|
-
WHERE b.building_address_code::text ~~ '10.%'::text
|
|
35
|
-
)
|
|
36
|
-
SELECT bm.building_name,
|
|
37
|
-
lu.last_update,
|
|
38
|
-
lu.addr,
|
|
39
|
-
CASE
|
|
40
|
-
WHEN lnz.last_not_zero_value = lu.last_update THEN NULL::timestamp without time zone
|
|
41
|
-
ELSE lnz.last_not_zero_value
|
|
42
|
-
END AS zero_values_after
|
|
43
|
-
FROM missing_devices_last_update lu
|
|
44
|
-
JOIN buildings_mapping bm ON lu.building_code =
|
|
45
|
-
CASE
|
|
46
|
-
WHEN bm.building_code !~~ '/%'::text THEN '/'::text || bm.building_code
|
|
47
|
-
ELSE bm.building_code
|
|
48
|
-
END
|
|
49
|
-
LEFT JOIN missing_devices_last_not_zero lnz ON lu.addr = lnz.addr;
|
|
50
|
-
|
|
1
|
+
CREATE OR REPLACE VIEW v_consumption_energy_missing_devices_last_update_prague_10
|
|
2
|
+
AS WITH missing_devices_last_update AS (
|
|
3
|
+
SELECT replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) AS addr,
|
|
4
|
+
"left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)) AS building_code,
|
|
5
|
+
max(consumption_energy_consumption.time_utc) AS last_update
|
|
6
|
+
FROM consumption_energy_consumption
|
|
7
|
+
WHERE NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
|
|
8
|
+
CASE
|
|
9
|
+
WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
|
|
10
|
+
ELSE consumption_energy_devices.addr
|
|
11
|
+
END AS addr
|
|
12
|
+
FROM consumption_energy_devices))
|
|
13
|
+
GROUP BY (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text)), consumption_energy_consumption.addr
|
|
14
|
+
), missing_devices_last_not_zero AS (
|
|
15
|
+
SELECT replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) AS addr,
|
|
16
|
+
max(consumption_energy_consumption.time_utc) AS last_not_zero_value
|
|
17
|
+
FROM consumption_energy_consumption
|
|
18
|
+
WHERE consumption_energy_consumption.value > 0::numeric AND NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
|
|
19
|
+
CASE
|
|
20
|
+
WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
|
|
21
|
+
ELSE consumption_energy_devices.addr
|
|
22
|
+
END AS addr
|
|
23
|
+
FROM consumption_energy_devices))
|
|
24
|
+
GROUP BY consumption_energy_consumption.addr, (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text))
|
|
25
|
+
), buildings_mapping AS (
|
|
26
|
+
SELECT DISTINCT
|
|
27
|
+
CASE
|
|
28
|
+
WHEN d.addr::text !~~ '/%'::text THEN '/'::text || "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text))
|
|
29
|
+
ELSE "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text))
|
|
30
|
+
END AS building_code,
|
|
31
|
+
b.building_name
|
|
32
|
+
FROM consumption_energy_devices d
|
|
33
|
+
JOIN consumption_energy_buildings b ON d.building_id = b.id
|
|
34
|
+
WHERE b.building_address_code::text ~~ '10.%'::text
|
|
35
|
+
)
|
|
36
|
+
SELECT bm.building_name,
|
|
37
|
+
lu.last_update,
|
|
38
|
+
lu.addr,
|
|
39
|
+
CASE
|
|
40
|
+
WHEN lnz.last_not_zero_value = lu.last_update THEN NULL::timestamp without time zone
|
|
41
|
+
ELSE lnz.last_not_zero_value
|
|
42
|
+
END AS zero_values_after
|
|
43
|
+
FROM missing_devices_last_update lu
|
|
44
|
+
JOIN buildings_mapping bm ON lu.building_code =
|
|
45
|
+
CASE
|
|
46
|
+
WHEN bm.building_code !~~ '/%'::text THEN '/'::text || bm.building_code
|
|
47
|
+
ELSE bm.building_code
|
|
48
|
+
END
|
|
49
|
+
LEFT JOIN missing_devices_last_not_zero lnz ON lu.addr = lnz.addr;
|
|
50
|
+
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
DROP VIEW v_consumption_energy_missing_devices_last_update_prague_10;
|
|
2
|
-
|
|
3
|
-
CREATE OR REPLACE VIEW v_consumption_energy_missing_devices_last_update_prague_10
|
|
4
|
-
AS WITH missing_devices_last_update AS (
|
|
5
|
-
SELECT replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text) AS addr,
|
|
6
|
-
"left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)) AS building_code,
|
|
7
|
-
max(consumption_energy_consumption.time_utc) AS last_update
|
|
8
|
-
FROM energetics.consumption_energy_consumption
|
|
9
|
-
WHERE NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
|
|
10
|
-
CASE
|
|
11
|
-
WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
|
|
12
|
-
ELSE consumption_energy_devices.addr
|
|
13
|
-
END AS addr
|
|
14
|
-
FROM consumption_energy_devices))
|
|
15
|
-
GROUP BY (replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text)), ("left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)))
|
|
16
|
-
), missing_devices_last_not_zero AS (
|
|
17
|
-
SELECT replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text) AS addr,
|
|
18
|
-
max(consumption_energy_consumption.time_utc) AS last_not_zero_value
|
|
19
|
-
FROM consumption_energy_consumption
|
|
20
|
-
WHERE consumption_energy_consumption.value > 0::numeric AND NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
|
|
21
|
-
CASE
|
|
22
|
-
WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
|
|
23
|
-
ELSE consumption_energy_devices.addr
|
|
24
|
-
END AS addr
|
|
25
|
-
FROM consumption_energy_devices))
|
|
26
|
-
GROUP BY (replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text))
|
|
27
|
-
), buildings_mapping AS (
|
|
28
|
-
SELECT DISTINCT "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text)) AS building_code,
|
|
29
|
-
b.building_name,
|
|
30
|
-
b.id,
|
|
31
|
-
d.building_id
|
|
32
|
-
FROM consumption_energy_devices d
|
|
33
|
-
JOIN consumption_energy_buildings b ON d.building_id = b.id
|
|
34
|
-
WHERE b.building_address_code::text ~~ '10.%'::text
|
|
35
|
-
)
|
|
36
|
-
SELECT bm.building_name,
|
|
37
|
-
lu.last_update,
|
|
38
|
-
lu.addr,
|
|
39
|
-
CASE
|
|
40
|
-
WHEN lnz.last_not_zero_value = lu.last_update THEN NULL::timestamp without time zone
|
|
41
|
-
ELSE lnz.last_not_zero_value
|
|
42
|
-
END AS zero_values_after
|
|
43
|
-
FROM missing_devices_last_update lu
|
|
44
|
-
JOIN buildings_mapping bm ON lu.building_code =
|
|
45
|
-
CASE
|
|
46
|
-
WHEN bm.building_code !~~ '/%'::text THEN '/'::text || bm.building_code
|
|
47
|
-
ELSE bm.building_code
|
|
48
|
-
END
|
|
49
|
-
LEFT JOIN missing_devices_last_not_zero lnz ON lu.addr = lnz.addr;
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
DROP VIEW v_consumption_energy_missing_devices_last_update_prague_10;
|
|
2
|
+
|
|
3
|
+
CREATE OR REPLACE VIEW v_consumption_energy_missing_devices_last_update_prague_10
|
|
4
|
+
AS WITH missing_devices_last_update AS (
|
|
5
|
+
SELECT replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text) AS addr,
|
|
6
|
+
"left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)) AS building_code,
|
|
7
|
+
max(consumption_energy_consumption.time_utc) AS last_update
|
|
8
|
+
FROM energetics.consumption_energy_consumption
|
|
9
|
+
WHERE NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
|
|
10
|
+
CASE
|
|
11
|
+
WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
|
|
12
|
+
ELSE consumption_energy_devices.addr
|
|
13
|
+
END AS addr
|
|
14
|
+
FROM consumption_energy_devices))
|
|
15
|
+
GROUP BY (replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text)), ("left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)))
|
|
16
|
+
), missing_devices_last_not_zero AS (
|
|
17
|
+
SELECT replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text) AS addr,
|
|
18
|
+
max(consumption_energy_consumption.time_utc) AS last_not_zero_value
|
|
19
|
+
FROM consumption_energy_consumption
|
|
20
|
+
WHERE consumption_energy_consumption.value > 0::numeric AND NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
|
|
21
|
+
CASE
|
|
22
|
+
WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
|
|
23
|
+
ELSE consumption_energy_devices.addr
|
|
24
|
+
END AS addr
|
|
25
|
+
FROM consumption_energy_devices))
|
|
26
|
+
GROUP BY (replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text))
|
|
27
|
+
), buildings_mapping AS (
|
|
28
|
+
SELECT DISTINCT "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text)) AS building_code,
|
|
29
|
+
b.building_name,
|
|
30
|
+
b.id,
|
|
31
|
+
d.building_id
|
|
32
|
+
FROM consumption_energy_devices d
|
|
33
|
+
JOIN consumption_energy_buildings b ON d.building_id = b.id
|
|
34
|
+
WHERE b.building_address_code::text ~~ '10.%'::text
|
|
35
|
+
)
|
|
36
|
+
SELECT bm.building_name,
|
|
37
|
+
lu.last_update,
|
|
38
|
+
lu.addr,
|
|
39
|
+
CASE
|
|
40
|
+
WHEN lnz.last_not_zero_value = lu.last_update THEN NULL::timestamp without time zone
|
|
41
|
+
ELSE lnz.last_not_zero_value
|
|
42
|
+
END AS zero_values_after
|
|
43
|
+
FROM missing_devices_last_update lu
|
|
44
|
+
JOIN buildings_mapping bm ON lu.building_code =
|
|
45
|
+
CASE
|
|
46
|
+
WHEN bm.building_code !~~ '/%'::text THEN '/'::text || bm.building_code
|
|
47
|
+
ELSE bm.building_code
|
|
48
|
+
END
|
|
49
|
+
LEFT JOIN missing_devices_last_not_zero lnz ON lu.addr = lnz.addr;
|
|
50
|
+
|
|
51
|
+
|