@golemio/microclimate 1.1.10 → 1.1.11-dev.943602968

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,53 @@
1
+ 'use strict';
2
+
3
+ var dbm;
4
+ var type;
5
+ var seed;
6
+ var fs = require('fs');
7
+ var path = require('path');
8
+ var Promise;
9
+
10
+ /**
11
+ * We receive the dbmigrate dependency from dbmigrate initially.
12
+ * This enables us to not have to rely on NODE_PATH.
13
+ */
14
+ exports.setup = function(options, seedLink) {
15
+ dbm = options.dbmigrate;
16
+ type = dbm.dataType;
17
+ seed = seedLink;
18
+ Promise = options.Promise;
19
+ };
20
+
21
+ exports.up = function(db) {
22
+ var filePath = path.join(__dirname, 'sqls', '20230724112440-modify-v-sensor-points-up.sql');
23
+ return new Promise( function( resolve, reject ) {
24
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
25
+ if (err) return reject(err);
26
+ console.log('received data: ' + data);
27
+
28
+ resolve(data);
29
+ });
30
+ })
31
+ .then(function(data) {
32
+ return db.runSql(data);
33
+ });
34
+ };
35
+
36
+ exports.down = function(db) {
37
+ var filePath = path.join(__dirname, 'sqls', '20230724112440-modify-v-sensor-points-down.sql');
38
+ return new Promise( function( resolve, reject ) {
39
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
40
+ if (err) return reject(err);
41
+ console.log('received data: ' + data);
42
+
43
+ resolve(data);
44
+ });
45
+ })
46
+ .then(function(data) {
47
+ return db.runSql(data);
48
+ });
49
+ };
50
+
51
+ exports._meta = {
52
+ "version": 1
53
+ };
@@ -0,0 +1,50 @@
1
+ CREATE OR REPLACE VIEW v_sensor_points
2
+ AS SELECT DISTINCT s.point_id,
3
+ s.point_name,
4
+ s.location_id,
5
+ s.location,
6
+ s.loc_description,
7
+ s.loc_orientation,
8
+ s.loc_surface,
9
+ s.lat,
10
+ s.lng,
11
+ NULL::text AS x_jtsk,
12
+ NULL::text AS y_jtsk,
13
+ NULL::text AS elevation_m,
14
+ s.sensor_position,
15
+ s.sensor_position_detail,
16
+ concat(unpivot.measure, unpivot.height_cm) AS measure,
17
+ CASE
18
+ WHEN unpivot.measure = 'air_temp'::text THEN 'Teplota vzduchu'::text
19
+ WHEN unpivot.measure = 'air_hum'::text THEN 'Vlhkost vzduchu'::text
20
+ WHEN unpivot.measure = 'pressure'::text THEN 'Atmosférický tlak'::text
21
+ WHEN unpivot.measure = 'wind_dir'::text THEN 'Směr větru'::text
22
+ WHEN unpivot.measure = 'wind_impact'::text THEN 'Náraz větru'::text
23
+ WHEN unpivot.measure = 'wind_speed'::text THEN 'Rychlost větru'::text
24
+ WHEN unpivot.measure = 'precip'::text THEN 'Úhrn srážek'::text
25
+ WHEN unpivot.measure = 'sun_irr'::text THEN 'Sluneční záření'::text
26
+ WHEN unpivot.measure = 'soil_temp'::text THEN 'Teplota půdy'::text
27
+ WHEN unpivot.measure = 'water_pot'::text THEN 'Vodní potenciál půdy'::text
28
+ WHEN unpivot.measure = 'dendro_circ'::text THEN 'Obvod stromu'::text
29
+ WHEN unpivot.measure = 'dendro_gain'::text THEN 'Přírůstek obvodu stromu'::text
30
+ ELSE NULL::text
31
+ END AS measure_cz,
32
+ CASE
33
+ WHEN unpivot.measure = 'air_temp'::text THEN '°C'::text
34
+ WHEN unpivot.measure = 'air_hum'::text THEN '%'::text
35
+ WHEN unpivot.measure = 'pressure'::text THEN 'Pa'::text
36
+ WHEN unpivot.measure = 'wind_dir'::text THEN '°'::text
37
+ WHEN unpivot.measure = 'wind_impact'::text THEN 'km/h'::text
38
+ WHEN unpivot.measure = 'wind_speed'::text THEN 'km/h'::text
39
+ WHEN unpivot.measure = 'precip'::text THEN 'mm'::text
40
+ WHEN unpivot.measure = 'sun_irr'::text THEN 'lux'::text
41
+ WHEN unpivot.measure = 'soil_temp'::text THEN '°C'::text
42
+ WHEN unpivot.measure = 'water_pot'::text THEN 'kPa'::text
43
+ WHEN unpivot.measure = 'dendro_circ'::text THEN 'mm'::text
44
+ WHEN unpivot.measure = 'dendro_gain'::text THEN 'µm'::text
45
+ ELSE NULL::text
46
+ END AS unit
47
+ FROM microclimate.sensor_devices_import s,
48
+ LATERAL ( VALUES ('air_temp'::text,s.air_temp), ('air_hum'::text,s.air_hum), ('pressure'::text,s.pressure), ('wind_dir'::text,s.wind_dir), ('wind_impact'::text,s.wind_impact), ('wind_speed'::text,s.wind_speed), ('precip'::text,s.precip), ('sun_irr'::text,s.sun_irr), ('soil_temp'::text,s.soil_temp), ('water_pot'::text,s.water_pot), ('dendro_circ'::text,s.dendro_circ), ('dendro_gain'::text,s.dendro_gain)) unpivot(measure, height_cm)
49
+ WHERE unpivot.height_cm IS NOT NULL
50
+ ORDER BY s.point_id;
@@ -0,0 +1,52 @@
1
+ CREATE OR REPLACE VIEW v_sensor_points
2
+ AS SELECT DISTINCT s.point_id,
3
+ s.point_name,
4
+ s.location_id,
5
+ s.location,
6
+ s.loc_description,
7
+ s.loc_orientation,
8
+ s.loc_surface,
9
+ s.lat,
10
+ s.lng,
11
+ NULL::text AS x_jtsk,
12
+ NULL::text AS y_jtsk,
13
+ NULL::text AS elevation_m,
14
+ s.sensor_position,
15
+ s.sensor_position_detail,
16
+ concat(unpivot.measure, unpivot.height_cm) AS measure,
17
+ concat(
18
+ CASE
19
+ WHEN unpivot.measure = 'air_temp'::text THEN 'Teplota vzduchu'::text
20
+ WHEN unpivot.measure = 'air_hum'::text THEN 'Vlhkost vzduchu'::text
21
+ WHEN unpivot.measure = 'pressure'::text THEN 'Atmosférický tlak'::text
22
+ WHEN unpivot.measure = 'wind_dir'::text THEN 'Směr větru'::text
23
+ WHEN unpivot.measure = 'wind_impact'::text THEN 'Náraz větru'::text
24
+ WHEN unpivot.measure = 'wind_speed'::text THEN 'Rychlost větru'::text
25
+ WHEN unpivot.measure = 'precip'::text THEN 'Úhrn srážek'::text
26
+ WHEN unpivot.measure = 'sun_irr'::text THEN 'Sluneční záření'::text
27
+ WHEN unpivot.measure = 'soil_temp'::text THEN 'Teplota půdy'::text
28
+ WHEN unpivot.measure = 'water_pot'::text THEN 'Vodní potenciál půdy'::text
29
+ WHEN unpivot.measure = 'dendro_circ'::text THEN 'Obvod stromu'::text
30
+ WHEN unpivot.measure = 'dendro_gain'::text THEN 'Přírůstek obvodu stromu'::text
31
+ ELSE NULL::text
32
+ END, ', ', unpivot.height_cm, ' cm'
33
+ ) AS measure_cz,
34
+ CASE
35
+ WHEN unpivot.measure = 'air_temp'::text THEN '°C'::text
36
+ WHEN unpivot.measure = 'air_hum'::text THEN '%'::text
37
+ WHEN unpivot.measure = 'pressure'::text THEN 'Pa'::text
38
+ WHEN unpivot.measure = 'wind_dir'::text THEN '°'::text
39
+ WHEN unpivot.measure = 'wind_impact'::text THEN 'km/h'::text
40
+ WHEN unpivot.measure = 'wind_speed'::text THEN 'km/h'::text
41
+ WHEN unpivot.measure = 'precip'::text THEN 'mm'::text
42
+ WHEN unpivot.measure = 'sun_irr'::text THEN 'lux'::text
43
+ WHEN unpivot.measure = 'soil_temp'::text THEN '°C'::text
44
+ WHEN unpivot.measure = 'water_pot'::text THEN 'kPa'::text
45
+ WHEN unpivot.measure = 'dendro_circ'::text THEN 'mm'::text
46
+ WHEN unpivot.measure = 'dendro_gain'::text THEN 'µm'::text
47
+ ELSE NULL::text
48
+ END AS unit
49
+ FROM microclimate.sensor_devices_import s,
50
+ LATERAL ( VALUES ('air_temp'::text,s.air_temp), ('air_hum'::text,s.air_hum), ('pressure'::text,s.pressure), ('wind_dir'::text,s.wind_dir), ('wind_impact'::text,s.wind_impact), ('wind_speed'::text,s.wind_speed), ('precip'::text,s.precip), ('sun_irr'::text,s.sun_irr), ('soil_temp'::text,s.soil_temp), ('water_pot'::text,s.water_pot), ('dendro_circ'::text,s.dendro_circ), ('dendro_gain'::text,s.dendro_gain)) unpivot(measure, height_cm)
51
+ WHERE unpivot.height_cm IS NOT NULL
52
+ ORDER BY s.point_id;
package/docs/openapi.yaml CHANGED
@@ -257,7 +257,7 @@ components:
257
257
  example: air_temp200
258
258
  measure_cz:
259
259
  type: string
260
- example: Teplota vzduchu
260
+ example: Teplota vzduchu, 200 cm
261
261
  unit:
262
262
  type: string
263
263
  example: °C
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/microclimate",
3
- "version": "1.1.10",
3
+ "version": "1.1.11-dev.943602968",
4
4
  "description": "Golemio Microclimate Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",